Skip to content

Commit

Permalink
[MIRROR] Fixing cell power usage (Part 2) (#1628)
Browse files Browse the repository at this point in the history
* Fixing cell power usage (Part 2) (#82198)

## About The Pull Request
Continuation of #82197.

Fixes these issues in #82196
- Cyborg self repair
- Cyborg lollipop dispenser
- Mauna mug
- Plasma cutter (Initial charge not the number of laser shots so partial
fix)

## Changelog
:cl:
fix: Fixed more energy usages for cells(Part 2). See PR 82198 for
details
/:cl:

---------

Co-authored-by: Pickle-Coding <[email protected]>

* Fixing cell power usage (Part 2)

---------

Co-authored-by: SyncIt21 <[email protected]>
Co-authored-by: Pickle-Coding <[email protected]>
Co-authored-by: SomeRandomOwl <[email protected]>
  • Loading branch information
4 people authored and StealsThePRs committed Mar 27, 2024
1 parent 120381a commit 4e2002a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion code/game/objects/items/robot/items/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
check_amount()
if(iscyborg(user))
var/mob/living/silicon/robot/robot_user = user
if(!robot_user.cell.use(12))
if(!robot_user.cell.use(12 KILO JOULES))
to_chat(user, span_warning("Not enough power."))
return AFTERATTACK_PROCESSED_ITEM
switch(mode)
Expand Down
12 changes: 6 additions & 6 deletions code/game/objects/items/robot/robot_upgrades.dm
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
/// Minimum time between repairs in seconds
var/repair_cooldown = 4
var/on = FALSE
var/powercost = 10
var/energy_cost = 10 KILO JOULES

Check failure on line 298 in code/game/objects/items/robot/robot_upgrades.dm

View workflow job for this annotation

GitHub Actions / Run Linters

got 'KILO', expected one of: operator, field access, as, 'in', ';'
var/datum/action/toggle_action

/obj/item/borg/upgrade/selfrepair/action(mob/living/silicon/robot/R, user = usr)
Expand Down Expand Up @@ -355,24 +355,24 @@
deactivate_sr()
return

if(cyborg.cell.charge < powercost * 2)
if(cyborg.cell.charge < energy_cost * 2)
to_chat(cyborg, span_alert("Self-repair module deactivated. Please recharge."))
deactivate_sr()
return

if(cyborg.health < cyborg.maxHealth)
if(cyborg.health < 0)
repair_amount = -2.5
powercost = 30
energy_cost = 30 KILO JOULES
else
repair_amount = -1
powercost = 10
energy_cost = 10 KILO JOULES
cyborg.adjustBruteLoss(repair_amount)
cyborg.adjustFireLoss(repair_amount)
cyborg.updatehealth()
cyborg.cell.use(powercost)
cyborg.cell.use(energy_cost)
else
cyborg.cell.use(5)
cyborg.cell.use(5 KILO JOULES)
next_repair = world.time + repair_cooldown * 10 // Multiply by 10 since world.time is in deciseconds

if(TIMER_COOLDOWN_FINISHED(src, COOLDOWN_BORG_SELF_REPAIR))
Expand Down
3 changes: 2 additions & 1 deletion code/modules/projectiles/guns/energy/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
usesound = list('sound/items/welder.ogg', 'sound/items/welder2.ogg')
tool_behaviour = TOOL_WELDER
toolspeed = 0.7 //plasmacutters can be used as welders, and are faster than standard welders
var/charge_weld = 25 //amount of charge used up to start action (multiplied by amount) and per progress_flash_divisor ticks of welding
/// amount of charge used up to start action (multiplied by amount) and per progress_flash_divisor ticks of welding
var/charge_weld = 25 KILO JOULES

/obj/item/gun/energy/plasmacutter/Initialize(mapload)
AddElement(/datum/element/update_icon_blocker)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/reagent_containers/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
if(on && (!cell || cell.charge <= 0)) //Check if we ran out of power
change_power_status(FALSE)
return FALSE
cell.use(5 * seconds_per_tick) //Basic cell goes for like 200 seconds, bluespace for 8000
cell.use(5 KILO WATTS * seconds_per_tick) //Basic cell goes for like 200 seconds, bluespace for 8000
if(!reagents.total_volume)
return FALSE
var/max_temp = min(500 + (500 * (0.2 * cell.rating)), 1000) // 373 to 1000
Expand Down

0 comments on commit 4e2002a

Please sign in to comment.