diff --git a/code/__DEFINES/lights.dm b/code/__DEFINES/lights.dm index e137744195c..b1413a70789 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.2 +#define LIGHT_EMERGENCY_POWER_USE (0.1 KILO WATTS) // status values shared between lighting fixtures and items #define LIGHT_OK 0 #define LIGHT_EMPTY 1 diff --git a/code/game/objects/items/robot/items/hypo.dm b/code/game/objects/items/robot/items/hypo.dm index 552ea514601..da280e9f728 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 + var/charge_cost = 50 KILO JOULES /// 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 + charge_cost = 20 KILO JOULES 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 + charge_cost = 20 KILO JOULES 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 //Costs double the power of the borgshaker due to synthesizing solids + charge_cost = 40 KILO JOULES //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 773458964f7..538fd1b7ca1 100644 --- a/code/game/objects/items/robot/items/tools.dm +++ b/code/game/objects/items/robot/items/tools.dm @@ -1,4 +1,5 @@ #define PKBORG_DAMPEN_CYCLE_DELAY (2 SECONDS) +#define POWER_RECHARGE_CYBORG_DRAIN_MULTIPLIER (0.4 KILO WATTS) /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" @@ -24,8 +25,6 @@ var/energy = 1500 /// Recharging rate in energy per second var/energy_recharge = 37.5 - /// Charge draining right - var/energy_recharge_cyborg_drain_coefficient = 0.4 /// Critical power level percentage var/cyborg_cell_critical_percentage = 0.05 /// The owner of the dampener @@ -156,7 +155,7 @@ energy = clamp(energy + energy_recharge * seconds_per_tick, 0, maxenergy) return if(host.cell && (host.cell.charge >= (host.cell.maxcharge * cyborg_cell_critical_percentage)) && (energy < maxenergy)) - host.cell.use(energy_recharge * seconds_per_tick * energy_recharge_cyborg_drain_coefficient) + host.cell.use(energy_recharge * seconds_per_tick * POWER_RECHARGE_CYBORG_DRAIN_MULTIPLIER) energy += energy_recharge * seconds_per_tick /obj/item/borg/projectile_dampen/proc/dampen_projectile(datum/source, obj/projectile/projectile) @@ -176,3 +175,4 @@ projectile.cut_overlay(projectile_effect) #undef PKBORG_DAMPEN_CYCLE_DELAY +#undef POWER_RECHARGE_CYBORG_DRAIN_MULTIPLIER diff --git a/code/modules/antagonists/nukeop/equipment/borgchameleon.dm b/code/modules/antagonists/nukeop/equipment/borgchameleon.dm index 27909606643..e5a5d2cfb35 100644 --- a/code/modules/antagonists/nukeop/equipment/borgchameleon.dm +++ b/code/modules/antagonists/nukeop/equipment/borgchameleon.dm @@ -1,3 +1,6 @@ +#define ACTIVATION_COST (300 KILO JOULES) +#define ACTIVATION_UP_KEEP (25 KILO WATTS) + /obj/item/borg_chameleon name = "cyborg chameleon projector" icon = 'icons/obj/devices/syndie_gadget.dmi' @@ -11,8 +14,6 @@ var/friendlyName var/savedName var/active = FALSE - var/activationCost = 300 - var/activationUpkeep = 50 var/disguise = "engineer" var/mob/listeningTo var/static/list/signalCache = list( // list here all signals that should break the camouflage @@ -44,13 +45,13 @@ disrupt(user) /obj/item/borg_chameleon/attack_self(mob/living/silicon/robot/user) - if (user && user.cell && user.cell.charge > activationCost) + if (user && user.cell && user.cell.charge > ACTIVATION_COST) if (isturf(user.loc)) toggle(user) else to_chat(user, span_warning("You can't use [src] while inside something!")) else - to_chat(user, span_warning("You need at least [activationCost] charge in your cell to use [src]!")) + to_chat(user, span_warning("You need at least [display_energy(ACTIVATION_COST)] of charge in your cell to use [src]!")) /obj/item/borg_chameleon/proc/toggle(mob/living/silicon/robot/user) if(active) @@ -65,7 +66,7 @@ to_chat(user, span_notice("You activate \the [src].")) playsound(src, 'sound/effects/seedling_chargeup.ogg', 100, TRUE, -6) apply_wibbly_filters(user) - if (do_after(user, 50, target=user) && user.cell.use(activationCost)) + if (do_after(user, 50, target=user) && user.cell.use(ACTIVATION_COST)) playsound(src, 'sound/effects/bamf.ogg', 100, TRUE, -6) to_chat(user, span_notice("You are now disguised as the Nanotrasen engineering borg \"[friendlyName]\".")) activate(user) @@ -75,9 +76,9 @@ remove_wibbly_filters(user) animation_playing = FALSE -/obj/item/borg_chameleon/process() +/obj/item/borg_chameleon/process(seconds_per_tick) if (user) - if (!user.cell || !user.cell.use(activationUpkeep)) + if (!user.cell || !user.cell.use(ACTIVATION_UP_KEEP * seconds_per_tick)) disrupt(user) else return PROCESS_KILL @@ -119,3 +120,6 @@ if(active) to_chat(user, span_danger("Your chameleon field deactivates.")) deactivate(user) + +#undef ACTIVATION_COST +#undef ACTIVATION_UP_KEEP diff --git a/code/modules/explorer_drone/loot.dm b/code/modules/explorer_drone/loot.dm index 3f3d6f6c520..88cd5f38275 100644 --- a/code/modules/explorer_drone/loot.dm +++ b/code/modules/explorer_drone/loot.dm @@ -152,7 +152,6 @@ GLOBAL_LIST_INIT(adventure_loot_generator_index,generate_generator_index()) lefthand_file = 'icons/mob/inhands/items/firelance_lefthand.dmi' var/windup_time = 10 SECONDS var/melt_range = 3 - var/charge_per_use = 200 var/obj/item/stock_parts/cell/cell /obj/item/firelance/Initialize(mapload) @@ -176,7 +175,7 @@ GLOBAL_LIST_INIT(adventure_loot_generator_index,generate_generator_index()) return if(LAZYACCESS(user.do_afters, "firelance")) return - if(!cell.use(charge_per_use)) + if(!cell.use(200 KILO JOULES)) to_chat(user,span_warning("[src] battery ran dry!")) return ADD_TRAIT(user, TRAIT_IMMOBILIZED, REF(src)) diff --git a/code/modules/mod/mod_link.dm b/code/modules/mod/mod_link.dm index 943ad16eb77..fd7a0f415b0 100644 --- a/code/modules/mod/mod_link.dm +++ b/code/modules/mod/mod_link.dm @@ -201,7 +201,7 @@ /obj/item/clothing/neck/link_scryer/process(seconds_per_tick) if(!mod_link.link_call) return - cell.use(min(20 * seconds_per_tick, cell.charge)) + cell.use(20 KILO WATTS * seconds_per_tick, force = TRUE) /obj/item/clothing/neck/link_scryer/attackby(obj/item/attacked_by, mob/user, params) . = ..() diff --git a/code/modules/power/lighting/light.dm b/code/modules/power/lighting/light.dm index e34e792ad1a..49e03dc07bf 100644 --- a/code/modules/power/lighting/light.dm +++ b/code/modules/power/lighting/light.dm @@ -334,11 +334,11 @@ if(cell) if(cell.charge == cell.maxcharge && !reagents) //If the cell is done mooching station power, and reagents don't need processing, stop processing return PROCESS_KILL - cell.charge = min(cell.maxcharge, cell.charge + LIGHT_EMERGENCY_POWER_USE) //Recharge emergency power automatically while not using it + charge_cell(LIGHT_EMERGENCY_POWER_USE * seconds_per_tick, cell = cell) //Recharge emergency power automatically while not using it if(reagents) //with most reagents coming out at 300, and with most meaningful reactions coming at 370+, this rate gives a few seconds of time to place it in and get out of dodge regardless of input. reagents.adjust_thermal_energy(8 * reagents.total_volume * SPECIFIC_HEAT_DEFAULT * seconds_per_tick) reagents.handle_reactions() - if(low_power_mode && !use_emergency_power(LIGHT_EMERGENCY_POWER_USE)) + if(low_power_mode && !use_emergency_power(LIGHT_EMERGENCY_POWER_USE * seconds_per_tick)) update(FALSE) //Disables emergency mode and sets the color to normal /obj/machinery/light/proc/burn_out()