From 52686cce6a782727bf5731cbd3fd7a1672468638 Mon Sep 17 00:00:00 2001 From: NovaBot <154629622+NovaBot13@users.noreply.github.com> Date: Fri, 19 Apr 2024 22:28:45 -0400 Subject: [PATCH] [MIRROR] Use cell defined constants for various stuff (#2063) Use cell defined constants for various stuff Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> --- code/__DEFINES/lights.dm | 2 +- code/__DEFINES/power.dm | 8 ++++++-- code/datums/actions/mobs/charge_apc.dm | 2 +- code/game/machinery/autolathe.dm | 4 ++-- code/game/machinery/cell_charger.dm | 7 ++++--- code/game/machinery/doors/firedoor.dm | 2 +- code/game/machinery/firealarm.dm | 2 +- code/game/machinery/rechargestation.dm | 2 +- code/game/machinery/suit_storage_unit.dm | 7 ++++--- code/game/objects/items/devices/powersink.dm | 2 +- code/game/objects/items/inspector.dm | 17 ++++++++++++----- code/game/objects/items/maintenance_loot.dm | 2 +- code/game/objects/items/rcd/RCD.dm | 6 +++--- code/game/objects/items/robot/items/food.dm | 2 +- code/game/objects/items/robot/items/hypo.dm | 8 ++++---- code/game/objects/items/robot/items/tools.dm | 2 +- .../objects/items/robot/robot_upgrades.dm | 8 ++++---- .../stacks/golem_food/golem_status_effects.dm | 19 +++++++++++-------- .../antagonists/ninja/ninjaDrainAct.dm | 16 ++++++++++++---- .../nukeop/equipment/borgchameleon.dm | 4 ++-- .../machinery/air_alarm/air_alarm_interact.dm | 2 +- .../components/electrolyzer/electrolyzer.dm | 2 +- .../machinery/portable/canister.dm | 2 +- .../clothing/spacesuits/_spacesuits.dm | 2 +- code/modules/explorer_drone/loot.dm | 2 +- .../food_and_drinks/machinery/microwave.dm | 2 +- code/modules/hydroponics/plant_genes.dm | 2 +- .../modules/mob/living/basic/festivus_pole.dm | 15 ++++++++------- code/modules/mob/living/silicon/robot/life.dm | 2 +- .../modules/mob/living/silicon/robot/robot.dm | 2 +- code/modules/mod/mod_link.dm | 2 +- code/modules/mod/modules/modules_ninja.dm | 4 ---- code/modules/power/apc/apc_main.dm | 2 +- code/modules/power/apc/apc_tool_act.dm | 4 ++-- code/modules/power/cell.dm | 18 +++++++++--------- .../projectiles/guns/energy/special.dm | 14 ++++++++------ .../chemistry/machinery/chem_mass_spec.dm | 2 +- .../reagents/reagent_containers/misc.dm | 2 +- .../modules/research/machinery/_production.dm | 4 ++-- code/modules/vehicles/mecha/_mecha.dm | 6 +++--- .../mecha/equipment/tools/mining_tools.dm | 2 +- .../mecha/equipment/tools/other_tools.dm | 4 ++-- .../mecha/equipment/tools/work_tools.dm | 2 +- code/modules/vehicles/mecha/mech_bay.dm | 6 +++--- code/modules/vehicles/motorized_wheelchair.dm | 2 +- code/modules/wiremod/shell/gun.dm | 6 +++--- 46 files changed, 129 insertions(+), 106 deletions(-) diff --git a/code/__DEFINES/lights.dm b/code/__DEFINES/lights.dm index 8830f919472..48d210fe031 100644 --- a/code/__DEFINES/lights.dm +++ b/code/__DEFINES/lights.dm @@ -1,5 +1,5 @@ ///How much power emergency lights will consume per tick -#define LIGHT_EMERGENCY_POWER_USE (0.1 KILO WATTS) +#define LIGHT_EMERGENCY_POWER_USE (0.0001 * STANDARD_CELL_RATE) // status values shared between lighting fixtures and items #define LIGHT_OK 0 #define LIGHT_EMPTY 1 diff --git a/code/__DEFINES/power.dm b/code/__DEFINES/power.dm index 0eda3669a71..b9752eac351 100644 --- a/code/__DEFINES/power.dm +++ b/code/__DEFINES/power.dm @@ -19,8 +19,12 @@ ///The joule is the standard unit of energy for this codebase. You can use this with other defines to clarify that it will not be multiplied by time. #define JOULES * JOULE -///The amount of energy, in joules, a standard powercell has. -#define STANDARD_CELL_CHARGE (1 MEGA JOULES) // 1 MJ. +///The capacity of a standard power cell +#define STANDARD_CELL_VALUE (1 MEGA) + ///The amount of energy, in joules, a standard powercell has. + #define STANDARD_CELL_CHARGE (STANDARD_CELL_VALUE JOULES) // 1 MJ. + ///The amount of power, in watts, a standard powercell can give. + #define STANDARD_CELL_RATE (STANDARD_CELL_VALUE WATTS) // 1 MW. GLOBAL_VAR_INIT(CHARGELEVEL, 0.01) // Cap for how fast cells charge, as a percentage per second (.01 means cellcharge is capped to 1% per second) diff --git a/code/datums/actions/mobs/charge_apc.dm b/code/datums/actions/mobs/charge_apc.dm index 47436beab76..8086ba72207 100644 --- a/code/datums/actions/mobs/charge_apc.dm +++ b/code/datums/actions/mobs/charge_apc.dm @@ -1,5 +1,5 @@ ///how much charge are we giving off to an APC? -#define CHARGE_AMOUNT (80 KILO JOULES) +#define CHARGE_AMOUNT (0.08 * STANDARD_CELL_CHARGE) /datum/action/cooldown/mob_cooldown/charge_apc name = "Charge APCs" diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 4fbfe2d37bf..0297365bd99 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -4,8 +4,8 @@ icon = 'icons/obj/machines/lathes.dmi' icon_state = "autolathe" density = TRUE - //Energy cost per full stack of sheets worth of materials used. Material insertion is 40% of this. - active_power_usage = 25 * BASE_MACHINE_ACTIVE_CONSUMPTION + ///Energy cost per full stack of sheets worth of materials used. Material insertion is 40% of this. + active_power_usage = 0.025 * STANDARD_CELL_RATE circuit = /obj/item/circuitboard/machine/autolathe layer = BELOW_OBJ_LAYER processing_flags = NONE diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 49121b7526a..abe24d50eed 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -7,7 +7,7 @@ circuit = /obj/item/circuitboard/machine/cell_charger pass_flags = PASSTABLE var/obj/item/stock_parts/cell/charging = null - var/charge_rate = 250 KILO WATTS + var/charge_rate = 0.25 * STANDARD_CELL_RATE /* OVERWRITTEN IN modular_nova\modules\aesthetics\cells\cell.dm /obj/machinery/cell_charger/update_overlays() @@ -133,7 +133,7 @@ /obj/machinery/cell_charger/RefreshParts() . = ..() - charge_rate = 250 KILO WATTS + charge_rate = 0.25 * STANDARD_CELL_RATE for(var/datum/stock_part/capacitor/capacitor in component_parts) charge_rate *= capacitor.tier @@ -147,7 +147,8 @@ if(!main_draw) return - use_energy(main_draw * 0.01) //use a small bit for the charger itself, but power usage scales up with the part tier + //use a small bit for the charger itself, but power usage scales up with the part tier + use_energy(main_draw * 0.01) charge_cell(main_draw, charging, grid_only = TRUE) update_appearance() diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 22efac7cd21..4fc261fcaea 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -887,7 +887,7 @@ return if(istype(attacking_object, /obj/item/electroadaptive_pseudocircuit)) var/obj/item/electroadaptive_pseudocircuit/raspberrypi = attacking_object - if(!raspberrypi.adapt_circuit(user, circuit_cost = DEFAULT_STEP_TIME * 0.5 KILO JOULES)) + if(!raspberrypi.adapt_circuit(user, circuit_cost = DEFAULT_STEP_TIME * 0.0005 * STANDARD_CELL_CHARGE)) return user.visible_message(span_notice("[user] fabricates a circuit and places it into [src]."), \ span_notice("You adapt a firelock circuit and slot it into the assembly.")) diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index e1d291f83f5..1f2500051c0 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -404,7 +404,7 @@ else if(istype(tool, /obj/item/electroadaptive_pseudocircuit)) var/obj/item/electroadaptive_pseudocircuit/pseudoc = tool - if(!pseudoc.adapt_circuit(user, circuit_cost = 15 KILO JOULES)) + if(!pseudoc.adapt_circuit(user, circuit_cost = 0.015 * STANDARD_CELL_CHARGE)) return user.visible_message(span_notice("[user] fabricates a circuit and places it into [src]."), \ span_notice("You adapt a fire alarm circuit and slot it into the assembly.")) diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 25f73963fd2..b328d99284d 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -178,7 +178,7 @@ if(!occupant) return - if(!use_energy(active_power_usage * seconds_per_tick)) + if(!use_energy(active_power_usage * seconds_per_tick, force = FALSE)) return SEND_SIGNAL(occupant, COMSIG_PROCESS_BORGCHARGER_OCCUPANT, charge_cell, seconds_per_tick, repairs, sendmats) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index d95668975f5..a5e301c2168 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -1,3 +1,4 @@ + // SUIT STORAGE UNIT ///////////////// /obj/machinery/suit_storage_unit name = "suit storage unit" @@ -55,9 +56,9 @@ /// How long it takes to break out of the SSU. var/breakout_time = 30 SECONDS /// Power contributed by this machine to charge the mod suits cell without any capacitors - var/base_charge_rate = 200 KILO WATTS + var/base_charge_rate = 0.2 * STANDARD_CELL_RATE /// Final charge rate which is base_charge_rate + contribution by capacitors - var/final_charge_rate = 250 KILO WATTS + var/final_charge_rate = 0.25 * STANDARD_CELL_RATE /// is the card reader installed in this machine var/card_reader_installed = FALSE /// physical reference of the players id card to check for PERSONAL access level @@ -287,7 +288,7 @@ . = ..() for(var/datum/stock_part/capacitor/capacitor in component_parts) - final_charge_rate = base_charge_rate + (capacitor.tier * 50 KILO WATTS) + final_charge_rate = base_charge_rate + (capacitor.tier * 0.05 * STANDARD_CELL_RATE) set_access() diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm index 1b000ea2f91..1925737143e 100644 --- a/code/game/objects/items/devices/powersink.dm +++ b/code/game/objects/items/devices/powersink.dm @@ -171,7 +171,7 @@ if(istype(terminal.master, /obj/machinery/power/apc)) var/obj/machinery/power/apc/apc = terminal.master if(apc.operating && apc.cell) - drained += 0.001 * apc.cell.use(50 KILO JOULES, force = TRUE) + drained += 0.001 * apc.cell.use(0.05 * STANDARD_CELL_CHARGE, force = TRUE) internal_heat += drained /obj/item/powersink/process() diff --git a/code/game/objects/items/inspector.dm b/code/game/objects/items/inspector.dm index 2f25e53c1fb..a3956f75c06 100644 --- a/code/game/objects/items/inspector.dm +++ b/code/game/objects/items/inspector.dm @@ -1,3 +1,6 @@ +///Energy used to say an error message. +#define ENERGY_TO_SPEAK (0.001 * STANDARD_CELL_CHARGE) + /** * # N-spect scanner * @@ -28,8 +31,6 @@ var/cell_cover_open = FALSE ///Energy used per print. var/energy_per_print = INSPECTOR_ENERGY_USAGE_NORMAL - ///Energy used to say an error message. - var/energy_to_speak = 1 KILO JOULES /obj/item/inspector/Initialize(mapload) . = ..() @@ -112,7 +113,7 @@ to_chat(user, "\The [src] doesn't seem to be on... Perhaps it ran out of power?") return if(!cell.use(energy_per_print)) - if(cell.use(energy_to_speak)) + if(cell.use(ENERGY_TO_SPEAK)) say("ERROR! POWER CELL CHARGE LEVEL TOO LOW TO PRINT REPORT!") return @@ -258,7 +259,7 @@ /obj/item/inspector/clown/bananium/proc/check_settings_legality() if(print_sound_mode == INSPECTOR_PRINT_SOUND_MODE_NORMAL && time_mode == INSPECTOR_TIME_MODE_HONK) - if(cell.use(energy_to_speak)) + if(cell.use(ENERGY_TO_SPEAK)) say("Setting combination forbidden by Geneva convention revision CCXXIII selected, reverting to defaults") time_mode = INSPECTOR_TIME_MODE_SLOW print_sound_mode = INSPECTOR_PRINT_SOUND_MODE_NORMAL @@ -296,7 +297,7 @@ if(time_mode != INSPECTOR_TIME_MODE_HONK) return ..() if(paper_charges == 0) - if(cell.use(energy_to_speak)) + if(cell.use(ENERGY_TO_SPEAK)) say("ERROR! OUT OF PAPER! MAXIMUM PRINTING SPEED UNAVAIBLE! SWITCH TO A SLOWER SPEED TO OR PROVIDE PAPER!") else to_chat(user, "\The [src] doesn't seem to be on... Perhaps it ran out of power?") @@ -384,3 +385,9 @@ target.MakeSlippery(TURF_WET_WATER, min_wet_time = 10 SECONDS, wet_time_to_add = 5 SECONDS) to_chat(user, span_notice("As you try to fold [src] into the shape of a plane, it disintegrates into water!")) qdel(src) +<<<<<<< HEAD +======= + return CLICK_ACTION_SUCCESS + +#undef ENERGY_TO_SPEAK +>>>>>>> c93a831b29e ([MIRROR] Use cell defined constants for various stuff (#2063)) diff --git a/code/game/objects/items/maintenance_loot.dm b/code/game/objects/items/maintenance_loot.dm index 52ed1880081..f6d7fd1c329 100644 --- a/code/game/objects/items/maintenance_loot.dm +++ b/code/game/objects/items/maintenance_loot.dm @@ -30,7 +30,7 @@ icon_state = "lead_battery" throwforce = 10 maxcharge = STANDARD_CELL_CHARGE * 20 //decent max charge - chargerate = STANDARD_CELL_CHARGE * 0.7 //charging is about 30% less efficient than lithium batteries. + chargerate = STANDARD_CELL_RATE * 0.7 //charging is about 30% less efficient than lithium batteries. charge_light_type = null connector_type = "leadacid" rating = 2 //Kind of a mid-tier battery diff --git a/code/game/objects/items/rcd/RCD.dm b/code/game/objects/items/rcd/RCD.dm index 91b51053b0e..88daf279c59 100644 --- a/code/game/objects/items/rcd/RCD.dm +++ b/code/game/objects/items/rcd/RCD.dm @@ -428,7 +428,7 @@ desc = "A device used to rapidly build walls and floors." banned_upgrades = RCD_UPGRADE_SILO_LINK /// enery usage - var/energyfactor = 72 KILO JOULES + var/energyfactor = 0.072 * STANDARD_CELL_CHARGE /obj/item/construction/rcd/borg/get_matter(mob/user) if(!iscyborg(user)) @@ -470,7 +470,7 @@ desc = "A reverse-engineered RCD with black market upgrades that allow this device to deconstruct reinforced walls. Property of Donk Co." icon_state = "ircd" inhand_icon_state = "ircd" - energyfactor = 66 KILO JOULES + energyfactor = 0.066 * STANDARD_CELL_CHARGE canRturf = TRUE /obj/item/construction/rcd/loaded @@ -522,7 +522,7 @@ upgrade = RCD_ALL_UPGRADES & ~RCD_UPGRADE_SILO_LINK ///How much charge is used up for each matter unit. -#define MASS_TO_ENERGY (16 KILO JOULES) +#define MASS_TO_ENERGY (0.016 * STANDARD_CELL_CHARGE) /obj/item/construction/rcd/exosuit name = "mounted RCD" diff --git a/code/game/objects/items/robot/items/food.dm b/code/game/objects/items/robot/items/food.dm index 1878b0c1e00..40166a6a8fb 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 KILO JOULES)) + if(!robot_user.cell.use(0.012 * STANDARD_CELL_CHARGE)) to_chat(user, span_warning("Not enough power.")) return AFTERATTACK_PROCESSED_ITEM switch(mode) diff --git a/code/game/objects/items/robot/items/hypo.dm b/code/game/objects/items/robot/items/hypo.dm index da280e9f728..9dadf3593e5 100644 --- a/code/game/objects/items/robot/items/hypo.dm +++ b/code/game/objects/items/robot/items/hypo.dm @@ -109,7 +109,7 @@ */ var/max_volume_per_reagent = 30 /// Cell cost for charging a reagent - var/charge_cost = 50 KILO JOULES + var/charge_cost = 0.05 * STANDARD_CELL_CHARGE /// Counts up to the next time we charge var/charge_timer = 0 /// Time it takes for shots to recharge (in seconds) @@ -311,7 +311,7 @@ Also metabolizes potassium iodide for radiation poisoning, inacusiate for ear damage and morphine for offense." icon_state = "borghypo_s" tgui_theme = "syndicate" - charge_cost = 20 KILO JOULES + charge_cost = 0.02 * STANDARD_CELL_CHARGE recharge_time = 2 default_reagent_types = BASE_SYNDICATE_REAGENTS bypass_protection = TRUE @@ -324,7 +324,7 @@ icon_state = "shaker" possible_transfer_amounts = list(5,10,20,1) // Lots of reagents all regenerating at once, so the charge cost is lower. They also regenerate faster. - charge_cost = 20 KILO JOULES + charge_cost = 0.02 * STANDARD_CELL_CHARGE recharge_time = 3 dispensed_temperature = WATER_MATTERSTATE_CHANGE_TEMP //Water stays wet, ice stays ice default_reagent_types = BASE_SERVICE_REAGENTS @@ -396,7 +396,7 @@ icon_state = "flour" possible_transfer_amounts = list(5,10,20,1) // Lots of reagents all regenerating at once, so the charge cost is lower. They also regenerate faster. - charge_cost = 40 KILO JOULES //Costs double the power of the borgshaker due to synthesizing solids + charge_cost = 0.04 * STANDARD_CELL_CHARGE //Costs double the power of the borgshaker due to synthesizing solids recharge_time = 6 //Double the recharge time too, for the same reason. dispensed_temperature = WATER_MATTERSTATE_CHANGE_TEMP default_reagent_types = EXPANDED_SERVICE_REAGENTS diff --git a/code/game/objects/items/robot/items/tools.dm b/code/game/objects/items/robot/items/tools.dm index 538fd1b7ca1..60bb1089681 100644 --- a/code/game/objects/items/robot/items/tools.dm +++ b/code/game/objects/items/robot/items/tools.dm @@ -1,5 +1,5 @@ #define PKBORG_DAMPEN_CYCLE_DELAY (2 SECONDS) -#define POWER_RECHARGE_CYBORG_DRAIN_MULTIPLIER (0.4 KILO WATTS) +#define POWER_RECHARGE_CYBORG_DRAIN_MULTIPLIER (0.0004 * STANDARD_CELL_RATE) /obj/item/cautery/prt //it's a subtype of cauteries so that it inherits the cautery sprites and behavior and stuff, because I'm too lazy to make sprites for this thing name = "plating repair tool" diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 264e039dfe1..dd44a96c407 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -298,7 +298,7 @@ /// Minimum time between repairs in seconds var/repair_cooldown = 4 var/on = FALSE - var/energy_cost = 10 KILO JOULES + var/energy_cost = 0.01 * STANDARD_CELL_CHARGE var/datum/action/toggle_action /obj/item/borg/upgrade/selfrepair/action(mob/living/silicon/robot/R, user = usr) @@ -366,16 +366,16 @@ if(cyborg.health < cyborg.maxHealth) if(cyborg.health < 0) repair_amount = -2.5 - energy_cost = 30 KILO JOULES + energy_cost = 0.03 * STANDARD_CELL_CHARGE else repair_amount = -1 - energy_cost = 10 KILO JOULES + energy_cost = 0.01 * STANDARD_CELL_CHARGE cyborg.adjustBruteLoss(repair_amount) cyborg.adjustFireLoss(repair_amount) cyborg.updatehealth() cyborg.cell.use(energy_cost) else - cyborg.cell.use(5 KILO JOULES) + cyborg.cell.use(0.005 * STANDARD_CELL_CHARGE) 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/game/objects/items/stacks/golem_food/golem_status_effects.dm b/code/game/objects/items/stacks/golem_food/golem_status_effects.dm index c55a39c20f7..bf2c628ab97 100644 --- a/code/game/objects/items/stacks/golem_food/golem_status_effects.dm +++ b/code/game/objects/items/stacks/golem_food/golem_status_effects.dm @@ -160,6 +160,11 @@ owner.remove_traits(list(TRAIT_ANTIMAGIC, TRAIT_HOLY), TRAIT_STATUS_EFFECT(id)) return ..() +/// What do we multiply our damage by to convert it into power? +#define ENERGY_PER_DAMAGE (0.005 * STANDARD_CELL_CHARGE) +/// Multiplier to apply to burn damage, not 0 so that we can reverse it more easily +#define BURN_MULTIPLIER 0.05 + /// Heat immunity, turns heat damage into local power /datum/status_effect/golem/plasma overlay_state_prefix = "plasma" @@ -167,10 +172,6 @@ applied_fluff = "Plasma cooling rods sprout from your body. You can take the heat!" alert_icon_state = "sheet-plasma" alert_desc = "You are protected from high pressure and can convert heat damage into power." - /// What do we multiply our damage by to convert it into power? - var/energy_per_damage = 5 KILO JOULES - /// Multiplier to apply to burn damage, not 0 so that we can reverse it more easily - var/burn_multiplier = 0.05 /datum/status_effect/golem/plasma/on_apply() . = ..() @@ -179,14 +180,14 @@ owner.add_traits(list(TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTHEAT, TRAIT_ASHSTORM_IMMUNE), TRAIT_STATUS_EFFECT(id)) RegisterSignal(owner, COMSIG_MOB_APPLY_DAMAGE, PROC_REF(on_burned)) var/mob/living/carbon/human/human_owner = owner - human_owner.physiology.burn_mod *= burn_multiplier + human_owner.physiology.burn_mod *= BURN_MULTIPLIER return TRUE /datum/status_effect/golem/plasma/on_remove() owner.remove_traits(list(TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTHEAT, TRAIT_ASHSTORM_IMMUNE), TRAIT_STATUS_EFFECT(id)) UnregisterSignal(owner, COMSIG_MOB_APPLY_DAMAGE) var/mob/living/carbon/human/human_owner = owner - human_owner.physiology.burn_mod /= burn_multiplier + human_owner.physiology.burn_mod /= BURN_MULTIPLIER return ..() /// When we take fire damage (or... technically also cold damage, we don't differentiate), zap a nearby APC @@ -195,7 +196,6 @@ if(damagetype != BURN) return - var/power = damage * energy_per_damage var/obj/machinery/power/energy_accumulator/ground = get_closest_atom(/obj/machinery/power/energy_accumulator, view(4, owner), owner) if (ground) zap_effect(ground) @@ -206,7 +206,10 @@ if (!our_apc) return zap_effect(our_apc) - our_apc.cell?.give(power) + our_apc.cell?.give(damage * ENERGY_PER_DAMAGE) + +#undef ENERGY_PER_DAMAGE +#undef BURN_MULTIPLIER /// Shoot a beam at the target atom /datum/status_effect/golem/plasma/proc/zap_effect(atom/target) diff --git a/code/modules/antagonists/ninja/ninjaDrainAct.dm b/code/modules/antagonists/ninja/ninjaDrainAct.dm index 4f8d263f9a4..c4c6fa09183 100644 --- a/code/modules/antagonists/ninja/ninjaDrainAct.dm +++ b/code/modules/antagonists/ninja/ninjaDrainAct.dm @@ -1,3 +1,8 @@ +/// Minimum amount of energy we can drain in a single drain action +#define NINJA_MIN_DRAIN (0.2 * STANDARD_CELL_CHARGE) +/// Maximum amount of energy we can drain in a single drain action +#define NINJA_MAX_DRAIN (0.4 * STANDARD_CELL_CHARGE) + /** * Atom level proc for space ninja's glove interactions. * @@ -26,7 +31,7 @@ var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread() spark_system.set_up(5, 0, loc) while(cell.charge> 0 && !maxcapacity) - drain = rand(hacking_module.mindrain, hacking_module.maxdrain) + drain = rand(NINJA_MIN_DRAIN, NINJA_MAX_DRAIN) if(cell.charge < drain) drain = cell.charge if(hacking_module.mod.get_charge() + drain > hacking_module.mod.get_max_charge()) @@ -62,7 +67,7 @@ var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread() spark_system.set_up(5, 0, loc) while(charge > 0 && !maxcapacity) - drain = rand(hacking_module.mindrain, hacking_module.maxdrain) + drain = rand(NINJA_MIN_DRAIN, NINJA_MAX_DRAIN) if(charge < drain) drain = charge if(hacking_module.mod.get_charge() + drain > hacking_module.mod.get_max_charge()) @@ -228,7 +233,7 @@ var/drain_total = 0 var/datum/powernet/wire_powernet = powernet while(!maxcapacity && src) - drain = (round((rand(hacking_module.mindrain, hacking_module.maxdrain))/2)) + drain = (round((rand(NINJA_MIN_DRAIN, NINJA_MAX_DRAIN))/2)) var/drained = 0 if(wire_powernet && do_after(ninja, 1 SECONDS, target = src, hidden = TRUE)) drained = min(drain, delayed_surplus()) @@ -264,7 +269,7 @@ var/drain_total = 0 if(get_charge()) while(cell.charge > 0 && !maxcapacity) - drain = rand(hacking_module.mindrain, hacking_module.maxdrain) + drain = rand(NINJA_MIN_DRAIN, NINJA_MAX_DRAIN) if(cell.charge < drain) drain = cell.charge if(hacking_module.mod.get_charge() + drain > hacking_module.mod.get_max_charge()) @@ -477,3 +482,6 @@ //FIRELOCKS// /obj/machinery/door/firedoor/ninjadrain_act(mob/living/carbon/human/ninja, obj/item/mod/module/hacker/hacking_module) crack_open() + +#undef NINJA_MIN_DRAIN +#undef NINJA_MAX_DRAIN diff --git a/code/modules/antagonists/nukeop/equipment/borgchameleon.dm b/code/modules/antagonists/nukeop/equipment/borgchameleon.dm index a2a072f02e2..9b536066843 100644 --- a/code/modules/antagonists/nukeop/equipment/borgchameleon.dm +++ b/code/modules/antagonists/nukeop/equipment/borgchameleon.dm @@ -1,5 +1,5 @@ -#define ACTIVATION_COST (300 KILO JOULES) -#define ACTIVATION_UP_KEEP (25 KILO WATTS) +#define ACTIVATION_COST (0.3 * STANDARD_CELL_CHARGE) +#define ACTIVATION_UP_KEEP (0.025 * STANDARD_CELL_RATE) /obj/item/borg_chameleon name = "cyborg chameleon projector" diff --git a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm index bb45d1f8c1f..f7eaf5788c9 100644 --- a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm +++ b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm @@ -140,7 +140,7 @@ if(istype(W, /obj/item/electroadaptive_pseudocircuit)) var/obj/item/electroadaptive_pseudocircuit/P = W - if(!P.adapt_circuit(user, circuit_cost = 25 KILO JOULES)) + if(!P.adapt_circuit(user, circuit_cost = 0.025 * STANDARD_CELL_CHARGE)) return user.visible_message(span_notice("[user] fabricates a circuit and places it into [src]."), \ span_notice("You adapt an air alarm circuit and slot it into the assembly.")) diff --git a/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm b/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm index 0ab8427c0ae..3be95de5605 100644 --- a/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm +++ b/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm @@ -127,7 +127,7 @@ if(anchored) use_energy(power_to_use) else - cell.use(power_to_use KILO JOULES) + cell.use(power_to_use) /obj/machinery/electrolyzer/proc/call_reactions(datum/gas_mixture/env) for(var/reaction in GLOB.electrolyzer_reactions) diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 75152798bba..6d4a8ad714a 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -483,7 +483,7 @@ var/energy_consumed = energy_factor * 250 * seconds_per_tick if(powered(AREA_USAGE_EQUIP, ignore_use_power = TRUE)) use_energy(energy_consumed, channel = AREA_USAGE_EQUIP) - else if(!internal_cell?.use(energy_consumed * 0.025 KILO JOULES)) + else if(!internal_cell?.use(energy_consumed * 0.025)) shielding_powered = FALSE SSair.start_processing_machine(src) investigate_log("shielding turned off due to power loss") diff --git a/code/modules/clothing/spacesuits/_spacesuits.dm b/code/modules/clothing/spacesuits/_spacesuits.dm index 31fc1122316..0af8a72636d 100644 --- a/code/modules/clothing/spacesuits/_spacesuits.dm +++ b/code/modules/clothing/spacesuits/_spacesuits.dm @@ -1,5 +1,5 @@ /// Charge per tick consumed by the thermal regulator -#define THERMAL_REGULATOR_COST (18 KILO JOULES) +#define THERMAL_REGULATOR_COST (0.018 * STANDARD_CELL_CHARGE) //Note: Everything in modules/clothing/spacesuits should have the entire suit grouped together. // Meaning the the suit is defined directly after the corrisponding helmet. Just like below! diff --git a/code/modules/explorer_drone/loot.dm b/code/modules/explorer_drone/loot.dm index 88cd5f38275..72773123968 100644 --- a/code/modules/explorer_drone/loot.dm +++ b/code/modules/explorer_drone/loot.dm @@ -175,7 +175,7 @@ GLOBAL_LIST_INIT(adventure_loot_generator_index,generate_generator_index()) return if(LAZYACCESS(user.do_afters, "firelance")) return - if(!cell.use(200 KILO JOULES)) + if(!cell.use(0.2 * STANDARD_CELL_CHARGE)) to_chat(user,span_warning("[src] battery ran dry!")) return ADD_TRAIT(user, TRAIT_IMMOBILIZED, REF(src)) diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index 2b9315dfd55..8e15c9b01c4 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -15,7 +15,7 @@ #define MAX_MICROWAVE_DIRTINESS 100 /// For the wireless version, and display fluff -#define TIER_1_CELL_CHARGE_RATE (250 KILO JOULES) +#define TIER_1_CELL_CHARGE_RATE (0.25 * STANDARD_CELL_CHARGE) /obj/machinery/microwave name = "microwave oven" diff --git a/code/modules/hydroponics/plant_genes.dm b/code/modules/hydroponics/plant_genes.dm index bf52eb315d8..7cff6080f2b 100644 --- a/code/modules/hydroponics/plant_genes.dm +++ b/code/modules/hydroponics/plant_genes.dm @@ -589,7 +589,7 @@ var/obj/item/stock_parts/cell/potato/pocell = new /obj/item/stock_parts/cell/potato(user.loc) pocell.icon = our_plant.icon // Just in case the plant icons get spread out in different files eventually, this trait won't cause error sprites (also yay downstreams) pocell.icon_state = our_plant.icon_state - pocell.maxcharge = our_seed.potency * 20 KILO JOULES + pocell.maxcharge = our_seed.potency * 0.02 * STANDARD_CELL_CHARGE // The secret of potato supercells! var/datum/plant_gene/trait/cell_charge/electrical_gene = our_seed.get_gene(/datum/plant_gene/trait/cell_charge) diff --git a/code/modules/mob/living/basic/festivus_pole.dm b/code/modules/mob/living/basic/festivus_pole.dm index 90eca4b272d..838674c0811 100644 --- a/code/modules/mob/living/basic/festivus_pole.dm +++ b/code/modules/mob/living/basic/festivus_pole.dm @@ -1,3 +1,6 @@ +///how much charge we give off to cells around us when rubbed +#define FESTIVUS_RECHARGE_VALUE (0.075 * STANDARD_CELL_CHARGE) + /mob/living/basic/festivus name = "festivus pole" desc = "Serenity now... SERENITY NOW!" @@ -37,10 +40,6 @@ ai_controller = /datum/ai_controller/basic_controller/festivus_pole - ///how much charge we give off to cells around us when rubbed - var/recharge_value = 75 KILO JOULES - - /mob/living/basic/festivus/Initialize(mapload) . = ..() AddComponent(/datum/component/seethrough_mob) @@ -71,16 +70,16 @@ for(var/atom/affected in range(2, get_turf(src))) if(istype(affected, /obj/item/stock_parts/cell)) var/obj/item/stock_parts/cell/cell = affected - cell.give(recharge_value) + cell.give(FESTIVUS_RECHARGE_VALUE) cell.update_appearance() if(istype(affected, /mob/living/silicon/robot)) var/mob/living/silicon/robot/robot = affected if(robot.cell) - robot.cell.give(recharge_value) + robot.cell.give(FESTIVUS_RECHARGE_VALUE) if(istype(affected, /obj/machinery/power/apc)) var/obj/machinery/power/apc/apc_target = affected if(apc_target.cell) - apc_target.cell.give(recharge_value) + apc_target.cell.give(FESTIVUS_RECHARGE_VALUE) /datum/ai_planning_subtree/find_and_hunt_target/look_for_apcs hunting_behavior = /datum/ai_behavior/hunt_target/apcs @@ -118,3 +117,5 @@ return FALSE return can_see(source, dinner, radius) + +#undef FESTIVUS_RECHARGE_VALUE diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 2a9631339fc..0f1cbfa65a5 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -18,7 +18,7 @@ /mob/living/silicon/robot/proc/use_energy(seconds_per_tick, times_fired) if(cell?.charge) - if(cell.charge <= (10 KILO JOULES)) + if(cell.charge <= 0.01 * STANDARD_CELL_CHARGE) drop_all_held_items() var/energy_consumption = max(lamp_power_consumption * lamp_enabled * lamp_intensity * seconds_per_tick, BORG_MINIMUM_POWER_CONSUMPTION * seconds_per_tick) //Lamp will use a max of 5 * [BORG_LAMP_POWER_CONSUMPTION], depending on brightness of lamp. If lamp is off, borg systems consume [BORG_MINIMUM_POWER_CONSUMPTION], or the rest of the cell if it's lower than that. cell.use(energy_consumption, force = TRUE) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index e3785085aad..d3ff4ee9508 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -234,7 +234,7 @@ if(!ionpulse_on) return - if(!cell.use(10 KILO JOULES)) + if(!cell.use(0.01 * STANDARD_CELL_CHARGE)) toggle_ionpulse() return return TRUE diff --git a/code/modules/mod/mod_link.dm b/code/modules/mod/mod_link.dm index c507bca3156..54417d656e8 100644 --- a/code/modules/mod/mod_link.dm +++ b/code/modules/mod/mod_link.dm @@ -203,7 +203,7 @@ /obj/item/clothing/neck/link_scryer/process(seconds_per_tick) if(!mod_link.link_call) return - cell.use(20 KILO WATTS * seconds_per_tick, force = TRUE) + cell.use(0.02 * STANDARD_CELL_RATE * seconds_per_tick, force = TRUE) /obj/item/clothing/neck/link_scryer/attackby(obj/item/attacked_by, mob/user, params) . = ..() diff --git a/code/modules/mod/modules/modules_ninja.dm b/code/modules/mod/modules/modules_ninja.dm index 868b4a79500..d52a5e1fb4c 100644 --- a/code/modules/mod/modules/modules_ninja.dm +++ b/code/modules/mod/modules/modules_ninja.dm @@ -133,10 +133,6 @@ icon_state = "hacker" removable = FALSE incompatible_modules = list(/obj/item/mod/module/hacker) - /// Minimum amount of energy we can drain in a single drain action - var/mindrain = 200 KILO JOULES - /// Maximum amount of energy we can drain in a single drain action - var/maxdrain = 400 KILO JOULES /// Whether or not the communication console hack was used to summon another antagonist. var/communication_console_hack_success = FALSE /// How many times the module has been used to force open doors. diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index 0cc87a71ee6..f9380f3af1f 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -636,7 +636,7 @@ /obj/machinery/power/apc/proc/overload_lighting() if(!operating || shorted) return - if(cell && cell.use(20 KILO JOULES)) + if(cell && cell.use(0.02 * STANDARD_CELL_CHARGE)) INVOKE_ASYNC(src, PROC_REF(break_lights)) /obj/machinery/power/apc/proc/break_lights() diff --git a/code/modules/power/apc/apc_tool_act.dm b/code/modules/power/apc/apc_tool_act.dm index 6a8835cd5b7..0116205fdd4 100644 --- a/code/modules/power/apc/apc_tool_act.dm +++ b/code/modules/power/apc/apc_tool_act.dm @@ -168,7 +168,7 @@ if(machine_stat & BROKEN) balloon_alert(user, "frame is too damaged!") return ITEM_INTERACT_BLOCKING - if(!pseudocircuit.adapt_circuit(user, circuit_cost = 50 KILO JOULES)) + if(!pseudocircuit.adapt_circuit(user, circuit_cost = 0.05 * STANDARD_CELL_CHARGE)) return ITEM_INTERACT_BLOCKING user.visible_message( span_notice("[user] fabricates a circuit and places it into [src]."), @@ -182,7 +182,7 @@ if(machine_stat & MAINT) balloon_alert(user, "no board for a cell!") return ITEM_INTERACT_BLOCKING - if(!pseudocircuit.adapt_circuit(user, circuit_cost = 500 KILO JOULES)) + if(!pseudocircuit.adapt_circuit(user, circuit_cost = 0.5 * STANDARD_CELL_CHARGE)) return ITEM_INTERACT_BLOCKING var/obj/item/stock_parts/cell/crap/empty/bad_cell = new(src) bad_cell.forceMove(src) diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index 5196fb5deed..a620624d584 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -31,7 +31,7 @@ ///If the power cell was damaged by an explosion, chance for it to become corrupted and function the same as rigged. var/corrupted = FALSE ///How much power is given per second in a recharger. - var/chargerate = STANDARD_CELL_CHARGE * 0.05 + var/chargerate = STANDARD_CELL_RATE * 0.05 ///If true, the cell will state it's maximum charge in it's description var/ratingdesc = TRUE ///If it's a grown that acts as a battery, add a wire overlay to it. @@ -326,7 +326,7 @@ desc = "A power cell with a slightly higher capacity than normal!" maxcharge = STANDARD_CELL_CHARGE * 2.5 custom_materials = list(/datum/material/glass=SMALL_MATERIAL_AMOUNT*0.5) - chargerate = STANDARD_CELL_CHARGE * 0.5 + chargerate = STANDARD_CELL_RATE * 0.5 /obj/item/stock_parts/cell/upgraded/plus name = "upgraded power cell+" @@ -352,7 +352,7 @@ /obj/item/stock_parts/cell/pulse //200 pulse shots name = "pulse rifle power cell" maxcharge = STANDARD_CELL_CHARGE * 40 - chargerate = STANDARD_CELL_CHARGE * 0.75 + chargerate = STANDARD_CELL_RATE * 0.75 /obj/item/stock_parts/cell/pulse/carbine //25 pulse shots name = "pulse carbine power cell" @@ -367,14 +367,14 @@ icon_state = "bscell" maxcharge = STANDARD_CELL_CHARGE * 10 custom_materials = list(/datum/material/glass=SMALL_MATERIAL_AMOUNT*0.6) - chargerate = STANDARD_CELL_CHARGE + chargerate = STANDARD_CELL_RATE /obj/item/stock_parts/cell/high name = "high-capacity power cell" icon_state = "hcell" maxcharge = STANDARD_CELL_CHARGE * 10 custom_materials = list(/datum/material/glass=SMALL_MATERIAL_AMOUNT*0.6) - chargerate = STANDARD_CELL_CHARGE * 0.75 + chargerate = STANDARD_CELL_RATE * 0.75 /obj/item/stock_parts/cell/high/empty empty = TRUE @@ -384,7 +384,7 @@ icon_state = "scell" maxcharge = STANDARD_CELL_CHARGE * 20 custom_materials = list(/datum/material/glass=SMALL_MATERIAL_AMOUNT * 3) - chargerate = STANDARD_CELL_CHARGE + chargerate = STANDARD_CELL_RATE /obj/item/stock_parts/cell/super/empty empty = TRUE @@ -394,7 +394,7 @@ icon_state = "hpcell" maxcharge = STANDARD_CELL_CHARGE * 30 custom_materials = list(/datum/material/glass=SMALL_MATERIAL_AMOUNT * 4) - chargerate = STANDARD_CELL_CHARGE * 1.5 + chargerate = STANDARD_CELL_RATE * 1.5 /obj/item/stock_parts/cell/hyper/empty empty = TRUE @@ -405,7 +405,7 @@ icon_state = "bscell" maxcharge = STANDARD_CELL_CHARGE * 40 custom_materials = list(/datum/material/glass=SMALL_MATERIAL_AMOUNT*6) - chargerate = STANDARD_CELL_CHARGE * 2 + chargerate = STANDARD_CELL_RATE * 2 /obj/item/stock_parts/cell/bluespace/empty empty = TRUE @@ -478,7 +478,7 @@ name = "beam rifle capacitor" desc = "A high powered capacitor that can provide huge amounts of energy in an instant." maxcharge = STANDARD_CELL_CHARGE * 50 - chargerate = STANDARD_CELL_CHARGE * 2.5 //Extremely energy intensive + chargerate = STANDARD_CELL_RATE * 2.5 //Extremely energy intensive /obj/item/stock_parts/cell/beam_rifle/corrupt() return diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index fdee37eee98..bdd64910528 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -78,6 +78,9 @@ ammo_type = list(/obj/item/ammo_casing/energy/mindflayer) ammo_x_offset = 2 +/// amount of charge used up to start action (multiplied by amount) and per progress_flash_divisor ticks of welding +#define PLASMA_CUTTER_CHARGE_WELD (0.025 * STANDARD_CELL_CHARGE) + /obj/item/gun/energy/plasmacutter name = "plasma cutter" desc = "A mining tool capable of expelling concentrated plasma bursts. You could use it to cut limbs off xenos! Or, you know, mine stuff." @@ -91,13 +94,10 @@ sharpness = SHARP_EDGED can_charge = FALSE gun_flags = NOT_A_REAL_GUN - heat = 3800 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 - /// 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) @@ -126,7 +126,7 @@ balloon_alert(user, "already fully charged!") return I.use(1) - cell.give(500 KILO JOULES * charge_multiplier) + cell.give(0.5 * STANDARD_CELL_CHARGE * charge_multiplier) balloon_alert(user, "cell recharged") else ..() @@ -148,14 +148,14 @@ // Amount cannot be used if drain is made continuous, e.g. amount = 5, charge_weld = 25 // Then it'll drain 125 at first and 25 periodically, but fail if charge dips below 125 even though it still can finish action // Alternately it'll need to drain amount*charge_weld every period, which is either obscene or makes it free for other uses - if(amount ? cell.charge < charge_weld * amount : cell.charge < charge_weld) + if(amount ? cell.charge < PLASMA_CUTTER_CHARGE_WELD * amount : cell.charge < PLASMA_CUTTER_CHARGE_WELD) balloon_alert(user, "not enough charge!") return FALSE return TRUE /obj/item/gun/energy/plasmacutter/use(used) - return (!QDELETED(cell) && cell.use(used ? used * charge_weld : charge_weld)) + return (!QDELETED(cell) && cell.use(used ? used * PLASMA_CUTTER_CHARGE_WELD : PLASMA_CUTTER_CHARGE_WELD)) /obj/item/gun/energy/plasmacutter/use_tool(atom/target, mob/living/user, delay, amount=1, volume=0, datum/callback/extra_checks) @@ -169,6 +169,8 @@ else . = ..(amount=1) +#undef PLASMA_CUTTER_CHARGE_WELD + /obj/item/gun/energy/plasmacutter/adv name = "advanced plasma cutter" icon_state = "adv_plasmacutter" diff --git a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm index eb5646993a7..8ed41815a7a 100644 --- a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm +++ b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm @@ -459,7 +459,7 @@ if(!is_operational || panel_open || !anchored || (machine_stat & (BROKEN | NOPOWER))) return - if(!use_energy(active_power_usage * seconds_per_tick)) + if(!use_energy(active_power_usage * seconds_per_tick, force = FALSE)) return progress_time += seconds_per_tick diff --git a/code/modules/reagents/reagent_containers/misc.dm b/code/modules/reagents/reagent_containers/misc.dm index fa8d8cd3628..f631e8e28a0 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 KILO WATTS * seconds_per_tick) //Basic cell goes for like 200 seconds, bluespace for 8000 + cell.use(0.005 * STANDARD_CELL_RATE * 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 diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index 6b1d24bd35c..ec4bf680fc0 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -1,8 +1,8 @@ /obj/machinery/rnd/production name = "technology fabricator" desc = "Makes researched and prototype items with materials and energy." - // Energy cost per full stack of materials spent. Material insertion is 40% of this. - active_power_usage = 50 * BASE_MACHINE_ACTIVE_CONSUMPTION + /// Energy cost per full stack of materials spent. Material insertion is 40% of this. + active_power_usage = 0.05 * STANDARD_CELL_RATE /// The efficiency coefficient. Material costs and print times are multiplied by this number; var/efficiency_coeff = 1 diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index 995764e0bb7..8152f97e1a4 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -36,11 +36,11 @@ hud_possible = list(DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_TRACK_HUD, DIAG_CAMERA_HUD) mouse_pointer = 'icons/effects/mouse_pointers/mecha_mouse.dmi' ///How much energy the mech will consume each time it moves. this is the current active energy consumed - var/step_energy_drain = 8 KILO JOULES + var/step_energy_drain = 0.008 * STANDARD_CELL_CHARGE ///How much energy we drain each time we mechpunch someone - var/melee_energy_drain = 15 KILO JOULES + var/melee_energy_drain = 0.015 * STANDARD_CELL_CHARGE ///Power we use to have the lights on - var/light_power_drain = 2 KILO WATTS + var/light_power_drain = 0.002 * STANDARD_CELL_RATE ///Modifiers for directional damage reduction var/list/facing_modifiers = list(MECHA_FRONT_ARMOUR = 0.5, MECHA_SIDE_ARMOUR = 1, MECHA_BACK_ARMOUR = 1.5) ///if we cant use our equipment(such as due to EMP) diff --git a/code/modules/vehicles/mecha/equipment/tools/mining_tools.dm b/code/modules/vehicles/mecha/equipment/tools/mining_tools.dm index 25fd2879a6b..8343dc85a54 100644 --- a/code/modules/vehicles/mecha/equipment/tools/mining_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/mining_tools.dm @@ -10,7 +10,7 @@ desc = "Equipment for engineering and combat exosuits. This is the drill that'll pierce the heavens!" icon_state = "mecha_drill" equip_cooldown = 15 - energy_drain = 10 KILO JOULES + energy_drain = 0.01 * STANDARD_CELL_CHARGE force = 15 harmful = TRUE range = MECHA_MELEE diff --git a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm index 067ad2250f0..43f2715dbec 100644 --- a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm @@ -9,7 +9,7 @@ desc = "An exosuit module that allows exosuits to teleport to any position in view." icon_state = "mecha_teleport" equip_cooldown = 150 - energy_drain = 1 MEGA JOULES + energy_drain = STANDARD_CELL_CHARGE range = MECHA_RANGED var/teleport_range = 7 @@ -285,7 +285,7 @@ ///Maximum fuel capacity of the generator, in units var/max_fuel = 75 * SHEET_MATERIAL_AMOUNT ///Energy recharged per second - var/rechargerate = 5 KILO WATTS + var/rechargerate = 0.005 * STANDARD_CELL_RATE /obj/item/mecha_parts/mecha_equipment/generator/Initialize(mapload) . = ..() diff --git a/code/modules/vehicles/mecha/equipment/tools/work_tools.dm b/code/modules/vehicles/mecha/equipment/tools/work_tools.dm index e04a40b05f6..c10df9a139c 100644 --- a/code/modules/vehicles/mecha/equipment/tools/work_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/work_tools.dm @@ -7,7 +7,7 @@ desc = "Equipment for engineering exosuits. Lifts objects and loads them into cargo." icon_state = "mecha_clamp" equip_cooldown = 15 - energy_drain = 10 KILO JOULES + energy_drain = 0.01 * STANDARD_CELL_CHARGE tool_behaviour = TOOL_RETRACTOR range = MECHA_MELEE toolspeed = 0.8 diff --git a/code/modules/vehicles/mecha/mech_bay.dm b/code/modules/vehicles/mecha/mech_bay.dm index 1f468565625..1a6ce31e284 100644 --- a/code/modules/vehicles/mecha/mech_bay.dm +++ b/code/modules/vehicles/mecha/mech_bay.dm @@ -12,7 +12,7 @@ ///Ref to charge console for seeing charge for this port, cyclical reference var/obj/machinery/computer/mech_bay_power_console/recharge_console ///Power unit per second to charge by - var/recharge_power = 25 KILO WATTS + var/recharge_power = 0.025 * STANDARD_CELL_RATE ///turf that will be checked when a mech wants to charge. directly one turf in the direction it is facing var/turf/recharging_turf @@ -46,7 +46,7 @@ var/total_rating = 0 for(var/datum/stock_part/capacitor/capacitor in component_parts) total_rating += capacitor.tier - recharge_power = total_rating * 12.5 KILO WATTS + recharge_power = total_rating * 0.0125 * STANDARD_CELL_RATE /obj/machinery/mech_bay_recharge_port/examine(mob/user) . = ..() @@ -65,7 +65,7 @@ if(!recharging_mech?.cell) return if(recharging_mech.cell.charge < recharging_mech.cell.maxcharge) - if(!use_energy(active_power_usage * seconds_per_tick)) + if(!use_energy(active_power_usage * seconds_per_tick, force = FALSE)) return charge_cell(recharge_power * seconds_per_tick, recharging_mech.cell, grid_only = TRUE) else diff --git a/code/modules/vehicles/motorized_wheelchair.dm b/code/modules/vehicles/motorized_wheelchair.dm index 128530968e2..8dbdfd93e8f 100644 --- a/code/modules/vehicles/motorized_wheelchair.dm +++ b/code/modules/vehicles/motorized_wheelchair.dm @@ -10,7 +10,7 @@ ///Self explanatory, ratio of how much power we use var/power_efficiency = 1 ///How much energy we use - var/energy_usage = 100 KILO JOULES + var/energy_usage = 0.1 * STANDARD_CELL_CHARGE ///whether the panel is open so a user can take out the cell var/panel_open = FALSE ///Parts used in building the wheelchair diff --git a/code/modules/wiremod/shell/gun.dm b/code/modules/wiremod/shell/gun.dm index ff581536713..9f196e6c1fc 100644 --- a/code/modules/wiremod/shell/gun.dm +++ b/code/modules/wiremod/shell/gun.dm @@ -82,6 +82,6 @@ if(!parent?.cell) return var/obj/item/gun/energy/fired_gun = source - var/totransfer = min(100 KILO JOULES, parent.cell.charge) - var/transferred = fired_gun.cell.give(totransfer) - parent.cell.use(transferred) + var/transferred = fired_gun.cell.give(min(0.1 * STANDARD_CELL_CHARGE, parent.cell.charge)) + if(transferred) + parent.cell.use(transferred, force = TRUE)