From 4e2002a69cda5c40e1dff01f54d81741257eeb81 Mon Sep 17 00:00:00 2001 From: NovaBot <154629622+NovaBot13@users.noreply.github.com> Date: Wed, 27 Mar 2024 19:06:29 -0400 Subject: [PATCH] [MIRROR] Fixing cell power usage (Part 2) (#1628) * 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 <58013024+Pickle-Coding@users.noreply.github.com> * Fixing cell power usage (Part 2) --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com> Co-authored-by: SomeRandomOwl <2568378+SomeRandomOwl@users.noreply.github.com> --- code/game/objects/items/robot/items/food.dm | 2 +- code/game/objects/items/robot/robot_upgrades.dm | 12 ++++++------ code/modules/projectiles/guns/energy/special.dm | 3 ++- code/modules/reagents/reagent_containers/misc.dm | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/code/game/objects/items/robot/items/food.dm b/code/game/objects/items/robot/items/food.dm index 0ecfefa589d..1878b0c1e00 100644 --- a/code/game/objects/items/robot/items/food.dm +++ b/code/game/objects/items/robot/items/food.dm @@ -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) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 71f910c735d..d274467bf68 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -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 var/datum/action/toggle_action /obj/item/borg/upgrade/selfrepair/action(mob/living/silicon/robot/R, user = usr) @@ -355,7 +355,7 @@ 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 @@ -363,16 +363,16 @@ 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)) diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 138f15696fa..51641ce9135 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -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) diff --git a/code/modules/reagents/reagent_containers/misc.dm b/code/modules/reagents/reagent_containers/misc.dm index b7a5fbb71f5..fa8d8cd3628 100644 --- a/code/modules/reagents/reagent_containers/misc.dm +++ b/code/modules/reagents/reagent_containers/misc.dm @@ -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