From da75e0e5621969893cc19a0d990f41b287c13ff0 Mon Sep 17 00:00:00 2001 From: HelmCrab <90987989+Thera-Pissed@users.noreply.github.com> Date: Sun, 26 May 2024 23:15:54 -0500 Subject: [PATCH] Idle & Active power rework and defines (#2632) ## About The Pull Request Implements new defines set in power.dm for nearly all machines using idle/active_power_usage Kills auto_use_power() in favor of useStaticPower() procs Standardizes power draws for most things using said defines Decreases power used for lighting by half Generally increases power used by machinery, especially those that are only active for short periods. SSUs now consume power when decontaminating, ORMs and vending machines now take idle power. ![image](https://github.com/shiptest-ss13/Shiptest/assets/90987989/071f8fa8-0639-4fb5-9c3c-5b4b4ad254e4) If you have any feedback, feel free to share it! Most of these numbers are based on their original values, so definitely could be changed. ## Why It's Good For The Game This PR standardizes the draw of most machinery, while making it easier to change power use across the board. Additionally, lighting takes less power, while actual machines have been tweaked to fill this gap. ## Changelog :cl: tweak: SSUs draw power to decontaminate balance: lights no longer take 60% of a ships power, machines use more to account for this. code: added standardized defines for power usage /:cl: --------- Signed-off-by: HelmCrab <90987989+Thera-Pissed@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> --- code/__DEFINES/power.dm | 13 +++++ code/controllers/subsystem/machines.dm | 5 +- code/game/machinery/PDApainter.dm | 2 + code/game/machinery/Sleeper.dm | 7 ++- code/game/machinery/_machinery.dm | 30 +++++++++--- code/game/machinery/airlock_cycle_control.dm | 4 +- code/game/machinery/announcement_system.dm | 4 +- code/game/machinery/autolathe.dm | 11 +++-- code/game/machinery/bank_machine.dm | 2 +- code/game/machinery/buttons.dm | 2 +- code/game/machinery/camera/camera.dm | 4 +- code/game/machinery/cell_charger.dm | 4 +- code/game/machinery/cloning.dm | 2 + code/game/machinery/computer/_computer.dm | 4 +- code/game/machinery/computer/crew.dm | 4 +- code/game/machinery/computer/dna_console.dm | 4 +- code/game/machinery/dance_machine.dm | 2 + code/game/machinery/defibrillator_mount.dm | 2 +- code/game/machinery/dish_drive.dm | 4 +- code/game/machinery/dna_scanner.dm | 4 +- code/game/machinery/doppler_array.dm | 2 + code/game/machinery/droneDispenser.dm | 2 + .../embedded_controller/access_controller.dm | 4 +- code/game/machinery/firealarm.dm | 4 +- code/game/machinery/gulag_item_reclaimer.dm | 4 +- code/game/machinery/gulag_teleporter.dm | 4 +- code/game/machinery/harvester.dm | 4 +- code/game/machinery/hologram.dm | 11 +++-- code/game/machinery/hypnochair.dm | 2 + code/game/machinery/igniter.dm | 4 +- code/game/machinery/launch_pad.dm | 8 ++-- code/game/machinery/limbgrower.dm | 4 +- code/game/machinery/mass_driver.dm | 4 +- code/game/machinery/medical_kiosk.dm | 2 + code/game/machinery/medipen_refiller.dm | 2 +- .../machinery/porta_turret/portable_turret.dm | 6 +-- code/game/machinery/prisonlabor.dm | 4 +- code/game/machinery/quantum_pad.dm | 4 +- code/game/machinery/recharger.dm | 8 ++-- code/game/machinery/rechargestation.dm | 8 ++-- code/game/machinery/recycler.dm | 2 + code/game/machinery/roulette_machine.dm | 4 +- code/game/machinery/scan_gate.dm | 2 +- code/game/machinery/sheetifier.dm | 4 +- code/game/machinery/shieldgen.dm | 4 +- code/game/machinery/shuttle/ship_gravity.dm | 4 +- code/game/machinery/shuttle/shuttle_heater.dm | 2 +- code/game/machinery/slotmachine.dm | 2 +- code/game/machinery/stasis.dm | 8 ++-- code/game/machinery/status_display.dm | 2 +- code/game/machinery/suit_storage_unit.dm | 3 ++ .../telecomms/machines/broadcaster.dm | 2 +- code/game/machinery/telecomms/machines/bus.dm | 2 +- code/game/machinery/telecomms/machines/hub.dm | 2 +- .../telecomms/machines/message_server.dm | 8 ++-- .../machinery/telecomms/machines/processor.dm | 2 +- .../machinery/telecomms/machines/receiver.dm | 2 +- .../machinery/telecomms/machines/relay.dm | 2 +- .../machinery/telecomms/machines/server.dm | 2 +- code/game/machinery/teleporter.dm | 8 ++-- code/game/mecha/mech_fabricator.dm | 8 ++-- code/modules/NTNet/relays.dm | 8 ++-- .../atmospherics/machinery/airalarm.dm | 8 ++-- .../components/binary_devices/pump.dm | 12 +++++ .../components/binary_devices/valve.dm | 3 ++ .../components/binary_devices/volume_pump.dm | 12 +++++ .../components/trinary_devices/filter.dm | 12 +++++ .../components/trinary_devices/mixer.dm | 12 +++++ .../components/unary_devices/thermomachine.dm | 12 ++++- .../components/unary_devices/vent_scrubber.dm | 13 +++-- .../atmospherics/machinery/other/meter.dm | 4 +- .../atmospherics/machinery/other/miner.dm | 4 +- .../machinery/portable/scrubber.dm | 10 ++-- code/modules/awaymissions/gateway.dm | 8 ++-- .../cargo/blackmarket/blackmarket_telepad.dm | 2 +- .../modules/fishing/fishing_portal_machine.dm | 6 +-- .../kitchen_machinery/coffeemaker.dm | 5 +- .../kitchen_machinery/deep_fryer.dm | 2 +- .../kitchen_machinery/gibber.dm | 4 +- .../kitchen_machinery/microwave.dm | 9 ++-- .../kitchen_machinery/monkeyrecycler.dm | 4 +- .../kitchen_machinery/processor.dm | 4 +- .../kitchen_machinery/smartfridge.dm | 12 ++--- code/modules/holodeck/items.dm | 4 +- code/modules/hydroponics/biogenerator.dm | 2 +- code/modules/hydroponics/hydroponics.dm | 13 +++-- code/modules/mining/machine_bluespaceminer.dm | 2 +- code/modules/mining/machine_processing.dm | 1 + .../computers/machinery/modular_console.dm | 4 +- .../overmap/missions/research_mission.dm | 4 +- code/modules/paperwork/photocopier.dm | 4 +- .../plumbing/plumbers/_plumb_machinery.dm | 2 +- code/modules/plumbing/plumbers/pumps.dm | 4 +- code/modules/power/floodlight.dm | 4 +- code/modules/power/gravitygenerator.dm | 7 ++- code/modules/power/lighting.dm | 14 +++--- code/modules/power/monitor.dm | 10 ++-- code/modules/power/power.dm | 48 ++++++++++++++++--- code/modules/power/singularity/emitter.dm | 6 +-- .../particle_accelerator/particle_control.dm | 12 ++--- code/modules/power/solar.dm | 2 +- .../chemistry/machinery/chem_dispenser.dm | 2 +- .../chemistry/machinery/chem_heater.dm | 2 +- .../chemistry/machinery/chem_master.dm | 2 +- .../reagents/chemistry/machinery/pandemic.dm | 4 +- .../chemistry/machinery/reagentgrinder.dm | 13 +++-- code/modules/research/bepis.dm | 8 ++-- .../modules/research/machinery/_production.dm | 10 +++- .../research/nanites/nanite_chamber.dm | 4 +- .../research/nanites/public_chamber.dm | 4 +- .../security_levels/keycard_authentication.dm | 4 +- code/modules/station_goals/dna_vault.dm | 2 +- code/modules/vending/_vending.dm | 2 + 113 files changed, 416 insertions(+), 230 deletions(-) diff --git a/code/__DEFINES/power.dm b/code/__DEFINES/power.dm index a95fec2195522..29d6e72dffa57 100644 --- a/code/__DEFINES/power.dm +++ b/code/__DEFINES/power.dm @@ -12,3 +12,16 @@ #define TESLA_DEFAULT_POWER 1738260 #define TESLA_MINI_POWER 869130 + +#define LIGHT_DRAW 10 // mulitplied by brightness, typically 4-8 + +#define IDLE_DRAW_MINIMAL 50 // 20x = 1kw, used for small things and computers on stand-by +#define IDLE_DRAW_LOW 200 //5x = 1kw, used for always-active computers +#define IDLE_DRAW_MEDIUM 500 //2x = 1kw +#define IDLE_DRAW_HIGH 1000 //1kw + +#define ACTIVE_DRAW_MINIMAL 200 //5x = 1kw +#define ACTIVE_DRAW_LOW 500 //2x = 1kw +#define ACTIVE_DRAW_MEDIUM 1000 //microwaves use this +#define ACTIVE_DRAW_HIGH 2000 +#define ACTIVE_DRAW_EXTREME 5000 //highest this value should be in most cases diff --git a/code/controllers/subsystem/machines.dm b/code/controllers/subsystem/machines.dm index 4440d1c17b331..e8285abafde1c 100644 --- a/code/controllers/subsystem/machines.dm +++ b/code/controllers/subsystem/machines.dm @@ -47,10 +47,7 @@ SUBSYSTEM_DEF(machines) while(currentrun.len) var/obj/machinery/thing = currentrun[currentrun.len] currentrun.len-- - if(!QDELETED(thing) && thing.process(seconds) != PROCESS_KILL) - if(thing.use_power) - thing.auto_use_power() //add back the power state - else + if(QDELETED(thing) || thing.process(seconds) == PROCESS_KILL) processing -= thing if (!QDELETED(thing)) thing.datum_flags &= ~DF_ISPROCESSING diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm index e9906a6a0089a..b423b28ce4d24 100644 --- a/code/game/machinery/PDApainter.dm +++ b/code/game/machinery/PDApainter.dm @@ -5,6 +5,8 @@ icon_state = "pdapainter" base_icon_state = "pdapainter" density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_MINIMAL max_integrity = 200 var/obj/item/pda/storedpda = null var/list/colorlist = list() diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index f0a1c403cfa41..3d4d05336c3c5 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -11,6 +11,8 @@ icon_state = "sleeper" base_icon_state = "sleeper" density = FALSE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW state_open = TRUE circuit = /obj/item/circuitboard/machine/sleeper clicksound = 'sound/machines/pda_button1.ogg' @@ -100,7 +102,7 @@ playsound(src, 'sound/machines/synth_yes.ogg', 50, TRUE, frequency = rand(5120, 8800)) target.apply_status_effect(STATUS_EFFECT_STASIS, STASIS_MACHINE_EFFECT) target.ExtinguishMob() - use_power = ACTIVE_POWER_USE + set_active_power() /obj/machinery/sleeper/proc/thaw_them(mob/living/target) if(IS_IN_STASIS(target)) @@ -109,7 +111,8 @@ /obj/machinery/sleeper/process() if(!occupant || !isliving(occupant)) - use_power = IDLE_POWER_USE + if(use_static_power != IDLE_POWER_USE) + set_idle_power() return var/mob/living/L_occupant = occupant if(stasis_running()) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index a17b9c705dc18..4cddf93b24789 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -21,7 +21,7 @@ Class Variables: power_channel (num) What channel to draw from when drawing power for power mode Possible Values: - AREA_USAGE_EQUIP:0 -- Equipment Channel + AREA_USAGE_EQUIP:1 -- Equipment Channel AREA_USAGE_LIGHT:2 -- Lighting Channel AREA_USAGE_ENVIRON:3 -- Environment Channel @@ -44,7 +44,7 @@ Class Procs: auto_use_power() 'game/machinery/machine.dm' This proc determines how power mode power is deducted by the machine. 'auto_use_power()' is called by the 'master_controller' game_controller every - tick. + tick. (not anymore) Return Value: return:1 -- if object is powered @@ -102,6 +102,7 @@ Class Procs: //0 = dont run the auto //1 = run auto, use idle //2 = run auto, use active + var/use_static_power = NO_POWER_USE var/idle_power_usage = 0 var/active_power_usage = 0 var/power_channel = AREA_USAGE_EQUIP @@ -151,7 +152,11 @@ Class Procs: if(occupant_typecache) occupant_typecache = typecacheof(occupant_typecache) - + switch(use_power) + if(IDLE_POWER_USE) + set_idle_power() + if(ACTIVE_POWER_USE) + set_active_power() return INITIALIZE_HINT_LATELOAD /// Helper proc for telling a machine to start processing with the subsystem type that is located in its `subsystem_type` var. @@ -168,7 +173,16 @@ Class Procs: . = ..() power_change() become_area_sensitive(ROUNDSTART_TRAIT) - RegisterSignal(src, COMSIG_ENTER_AREA, PROC_REF(power_change)) + RegisterSignal(src, COMSIG_ENTER_AREA, PROC_REF(enter_area)) + RegisterSignal(src, COMSIG_EXIT_AREA, PROC_REF(exit_area)) + +/obj/machinery/proc/enter_area(datum/source, area/A) + SIGNAL_HANDLER + power_change(A) + +/obj/machinery/proc/exit_area(datum/source, area/A) + SIGNAL_HANDLER + set_no_power(A) /obj/machinery/Destroy() GLOB.machines.Remove(src) @@ -177,6 +191,7 @@ Class Procs: lose_area_sensitivity(ROUNDSTART_TRAIT) QDEL_NULL(circuit) QDEL_LIST(component_parts) + set_no_power() return ..() /obj/machinery/proc/locate_machinery() @@ -273,8 +288,8 @@ Class Procs: target.forceMove(src) updateUsrDialog() update_appearance() - -/obj/machinery/proc/auto_use_power() +/* +/obj/machinery/proc/auto_use_power() //obsolete, tick controller doesn't call this anymore because machines use addStaticPower now. if(!powered(power_channel)) return 0 if(use_power == 1) @@ -282,7 +297,7 @@ Class Procs: else if(use_power >= 2) use_power(active_power_usage,power_channel) return 1 - +*/ ///Called when we want to change the value of the `is_operational` variable. Boolean. /obj/machinery/proc/set_is_operational(new_value) @@ -618,6 +633,7 @@ Class Procs: //called on deconstruction before the final deletion /obj/machinery/proc/on_deconstruction() + set_no_power() return /obj/machinery/proc/can_be_overridden() diff --git a/code/game/machinery/airlock_cycle_control.dm b/code/game/machinery/airlock_cycle_control.dm index 76094e803cd3f..7ba391fae782e 100644 --- a/code/game/machinery/airlock_cycle_control.dm +++ b/code/game/machinery/airlock_cycle_control.dm @@ -67,8 +67,8 @@ icon = 'icons/obj/monitors.dmi' icon_state = "aac" use_power = IDLE_POWER_USE - idle_power_usage = 4 - active_power_usage = 8 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL power_channel = AREA_USAGE_ENVIRON req_access = list(ACCESS_ATMOSPHERICS) max_integrity = 250 diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm index f275d234fca78..d4057603957d7 100644 --- a/code/game/machinery/announcement_system.dm +++ b/code/game/machinery/announcement_system.dm @@ -12,8 +12,8 @@ GLOBAL_LIST_EMPTY(announcement_systems) verb_ask = "queries" verb_exclaim = "alarms" - idle_power_usage = 20 - active_power_usage = 50 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = IDLE_DRAW_LOW circuit = /obj/item/circuitboard/machine/announcement_system diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index d83831f2c634b..5e61d276b2268 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -9,8 +9,9 @@ icon_state = "autolathe" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_HIGH + power_channel = AREA_USAGE_EQUIP circuit = /obj/item/circuitboard/machine/autolathe layer = BELOW_OBJ_LAYER @@ -223,7 +224,7 @@ for(var/MAT in being_built.materials) total_amount += being_built.materials[MAT] - var/power = max(active_power_usage, (total_amount)*multiplier/5) //Change this to use all materials + var/power = max(active_power_usage, total_amount) //Change this to use all materials var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) @@ -252,6 +253,7 @@ use_power(power) icon_state = "autolathe_n" var/time = is_stack ? 32 : (32 * coeff * multiplier) ** 0.8 + set_active_power() addtimer(CALLBACK(src, PROC_REF(make_item), power, materials_used, custom_materials, multiplier, coeff, is_stack, usr), time) . = TRUE else @@ -326,12 +328,13 @@ else flick("autolathe_o", src) //plays metal insertion animation - use_power(min(1000, amount_inserted / 100)) + use_power(min(active_power_usage, amount_inserted)) /obj/machinery/autolathe/proc/make_item(power, list/materials_used, list/picked_materials, multiplier, coeff, is_stack, mob/user) var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/atom/A = drop_location() use_power(power) + set_idle_power() materials.use_materials(materials_used) diff --git a/code/game/machinery/bank_machine.dm b/code/game/machinery/bank_machine.dm index 2e93cd179ed54..83f3e366e8a3b 100644 --- a/code/game/machinery/bank_machine.dm +++ b/code/game/machinery/bank_machine.dm @@ -3,7 +3,7 @@ desc = "A machine used to deposit and withdraw funds." icon_screen = "vault" icon_keyboard = "security_key" - idle_power_usage = 100 + idle_power_usage = IDLE_DRAW_LOW var/siphoning = FALSE var/next_warning = 0 diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index 1a89a2b011ccc..b10dba436e0dc 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -12,7 +12,7 @@ var/initialized_button = 0 armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 50, "bomb" = 10, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 70) use_power = IDLE_POWER_USE - idle_power_usage = 2 + idle_power_usage = IDLE_DRAW_MINIMAL resistance_flags = LAVA_PROOF | FIRE_PROOF /obj/machinery/button/indestructible diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index c1cca432efd46..fda41eab77891 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -9,8 +9,8 @@ icon_state = "camera" //mapping icon to represent upgrade states. if you want a different base icon, update default_camera_icon as well as this. light_color = "#CDDDFF" use_power = ACTIVE_POWER_USE - idle_power_usage = 5 - active_power_usage = 10 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = IDLE_DRAW_MINIMAL*2 layer = WALL_OBJ_LAYER resistance_flags = FIRE_PROOF damage_deflection = 12 diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index e1be8d8e4453b..85d2d56512036 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -4,8 +4,8 @@ icon = 'icons/obj/power.dmi' icon_state = "ccharger" use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 60 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_LOW power_channel = AREA_USAGE_EQUIP circuit = /obj/item/circuitboard/machine/cell_charger pass_flags = PASSTABLE diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index c71e94a0948a5..ad4cd3834f065 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -16,6 +16,8 @@ density = TRUE icon = 'icons/obj/machines/cloning.dmi' icon_state = "pod_0" + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW req_access = list(ACCESS_CLONING) //FOR PREMATURE UNLOCKING. verb_say = "states" circuit = /obj/item/circuitboard/machine/clonepod diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm index bdbadf79a9437..3a36603c50709 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -4,8 +4,8 @@ icon_state = "computer" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 300 - active_power_usage = 300 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_LOW max_integrity = 200 integrity_failure = 0.5 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 40, "acid" = 20) diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm index f875defd60443..c1a1171e57cc8 100644 --- a/code/game/machinery/computer/crew.dm +++ b/code/game/machinery/computer/crew.dm @@ -6,8 +6,8 @@ icon_screen = "crew" icon_keyboard = "med_key" use_power = IDLE_POWER_USE - idle_power_usage = 250 - active_power_usage = 500 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_MEDIUM circuit = /obj/item/circuitboard/computer/crew light_color = LIGHT_COLOR_BLUE diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm index ffeabbdc4e0a7..815e2496d41b5 100644 --- a/code/game/machinery/computer/dna_console.dm +++ b/code/game/machinery/computer/dna_console.dm @@ -43,8 +43,8 @@ circuit = /obj/item/circuitboard/computer/scan_consolenew use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 400 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_MEDIUM light_color = LIGHT_COLOR_BLUE /// Link to the techweb's stored research. Used to retrieve stored mutations diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index 20c3d66e85852..8419ee80ce1ea 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -5,6 +5,8 @@ icon_state = "jukebox-" verb_say = "states" density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_MINIMAL var/active = FALSE var/list/rangers = list() var/stop = 0 diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm index f3fa616032d33..645e8eee762ff 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -165,7 +165,7 @@ name = "PENLITE defibrillator mount" desc = "Holds defibrillators. You can grab the paddles if one is mounted. This PENLITE variant also allows for slow, passive recharging of the defibrillator." icon_state = "penlite_mount" - idle_power_usage = 1 + idle_power_usage = 0 wallframe_type = /obj/item/wallframe/defib_mount/charging diff --git a/code/game/machinery/dish_drive.dm b/code/game/machinery/dish_drive.dm index baf3d6ae2cc11..740ea5c935fa4 100644 --- a/code/game/machinery/dish_drive.dm +++ b/code/game/machinery/dish_drive.dm @@ -5,8 +5,8 @@ Or you can just drop your plates on the floor, like civilized folk." icon = 'icons/obj/kitchen.dmi' icon_state = "synthesizer" - idle_power_usage = 8 //5 with default parts - active_power_usage = 13 //10 with default parts + idle_power_usage = IDLE_DRAW_MINIMAL //lower + active_power_usage = ACTIVE_DRAW_MINIMAL //lower ingame because stockparts density = FALSE circuit = /obj/item/circuitboard/machine/dish_drive pass_flags = PASSTABLE diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index 7f61dde6ef798..a45aaa4744383 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -6,8 +6,8 @@ base_icon_state = "scanner" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 50 - active_power_usage = 300 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM occupant_typecache = list(/mob/living, /obj/item/bodypart/head, /obj/item/organ/brain) circuit = /obj/item/circuitboard/machine/dnascanner var/locked = FALSE diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index aa3e4ece65e92..25da902ea3f5b 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -6,6 +6,8 @@ icon = 'icons/obj/machines/research.dmi' base_icon_state = "tdoppler" density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW verb_say = "states coldly" var/cooldown = 10 var/next_announce = 0 diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm index dbf055d98079b..4603044ab285f 100644 --- a/code/game/machinery/droneDispenser.dm +++ b/code/game/machinery/droneDispenser.dm @@ -9,6 +9,8 @@ icon = 'icons/obj/machines/droneDispenser.dmi' icon_state = "on" density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW max_integrity = 250 integrity_failure = 0.33 diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm index 9d190b2e1369a..34d4bb320c46e 100644 --- a/code/game/machinery/embedded_controller/access_controller.dm +++ b/code/game/machinery/embedded_controller/access_controller.dm @@ -7,8 +7,8 @@ /obj/machinery/doorButtons power_channel = AREA_USAGE_ENVIRON use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 4 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF var/idSelf diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index faceb46419d53..6cbd6eaed2781 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -23,8 +23,8 @@ integrity_failure = 0.4 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 30) use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 6 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL power_channel = AREA_USAGE_ENVIRON resistance_flags = FIRE_PROOF diff --git a/code/game/machinery/gulag_item_reclaimer.dm b/code/game/machinery/gulag_item_reclaimer.dm index 8833a20d90c47..81c422ea31fa8 100644 --- a/code/game/machinery/gulag_item_reclaimer.dm +++ b/code/game/machinery/gulag_item_reclaimer.dm @@ -6,8 +6,8 @@ req_access = list(ACCESS_SECURITY) //REQACCESS TO ACCESS ALL STORED ITEMS density = FALSE use_power = IDLE_POWER_USE - idle_power_usage = 100 - active_power_usage = 2500 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = IDLE_DRAW_MEDIUM var/list/stored_items = list() var/obj/machinery/gulag_teleporter/linked_teleporter = null diff --git a/code/game/machinery/gulag_teleporter.dm b/code/game/machinery/gulag_teleporter.dm index e147e24717cab..3632c204f36b4 100644 --- a/code/game/machinery/gulag_teleporter.dm +++ b/code/game/machinery/gulag_teleporter.dm @@ -15,8 +15,8 @@ The console is located at computer/gulag_teleporter.dm state_open = FALSE density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 200 - active_power_usage = 5000 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_EXTREME circuit = /obj/item/circuitboard/machine/gulag_teleporter var/locked = FALSE var/message_cooldown diff --git a/code/game/machinery/harvester.dm b/code/game/machinery/harvester.dm index 9cf4470cab5c9..1b0093458e49a 100644 --- a/code/game/machinery/harvester.dm +++ b/code/game/machinery/harvester.dm @@ -2,12 +2,14 @@ name = "organ harvester" desc = "An advanced machine used for harvesting organs and limbs from the deceased." density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW icon = 'icons/obj/machines/harvester.dmi' icon_state = "harvester" base_icon_state = "harvester" verb_say = "states" state_open = FALSE - idle_power_usage = 50 + idle_power_usage = IDLE_DRAW_MINIMAL circuit = /obj/item/circuitboard/machine/harvester light_color = LIGHT_COLOR_BLUE var/interval = 20 diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 4a31d650f9a1b..9b2591bd59cdb 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -36,8 +36,8 @@ Possible to do for anyone motivated enough: plane = FLOOR_PLANE req_access = list(ACCESS_KEYCARD_AUTH) //Used to allow for forced connecting to other (not secure) holopads. Anyone can make a call, though. use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM max_integrity = 300 armor = list("melee" = 50, "bullet" = 20, "laser" = 20, "energy" = 20, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 0) circuit = /obj/item/circuitboard/machine/holopad @@ -446,8 +446,11 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ /obj/machinery/holopad/proc/SetLightsAndPower() var/total_users = LAZYLEN(masters) + LAZYLEN(holo_calls) - use_power = total_users > 0 ? ACTIVE_POWER_USE : IDLE_POWER_USE - active_power_usage = HOLOPAD_PASSIVE_POWER_USAGE + (HOLOGRAM_POWER_USAGE * total_users) + if(total_users > 0) + set_active_power() + else + set_idle_power() + active_power_usage = initial(active_power_usage) * total_users if(total_users || replay_mode) set_light(2) else diff --git a/code/game/machinery/hypnochair.dm b/code/game/machinery/hypnochair.dm index b31dd99253751..e14756815bb25 100644 --- a/code/game/machinery/hypnochair.dm +++ b/code/game/machinery/hypnochair.dm @@ -6,6 +6,8 @@ base_icon_state = "hypnochair" circuit = /obj/item/circuitboard/machine/hypnochair density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW opacity = FALSE var/mob/living/carbon/victim = null ///Keeps track of the victim to apply effects if it teleports away diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 8117ad2c251a7..c82d67a9df620 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -6,8 +6,8 @@ base_icon_state = "igniter" plane = FLOOR_PLANE use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 4 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_LOW max_integrity = 300 armor = list("melee" = 50, "bullet" = 30, "laser" = 70, "energy" = 50, "bomb" = 20, "bio" = 0, "rad" = 0, "fire" = 100, "acid" = 70) resistance_flags = FIRE_PROOF diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index c7752a8cbfaa1..c3e6bead671a9 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -3,9 +3,9 @@ desc = "A bluespace pad able to thrust matter through bluespace, teleporting it to or from nearby locations." icon = 'icons/obj/telescience.dmi' icon_state = "lpad-idle" - use_power = TRUE - idle_power_usage = 200 - active_power_usage = 2500 + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_EXTREME hud_possible = list(DIAG_LAUNCHPAD_HUD) circuit = /obj/item/circuitboard/machine/launchpad var/icon_teleport = "lpad-beam" @@ -149,7 +149,7 @@ teleporting = FALSE // use a lot of power - use_power(1000) + use_power(active_power_usage) var/turf/source = target var/list/log_msg = list() diff --git a/code/game/machinery/limbgrower.dm b/code/game/machinery/limbgrower.dm index 40f405ad4a166..c0f296c1ffcfe 100644 --- a/code/game/machinery/limbgrower.dm +++ b/code/game/machinery/limbgrower.dm @@ -7,8 +7,8 @@ icon_state = "limbgrower_idleoff" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_LOW circuit = /obj/item/circuitboard/machine/limbgrower /// The category of limbs we're browing in our UI. diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm index 4f91bea3ab7a2..7316e5b424220 100644 --- a/code/game/machinery/mass_driver.dm +++ b/code/game/machinery/mass_driver.dm @@ -4,8 +4,8 @@ icon = 'icons/obj/stationobjs.dmi' icon_state = "mass_driver" use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 50 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM var/power = 1 var/code = 1 var/id = 1 diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index d7be7fea98eef..52933a5aba743 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -18,6 +18,8 @@ base_icon_state = "kiosk" layer = ABOVE_MOB_LAYER density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW circuit = /obj/item/circuitboard/machine/medical_kiosk var/obj/item/scanner_wand /// Emag mode diff --git a/code/game/machinery/medipen_refiller.dm b/code/game/machinery/medipen_refiller.dm index e104257b54932..ceb0ed389c170 100644 --- a/code/game/machinery/medipen_refiller.dm +++ b/code/game/machinery/medipen_refiller.dm @@ -5,7 +5,7 @@ icon_state = "medipen_refiller" density = TRUE circuit = /obj/item/circuitboard/machine/medipen_refiller - idle_power_usage = 100 + idle_power_usage = IDLE_DRAW_LOW /// list of medipen subtypes it can refill var/list/allowed = list( /obj/item/reagent_containers/hypospray/medipen = /datum/reagent/medicine/epinephrine, diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 75498600b007a..5891898ef6dc6 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -33,8 +33,8 @@ DEFINE_BITFIELD(turret_flags, list( density = TRUE desc = "A covered turret that shoots at its enemies." use_power = IDLE_POWER_USE //this turret uses and requires power - idle_power_usage = 50 //when inactive, this turret takes up constant 50 Equipment power - active_power_usage = 300 //when active, this turret takes up constant 300 Equipment power + idle_power_usage = IDLE_DRAW_MINIMAL //when inactive, this turret takes up constant 50 Equipment power + active_power_usage = ACTIVE_DRAW_LOW //when active, this turret takes up constant 300 Equipment power req_access = list(ACCESS_SECURITY) /// Only people with Security access power_channel = AREA_USAGE_EQUIP //drains power from the EQUIPMENT channel max_integrity = 160 //the turret's health @@ -795,7 +795,7 @@ DEFINE_BITFIELD(turret_flags, list( max_integrity = 300 always_up = 1 use_power = ACTIVE_POWER_USE - active_power_usage = 300 + active_power_usage = ACTIVE_DRAW_MINIMAL has_cover = 0 scan_range = 9 stun_projectile = /obj/projectile/beam/disabler diff --git a/code/game/machinery/prisonlabor.dm b/code/game/machinery/prisonlabor.dm index 6fe329ed4a710..76612018d87a6 100644 --- a/code/game/machinery/prisonlabor.dm +++ b/code/game/machinery/prisonlabor.dm @@ -4,8 +4,8 @@ icon = 'icons/obj/machines/prison.dmi' icon_state = "offline" use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 50 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_LOW var/obj/item/stack/license_plates/empty/current_plate var/pressing = FALSE diff --git a/code/game/machinery/quantum_pad.dm b/code/game/machinery/quantum_pad.dm index cc9f8f6d3d599..7d0455ab82f07 100644 --- a/code/game/machinery/quantum_pad.dm +++ b/code/game/machinery/quantum_pad.dm @@ -4,8 +4,8 @@ icon = 'icons/obj/telescience.dmi' icon_state = "qpad-idle" use_power = IDLE_POWER_USE - idle_power_usage = 200 - active_power_usage = 5000 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_EXTREME obj_flags = CAN_BE_HIT | UNIQUE_RENAME circuit = /obj/item/circuitboard/machine/quantumpad var/teleport_cooldown = 400 //30 seconds base due to base parts diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index c604b3eeccf68..2720443d24240 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -5,8 +5,8 @@ base_icon_state = "recharger" desc = "A charging dock for energy based weaponry." use_power = IDLE_POWER_USE - idle_power_usage = 4 - active_power_usage = 250 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_LOW circuit = /obj/item/circuitboard/machine/recharger pass_flags = PASSTABLE var/obj/item/charging = null @@ -50,11 +50,11 @@ if (new_charging) START_PROCESSING(SSmachines, src) finished_recharging = FALSE - use_power = ACTIVE_POWER_USE + set_active_power() using_power = TRUE update_appearance() else - use_power = IDLE_POWER_USE + set_idle_power() using_power = FALSE update_appearance() diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 14e2532980705..cedf6c0a56ff0 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -5,8 +5,8 @@ icon_state = "borgcharger0" density = FALSE use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 1000 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM req_access = list(ACCESS_ROBOTICS) state_open = TRUE circuit = /obj/item/circuitboard/machine/cyborgrecharger @@ -90,12 +90,12 @@ /obj/machinery/recharge_station/open_machine() . = ..() - use_power = IDLE_POWER_USE + set_idle_power() /obj/machinery/recharge_station/close_machine() . = ..() if(occupant) - use_power = ACTIVE_POWER_USE //It always tries to charge, even if it can't. + set_active_power() //It always tries to charge, even if it can't. add_fingerprint(occupant) /obj/machinery/recharge_station/update_icon_state() diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index b548ecf731253..af0c08162311a 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -7,6 +7,8 @@ icon_state = "grinder-o0" layer = ABOVE_ALL_MOB_LAYER // Overhead density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW circuit = /obj/item/circuitboard/machine/recycler var/safety_mode = FALSE // Temporarily stops machine if it detects a mob var/icon_name = "grinder-o" diff --git a/code/game/machinery/roulette_machine.dm b/code/game/machinery/roulette_machine.dm index c9e1d108c1e5c..351f1c42ae5e8 100644 --- a/code/game/machinery/roulette_machine.dm +++ b/code/game/machinery/roulette_machine.dm @@ -26,8 +26,8 @@ density = TRUE use_power = IDLE_POWER_USE anchored = FALSE - idle_power_usage = 10 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL max_integrity = 500 armor = list("melee" = 45, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 10, "bio" = 30, "rad" = 30, "fire" = 30, "acid" = 30) var/static/list/numbers = list("0" = "green", "1" = "red", "3" = "red", "5" = "red", "7" = "red", "9" = "red", "12" = "red", "14" = "red", "16" = "red",\ diff --git a/code/game/machinery/scan_gate.dm b/code/game/machinery/scan_gate.dm index 1ffb032001832..cf83233598aa7 100644 --- a/code/game/machinery/scan_gate.dm +++ b/code/game/machinery/scan_gate.dm @@ -27,7 +27,7 @@ icon = 'icons/obj/machines/scangate.dmi' icon_state = "scangate" use_power = IDLE_POWER_USE - idle_power_usage = 50 + idle_power_usage = IDLE_DRAW_LOW circuit = /obj/item/circuitboard/machine/scanner_gate var/scanline_timer diff --git a/code/game/machinery/sheetifier.dm b/code/game/machinery/sheetifier.dm index 569bfa4b6f9ec..ec9f0f5ff5a35 100644 --- a/code/game/machinery/sheetifier.dm +++ b/code/game/machinery/sheetifier.dm @@ -5,8 +5,8 @@ icon_state = "base_machine" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_LOW circuit = /obj/item/circuitboard/machine/sheetifier layer = BELOW_OBJ_LAYER var/busy_processing = FALSE diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index bc578a856300c..9f2f56e2e1cee 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -219,8 +219,8 @@ req_access = list(ACCESS_TELEPORTER) flags_1 = CONDUCT_1 use_power = NO_POWER_USE - idle_power_usage = 10 - active_power_usage = 50 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_HIGH circuit = /obj/item/circuitboard/machine/shieldwallgen max_integrity = 300 var/active = FALSE diff --git a/code/game/machinery/shuttle/ship_gravity.dm b/code/game/machinery/shuttle/ship_gravity.dm index bfcf937f341a0..4f63c60d78248 100644 --- a/code/game/machinery/shuttle/ship_gravity.dm +++ b/code/game/machinery/shuttle/ship_gravity.dm @@ -9,8 +9,8 @@ icon_state = "shipgrav" base_icon_state = "shipgrav" density = TRUE - idle_power_usage = 10 - active_power_usage = 5000 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_EXTREME circuit = /obj/item/circuitboard/machine/ship_gravity var/charging = FALSE var/active = FALSE diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm index 94735ba4ab251..8f5fd9cbad34b 100644 --- a/code/game/machinery/shuttle/shuttle_heater.dm +++ b/code/game/machinery/shuttle/shuttle_heater.dm @@ -16,7 +16,7 @@ icon_state = "heater_pipe" var/icon_state_closed = "heater_pipe" var/icon_state_open = "heater_pipe_open" - idle_power_usage = 50 + idle_power_usage = IDLE_DRAW_MINIMAL circuit = /obj/item/circuitboard/machine/shuttle/heater density = TRUE diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index 0ae88638d5b3d..2038612c27912 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -22,7 +22,7 @@ base_icon_state = "slots" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 50 + idle_power_usage = IDLE_DRAW_MINIMAL circuit = /obj/item/circuitboard/computer/slot_machine light_color = LIGHT_COLOR_BROWN unique_icon = TRUE diff --git a/code/game/machinery/stasis.dm b/code/game/machinery/stasis.dm index 37e079715dcd4..2582c57da9038 100644 --- a/code/game/machinery/stasis.dm +++ b/code/game/machinery/stasis.dm @@ -9,8 +9,8 @@ can_buckle = TRUE buckle_lying = 90 circuit = /obj/item/circuitboard/machine/stasis - idle_power_usage = 40 - active_power_usage = 340 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_HIGH var/stasis_enabled = TRUE var/last_stasis_sound = FALSE var/stasis_can_toggle = 0 @@ -112,12 +112,12 @@ playsound(src, 'sound/effects/spray.ogg', 5, TRUE, 2, frequency = freq) target.apply_status_effect(STATUS_EFFECT_STASIS, STASIS_MACHINE_EFFECT) target.ExtinguishMob() - use_power = ACTIVE_POWER_USE + set_active_power() /obj/machinery/stasis/proc/thaw_them(mob/living/target) target.remove_status_effect(STATUS_EFFECT_STASIS, STASIS_MACHINE_EFFECT) if(target == occupant) - use_power = IDLE_POWER_USE + set_idle_power() /obj/machinery/stasis/post_buckle_mob(mob/living/L) if(!can_be_occupant(L)) diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 1e402ee02e5a9..9e1b5b28690bc 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -22,7 +22,7 @@ icon_state = "frame" density = FALSE use_power = IDLE_POWER_USE - idle_power_usage = 10 + idle_power_usage = IDLE_DRAW_MINIMAL maptext_height = 26 maptext_width = 32 diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index e86d4ae9f0f9d..960df9263c817 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -6,6 +6,8 @@ icon_state = "ssu_classic" base_icon_state = "ssu_classic" density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_MINIMAL max_integrity = 250 var/obj/item/clothing/suit/space/suit = null @@ -403,6 +405,7 @@ uv = TRUE locked = TRUE update_appearance() + use_power(ACTIVE_DRAW_HIGH) if(occupant) if(uv_super) mob_occupant.adjustFireLoss(rand(20, 36)) diff --git a/code/game/machinery/telecomms/machines/broadcaster.dm b/code/game/machinery/telecomms/machines/broadcaster.dm index f9cbc692e0503..2a12e6bcf937c 100644 --- a/code/game/machinery/telecomms/machines/broadcaster.dm +++ b/code/game/machinery/telecomms/machines/broadcaster.dm @@ -14,7 +14,7 @@ GLOBAL_VAR_INIT(message_delay, 0) // To make sure restarting the recentmessages desc = "A dish-shaped machine used to broadcast processed subspace signals." density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 25 + idle_power_usage = IDLE_DRAW_MINIMAL circuit = /obj/item/circuitboard/machine/telecomms/broadcaster /obj/machinery/telecomms/broadcaster/receive_information(datum/signal/subspace/signal, obj/machinery/telecomms/machine_from) diff --git a/code/game/machinery/telecomms/machines/bus.dm b/code/game/machinery/telecomms/machines/bus.dm index 2496ee41c874f..6428456d1614c 100644 --- a/code/game/machinery/telecomms/machines/bus.dm +++ b/code/game/machinery/telecomms/machines/bus.dm @@ -14,7 +14,7 @@ desc = "A mighty piece of hardware used to send massive amounts of data quickly." density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 50 + idle_power_usage = IDLE_DRAW_MINIMAL netspeed = 40 circuit = /obj/item/circuitboard/machine/telecomms/bus var/change_frequency = 0 diff --git a/code/game/machinery/telecomms/machines/hub.dm b/code/game/machinery/telecomms/machines/hub.dm index dedf7c7f3a773..a01225b4f4fd6 100644 --- a/code/game/machinery/telecomms/machines/hub.dm +++ b/code/game/machinery/telecomms/machines/hub.dm @@ -14,7 +14,7 @@ desc = "A mighty piece of hardware used to send/receive massive amounts of data." density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 80 + idle_power_usage = IDLE_DRAW_MINIMAL long_range_link = TRUE netspeed = 40 circuit = /obj/item/circuitboard/machine/telecomms/hub diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm index d11067c290fd1..d9f927a7c355d 100644 --- a/code/game/machinery/telecomms/machines/message_server.dm +++ b/code/game/machinery/telecomms/machines/message_server.dm @@ -12,8 +12,8 @@ name = "Blackbox Recorder" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL armor = list("melee" = 25, "bullet" = 10, "laser" = 10, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 70) var/obj/item/stored @@ -80,8 +80,8 @@ desc = "A machine that processes and routes PDA and request console messages." density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL circuit = /obj/item/circuitboard/machine/telecomms/message_server var/list/datum/data_pda_msg/pda_msgs = list() diff --git a/code/game/machinery/telecomms/machines/processor.dm b/code/game/machinery/telecomms/machines/processor.dm index 86bc02438d95c..6c13ee65d5107 100644 --- a/code/game/machinery/telecomms/machines/processor.dm +++ b/code/game/machinery/telecomms/machines/processor.dm @@ -12,7 +12,7 @@ desc = "This machine is used to process large quantities of information." density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 30 + idle_power_usage = IDLE_DRAW_MINIMAL circuit = /obj/item/circuitboard/machine/telecomms/processor var/process_mode = 1 // 1 = Uncompress Signals, 0 = Compress Signals diff --git a/code/game/machinery/telecomms/machines/receiver.dm b/code/game/machinery/telecomms/machines/receiver.dm index 79b989648d556..33b0bc7028ece 100644 --- a/code/game/machinery/telecomms/machines/receiver.dm +++ b/code/game/machinery/telecomms/machines/receiver.dm @@ -12,7 +12,7 @@ desc = "This machine has a dish-like shape and green lights. It is designed to detect and process subspace radio activity." density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 30 + idle_power_usage = IDLE_DRAW_MINIMAL circuit = /obj/item/circuitboard/machine/telecomms/receiver /obj/machinery/telecomms/receiver/receive_signal(datum/signal/subspace/signal) diff --git a/code/game/machinery/telecomms/machines/relay.dm b/code/game/machinery/telecomms/machines/relay.dm index ffaeda72e26d1..763c42dbbf9c4 100644 --- a/code/game/machinery/telecomms/machines/relay.dm +++ b/code/game/machinery/telecomms/machines/relay.dm @@ -12,7 +12,7 @@ desc = "A mighty piece of hardware used to send massive amounts of data far away." density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 30 + idle_power_usage = IDLE_DRAW_MINIMAL netspeed = 5 long_range_link = 1 circuit = /obj/item/circuitboard/machine/telecomms/relay diff --git a/code/game/machinery/telecomms/machines/server.dm b/code/game/machinery/telecomms/machines/server.dm index 664d45b5b1c17..5607b6bbec8c1 100644 --- a/code/game/machinery/telecomms/machines/server.dm +++ b/code/game/machinery/telecomms/machines/server.dm @@ -11,7 +11,7 @@ desc = "A machine used to store data and network statistics." density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 15 + idle_power_usage = IDLE_DRAW_MINIMAL circuit = /obj/item/circuitboard/machine/telecomms/server var/list/log_entries = list() var/totaltraffic = 0 // gigabytes (if > 1024, divide by 1024 -> terrabytes) diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index 6e0551b25d417..1a342f0554cd4 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -9,8 +9,8 @@ icon_state = "tele0" base_icon_state = "tele" use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 2000 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_HIGH circuit = /obj/item/circuitboard/machine/teleporter_hub var/accuracy = 0 var/obj/machinery/teleport/station/power_station @@ -106,8 +106,8 @@ icon_state = "controller" base_icon_state = "controller" use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 2000 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_HIGH circuit = /obj/item/circuitboard/machine/teleporter_station var/engaged = FALSE var/obj/machinery/computer/teleporter/teleporter_console diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 6814f0cc2e7f8..83a2c4861c907 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -5,8 +5,8 @@ desc = "Nothing is being built." density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 20 - active_power_usage = 5000 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_HIGH req_access = list(ACCESS_ROBOTICS) circuit = /obj/item/circuitboard/machine/mechfab var/time_coeff = 1 @@ -196,10 +196,10 @@ rmat.silo_log(src, "built", -1, "[D.name]", res_coef) add_overlay("fab-active") - use_power = ACTIVE_POWER_USE + set_active_power() updateUsrDialog() sleep(get_construction_time_w_coeff(D)) - use_power = IDLE_POWER_USE + set_idle_power() cut_overlay("fab-active") desc = initial(desc) diff --git a/code/modules/NTNet/relays.dm b/code/modules/NTNet/relays.dm index 9a1b01403eda3..f161eced8060d 100644 --- a/code/modules/NTNet/relays.dm +++ b/code/modules/NTNet/relays.dm @@ -3,8 +3,8 @@ name = "NTNet Quantum Relay" desc = "A very complex router and transmitter capable of connecting electronic devices together. Looks fragile." use_power = ACTIVE_POWER_USE - active_power_usage = 10000 //10kW, apropriate for machine that keeps massive cross-Zlevel wireless network operational. Used to be 20 but that actually drained the smes one round - idle_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_EXTREME //Since NTnet is barely used, this has been lowered by half. icon = 'icons/obj/machines/telecomms.dmi' icon_state = "bus" density = TRUE @@ -64,9 +64,9 @@ /obj/machinery/ntnet_relay/process() if(is_operational) - use_power = ACTIVE_POWER_USE + set_active_power() else - use_power = IDLE_POWER_USE + set_idle_power() update_appearance() diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index bef2f277f7e15..895bfdc96cf4f 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -65,8 +65,8 @@ icon = 'icons/obj/monitors.dmi' icon_state = "alarm" use_power = IDLE_POWER_USE - idle_power_usage = 4 - active_power_usage = 1200 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM power_channel = AREA_USAGE_ENVIRON //req_access = list(ACCESS_ATMOSPHERICS) max_integrity = 250 @@ -753,14 +753,14 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) visible_message("The air alarm makes a quiet click as it stops heating the area") playsound(src, 'sound/machines/terminal_off.ogg', 40) heating_current_mode = "Idle" - use_power = IDLE_POWER_USE + set_idle_power() return if(wanted_mode == "Heat" & heating_current_mode == "Idle") visible_message("The air alarm makes a quiet click as it starts heating the area") playsound(src, 'sound/machines/terminal_on.ogg', 40) heating_current_mode = "Heat" - use_power = ACTIVE_POWER_USE + set_active_power() if(heating_current_mode == "Heat") var/temperature = environment.return_temperature() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 8579d70a11650..8cd12ddf27cf0 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -18,6 +18,10 @@ can_unwrench = TRUE shift_underlay_only = FALSE + use_power = IDLE_POWER_USE + idle_power_usage = 0 + active_power_usage = ACTIVE_DRAW_MINIMAL + var/target_pressure = ONE_ATMOSPHERE var/frequency = 0 @@ -30,6 +34,10 @@ /obj/machinery/atmospherics/components/binary/pump/CtrlClick(mob/user) if(can_interact(user)) on = !on + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() return ..() @@ -110,6 +118,10 @@ switch(action) if("power") on = !on + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) . = TRUE if("pressure") diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm index 020570f347852..24ef0997406d4 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm @@ -73,6 +73,9 @@ It's like a regular ol' straight pipe, but you can turn it on and off. return ..() +/obj/machinery/atmospherics/components/binary/valve/digital/toggle() + use_power(ACTIVE_DRAW_MINIMAL) + . = ..() /obj/machinery/atmospherics/components/binary/valve/layer2 piping_layer = 2 diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 03b41df05e32b..c32a750848da2 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -18,6 +18,10 @@ can_unwrench = TRUE shift_underlay_only = FALSE + use_power = IDLE_POWER_USE + idle_power_usage = 0 + active_power_usage = ACTIVE_DRAW_MINIMAL + var/transfer_rate = MAX_TRANSFER_RATE var/overclocked = FALSE @@ -31,6 +35,10 @@ /obj/machinery/atmospherics/components/binary/volume_pump/CtrlClick(mob/user) if(can_interact(user)) on = !on + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() return ..() @@ -130,6 +138,10 @@ switch(action) if("power") on = !on + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) . = TRUE if("rate") diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index 404ecbf46eb2c..d196bca1c3b3c 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -5,6 +5,10 @@ name = "gas filter" desc = "Very useful for filtering gasses." + use_power = IDLE_POWER_USE + idle_power_usage = 0 + active_power_usage = ACTIVE_DRAW_MINIMAL + can_unwrench = TRUE var/transfer_rate = MAX_TRANSFER_RATE var/filter_type = null @@ -17,6 +21,10 @@ /obj/machinery/atmospherics/components/trinary/filter/CtrlClick(mob/user) if(can_interact(user)) on = !on + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() return ..() @@ -114,6 +122,10 @@ switch(action) if("power") on = !on + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) . = TRUE if("rate") diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index c1ce88286b4cd..9ea52bd847be8 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -5,6 +5,10 @@ name = "gas mixer" desc = "Very useful for mixing gasses." + use_power = IDLE_POWER_USE + idle_power_usage = 0 + active_power_usage = ACTIVE_DRAW_MINIMAL + can_unwrench = TRUE var/target_pressure = ONE_ATMOSPHERE @@ -19,6 +23,10 @@ /obj/machinery/atmospherics/components/trinary/mixer/CtrlClick(mob/user) if(can_interact(user)) on = !on + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() return ..() @@ -137,6 +145,10 @@ switch(action) if("power") on = !on + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) . = TRUE if("pressure") diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index 1b6df20c721e6..bcb46dedf1476 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -6,6 +6,7 @@ desc = "Heats or cools gas in connected pipes." density = TRUE + idle_power_usage = IDLE_DRAW_LOW max_integrity = 300 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 80, "acid" = 30) layer = OBJ_LAYER @@ -83,7 +84,7 @@ var/temperature_delta= abs(old_temperature - air_contents.return_temperature()) if(temperature_delta > 1) - active_power_usage = (heat_capacity * temperature_delta) / 10 + idle_power_usage + active_power_usage = (heat_capacity * temperature_delta) / 5 + idle_power_usage update_parents() else active_power_usage = idle_power_usage @@ -152,7 +153,10 @@ switch(action) if("power") on = !on - use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) . = TRUE if("target") @@ -182,6 +186,10 @@ if(!istype(user) || !user.canUseTopic(src, BE_CLOSE)) return on = !on + if(on) + set_active_power() + else + set_idle_power() investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index c55b8da804368..dc8b278959f6b 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -48,8 +48,8 @@ radio_connection = null adjacent_turfs.Cut() return ..() - -/obj/machinery/atmospherics/components/unary/vent_scrubber/auto_use_power() +/* +/obj/machinery/atmospherics/components/unary/vent_scrubber/auto_use_power() //auto_use_power no longer called if(!on || welded || !is_operational || !powered(power_channel)) return FALSE @@ -64,7 +64,7 @@ amount += amount * (adjacent_turfs.len * (adjacent_turfs.len / 2)) use_power(amount, power_channel) return TRUE - +*/ /obj/machinery/atmospherics/components/unary/vent_scrubber/update_icon_nopipes() cut_overlays() if(showpipe) @@ -138,13 +138,20 @@ ..() if(welded || !on || !is_operational) + if(use_static_power != NO_POWER_USE) + set_no_power() return FALSE if(!nodes[1]) return FALSE scrub(loc) if(widenet) + if(use_static_power != ACTIVE_POWER_USE) + set_active_power() for(var/turf/tile in adjacent_turfs) scrub(tile) + else + if(use_static_power != IDLE_POWER_USE) + set_idle_power() return TRUE /obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(turf/tile) diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm index 811979dd4c395..07aca07575680 100644 --- a/code/modules/atmospherics/machinery/other/meter.dm +++ b/code/modules/atmospherics/machinery/other/meter.dm @@ -6,8 +6,8 @@ layer = GAS_PUMP_LAYER power_channel = AREA_USAGE_ENVIRON use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 4 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = IDLE_DRAW_MINIMAL max_integrity = 150 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 40, "acid" = 0) var/frequency = 0 diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm index 37045635cf1a8..ca85e9cc55699 100644 --- a/code/modules/atmospherics/machinery/other/miner.dm +++ b/code/modules/atmospherics/machinery/other/miner.dm @@ -26,8 +26,8 @@ var/power_draw_dynamic_kpa_coeff = 0.5 var/broken = FALSE var/broken_message = "ERROR" - idle_power_usage = 150 - active_power_usage = 2000 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_HIGH /obj/machinery/atmospherics/miner/Initialize() . = ..() diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index b608d5849e386..8e71222ab4d43 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -113,8 +113,8 @@ name = "huge air scrubber" icon_state = "scrubber:0" anchored = TRUE - active_power_usage = 500 - idle_power_usage = 10 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM overpressure_m = 200 volume_rate = 1500 @@ -137,8 +137,10 @@ if((!anchored && !movable) || !is_operational) on = FALSE update_appearance() - use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE - if(!on) + if(on) + set_active_power() + else + set_idle_power() return ..() diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index a643be115aabc..51ab764796579 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -157,8 +157,8 @@ GLOBAL_LIST_EMPTY(gateway_destinations) density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 100 - active_power_usage = 5000 + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_EXTREME var/calibrated = TRUE /// Type of instanced gateway destination, needs to be subtype of /datum/gateway_destination/gateway @@ -198,7 +198,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations) target = null dest.deactivate(src) QDEL_NULL(portal) - use_power = IDLE_POWER_USE + set_idle_power() update_appearance() portal_visuals.reset_visuals() @@ -221,7 +221,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations) target.activate(destination) portal_visuals.setup_visuals(target) generate_bumper() - use_power = ACTIVE_POWER_USE + set_active_power() update_appearance() /obj/machinery/gateway/proc/Transfer(atom/movable/AM) diff --git a/code/modules/cargo/blackmarket/blackmarket_telepad.dm b/code/modules/cargo/blackmarket/blackmarket_telepad.dm index 0dea6c59b8198..14211cad68781 100644 --- a/code/modules/cargo/blackmarket/blackmarket_telepad.dm +++ b/code/modules/cargo/blackmarket/blackmarket_telepad.dm @@ -16,7 +16,7 @@ circuit = /obj/item/circuitboard/machine/ltsrbt density = TRUE - idle_power_usage = 200 + idle_power_usage = IDLE_DRAW_LOW /// Divider for power_usage_per_teleport. var/power_efficiency = 1 diff --git a/code/modules/fishing/fishing_portal_machine.dm b/code/modules/fishing/fishing_portal_machine.dm index 0cbeae7c3dac3..a070e7b7f797f 100644 --- a/code/modules/fishing/fishing_portal_machine.dm +++ b/code/modules/fishing/fishing_portal_machine.dm @@ -6,7 +6,7 @@ icon_state = "portal_off" idle_power_usage = 0 - active_power_usage = 2000 + active_power_usage = ACTIVE_DRAW_HIGH anchored = FALSE density = TRUE @@ -35,12 +35,12 @@ /obj/machinery/fishing_portal_generator/proc/activate() active = AddComponent(/datum/component/fishing_spot, fishing_source) - use_power = ACTIVE_POWER_USE + set_active_power() update_appearance() /obj/machinery/fishing_portal_generator/proc/deactivate() QDEL_NULL(active) - use_power = IDLE_POWER_USE + set_idle_power() update_appearance() /obj/machinery/fishing_portal_generator/on_set_is_operational(old_value) diff --git a/code/modules/food_and_drinks/kitchen_machinery/coffeemaker.dm b/code/modules/food_and_drinks/kitchen_machinery/coffeemaker.dm index 7b98be6a16c41..bebf3dda83a4f 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/coffeemaker.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/coffeemaker.dm @@ -6,6 +6,8 @@ icon = 'icons/obj/machines/coffeemaker.dmi' icon_state = "coffeemaker_nopot_nocart" base_icon_state = "coffeemaker" + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/coffeemaker var/obj/item/reagent_containers/food/drinks/bottle/coffeepot/coffeepot = null @@ -375,11 +377,12 @@ if(!silent) playsound(src, 'sound/machines/coffeemaker_brew.ogg', 20, vary = TRUE) toggle_steam() - use_power(active_power_usage * time * 0.1) // .1 needed here to convert time (in deciseconds) to seconds such that watts * seconds = joules + set_active_power() addtimer(CALLBACK(src, PROC_REF(stop_operating)), time / speed) /obj/machinery/coffeemaker/proc/stop_operating() brewing = FALSE + set_idle_power() toggle_steam() /obj/machinery/coffeemaker/proc/brew() diff --git a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm index 4fa5354339c57..8eccd04c8404d 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm @@ -25,7 +25,7 @@ icon_state = "fryer_off" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 5 + idle_power_usage = IDLE_DRAW_LOW layer = BELOW_OBJ_LAYER var/obj/item/reagent_containers/food/snacks/deepfryholder/frying //What's being fried RIGHT NOW? var/cook_time = 0 diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index fad3c3bc963f1..7be027c012f4e 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -5,8 +5,8 @@ icon_state = "grinder" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 500 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM circuit = /obj/item/circuitboard/machine/gibber var/operating = FALSE //Is it on? diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index 4a739d2ab7fc4..6780161824285 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -8,8 +8,8 @@ layer = BELOW_OBJ_LAYER density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM circuit = /obj/item/circuitboard/machine/microwave pass_flags = PASSTABLE light_color = LIGHT_COLOR_YELLOW @@ -275,6 +275,7 @@ /obj/machinery/microwave/proc/start() wzhzhzh() + set_active_power() loop(MICROWAVE_NORMAL, 10) /obj/machinery/microwave/proc/start_can_fail() @@ -303,11 +304,11 @@ pre_success() return time-- - use_power(500) addtimer(CALLBACK(src, PROC_REF(loop), type, time, wait), wait) /obj/machinery/microwave/proc/loop_finish() operating = FALSE + set_idle_power() var/metal = 0 for(var/obj/item/O in ingredients) @@ -330,6 +331,7 @@ /obj/machinery/microwave/proc/pre_fail() broken = 2 operating = FALSE + set_idle_power() spark() after_finish_loop() @@ -338,6 +340,7 @@ /obj/machinery/microwave/proc/muck_finish() visible_message("\The [src] gets covered in muck!") + set_idle_power() dirty = 100 dirty_anim_playing = FALSE diff --git a/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm b/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm index 005ffa7632ba3..79382343e1ae5 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm @@ -8,8 +8,8 @@ GLOBAL_LIST_EMPTY(monkey_recyclers) layer = BELOW_OBJ_LAYER density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 50 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM circuit = /obj/item/circuitboard/machine/monkey_recycler var/stored_matter = 0 var/cube_production = 0.2 diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm index ba26a265f8ee6..bc17a9fd22af3 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm @@ -7,8 +7,8 @@ layer = BELOW_OBJ_LAYER density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 50 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM circuit = /obj/item/circuitboard/machine/processor var/broken = FALSE var/processing = FALSE diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index ed1347fb51244..d2e919f008825 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -9,8 +9,8 @@ layer = BELOW_OBJ_LAYER density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL circuit = /obj/item/circuitboard/machine/smartfridge var/max_n_of_items = 1500 @@ -245,8 +245,8 @@ icon = 'icons/obj/hydroponics/equipment.dmi' icon_state = "drying_rack" use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 200 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL visible_contents = FALSE var/drying = FALSE @@ -326,10 +326,10 @@ /obj/machinery/smartfridge/drying_rack/proc/toggle_drying(forceoff) if(drying || forceoff) drying = FALSE - use_power = IDLE_POWER_USE + set_idle_power() else drying = TRUE - use_power = ACTIVE_POWER_USE + set_active_power() update_appearance() /obj/machinery/smartfridge/drying_rack/proc/rack_dry() diff --git a/code/modules/holodeck/items.dm b/code/modules/holodeck/items.dm index f1a5862649a45..d56fd4f9c32c9 100644 --- a/code/modules/holodeck/items.dm +++ b/code/modules/holodeck/items.dm @@ -152,8 +152,8 @@ var/eventstarted = FALSE use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 6 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL power_channel = AREA_USAGE_ENVIRON /obj/machinery/readybutton/attack_ai(mob/user as mob) diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index e9e40fd167b87..c3bcc09940d0f 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -5,7 +5,7 @@ icon_state = "biogen-empty" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 40 + idle_power_usage = IDLE_DRAW_LOW circuit = /obj/item/circuitboard/machine/biogenerator var/processing = FALSE var/obj/item/reagent_containers/glass/beaker = null diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index a5e66f6df4efd..66e4904e64d4b 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -6,7 +6,9 @@ pixel_z = 1 obj_flags = CAN_BE_HIT | UNIQUE_RENAME circuit = /obj/item/circuitboard/machine/hydroponics - idle_power_usage = 0 + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_HIGH var/waterlevel = 100 //The amount of water in the tray (max 100) var/maxwater = 100 //The maximum amount of water in the tray var/nutridrain = 1 // How many units of nutrient will be drained in the tray @@ -114,7 +116,7 @@ if(!powered() && self_sustaining) visible_message("[name]'s auto-grow functionality shuts off!") - idle_power_usage = 0 + set_idle_power() self_sustaining = FALSE update_appearance() @@ -671,7 +673,10 @@ if(!anchored) return self_sustaining = !self_sustaining - idle_power_usage = self_sustaining ? 1250 : 0 + if(self_sustaining) + set_active_power() + else + set_idle_power() to_chat(user, "You [self_sustaining ? "activate" : "deactivated"] [src]'s autogrow function[self_sustaining ? ", maintaining the tray's health while using high amounts of power" : ""].") update_appearance() @@ -702,7 +707,7 @@ desc = initial(desc) TRAY_NAME_UPDATE if(self_sustaining) //No reason to pay for an empty tray. - idle_power_usage = 0 + set_idle_power() self_sustaining = FALSE update_appearance() diff --git a/code/modules/mining/machine_bluespaceminer.dm b/code/modules/mining/machine_bluespaceminer.dm index feffb562a7e08..f44775d20c20c 100644 --- a/code/modules/mining/machine_bluespaceminer.dm +++ b/code/modules/mining/machine_bluespaceminer.dm @@ -7,7 +7,7 @@ circuit = /obj/item/circuitboard/machine/bluespace_miner layer = BELOW_OBJ_LAYER use_power = NO_POWER_USE - idle_power_usage = 50000 + idle_power_usage = ACTIVE_DRAW_EXTREME * 10 var/powered = FALSE var/active = FALSE diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index bbc84ec7ee683..74d35e830a7ea 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -3,6 +3,7 @@ /**********************Mineral processing unit console**************************/ /obj/machinery/mineral + idle_power_usage = IDLE_DRAW_MINIMAL processing_flags = START_PROCESSING_MANUALLY subsystem_type = /datum/controller/subsystem/processing/fastprocess /// The current direction of `input_turf`, in relation to the machine. diff --git a/code/modules/modular_computers/computers/machinery/modular_console.dm b/code/modules/modular_computers/computers/machinery/modular_console.dm index 6213cba441a6c..a1af42ca31692 100644 --- a/code/modules/modular_computers/computers/machinery/modular_console.dm +++ b/code/modules/modular_computers/computers/machinery/modular_console.dm @@ -9,8 +9,8 @@ screen_icon_state_menu = "menu" hardware_flag = PROGRAM_CONSOLE density = TRUE - base_idle_power_usage = 100 - base_active_power_usage = 500 + base_idle_power_usage = IDLE_DRAW_MINIMAL + base_active_power_usage = ACTIVE_DRAW_LOW max_hardware_size = 4 steel_sheet_cost = 10 light_strength = 2 diff --git a/code/modules/overmap/missions/research_mission.dm b/code/modules/overmap/missions/research_mission.dm index a84b07b6529a5..9481556d33bef 100644 --- a/code/modules/overmap/missions/research_mission.dm +++ b/code/modules/overmap/missions/research_mission.dm @@ -106,7 +106,7 @@ density = FALSE anchored = FALSE use_power = NO_POWER_USE - idle_power_usage = 400 + idle_power_usage = IDLE_DRAW_MEDIUM processing_flags = START_PROCESSING_MANUALLY /obj/machinery/mission_scanner/wrench_act(mob/living/user, obj/item/I) @@ -122,7 +122,7 @@ if(anchorvalue) set_is_operational(TRUE) START_PROCESSING(SSmachines, src) - use_power = IDLE_POWER_USE + set_idle_power() else set_is_operational(FALSE) STOP_PROCESSING(SSmachines, src) diff --git a/code/modules/paperwork/photocopier.dm b/code/modules/paperwork/photocopier.dm index f85bd0bc77f9f..40b0771981e46 100644 --- a/code/modules/paperwork/photocopier.dm +++ b/code/modules/paperwork/photocopier.dm @@ -24,8 +24,8 @@ anchored = TRUE density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 30 - active_power_usage = 200 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_LOW power_channel = AREA_USAGE_EQUIP max_integrity = 300 integrity_failure = 0.33 diff --git a/code/modules/plumbing/plumbers/_plumb_machinery.dm b/code/modules/plumbing/plumbers/_plumb_machinery.dm index 87096bad7e56c..f4448c4a53ac8 100644 --- a/code/modules/plumbing/plumbers/_plumb_machinery.dm +++ b/code/modules/plumbing/plumbers/_plumb_machinery.dm @@ -8,7 +8,7 @@ icon = 'icons/obj/plumbing/plumbers.dmi' icon_state = "pump" density = TRUE - active_power_usage = 30 + active_power_usage = ACTIVE_DRAW_MINIMAL use_power = ACTIVE_POWER_USE resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF ///Plumbing machinery is always gonna need reagents, so we might aswell put it here diff --git a/code/modules/plumbing/plumbers/pumps.dm b/code/modules/plumbing/plumbers/pumps.dm index 331e3fc24d89a..294b50eff748a 100644 --- a/code/modules/plumbing/plumbers/pumps.dm +++ b/code/modules/plumbing/plumbers/pumps.dm @@ -7,8 +7,8 @@ base_icon_state = "pump" anchored = FALSE density = TRUE - idle_power_usage = 10 - active_power_usage = 1000 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM rcd_cost = 30 rcd_delay = 40 diff --git a/code/modules/power/floodlight.dm b/code/modules/power/floodlight.dm index e112b38f2fd76..0fe0b51c61935 100644 --- a/code/modules/power/floodlight.dm +++ b/code/modules/power/floodlight.dm @@ -61,8 +61,8 @@ density = TRUE max_integrity = 100 integrity_failure = 0.8 - idle_power_usage = 100 - active_power_usage = 1000 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM anchored = FALSE light_power = 1.75 var/list/light_setting_list = list(0, 5, 10, 15) diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index a6020d0fae11f..3ed7e262a53d6 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -115,7 +115,7 @@ /obj/machinery/gravity_generator/main icon_state = "on_8" idle_power_usage = 0 - active_power_usage = 3000 + active_power_usage = ACTIVE_DRAW_EXTREME power_channel = AREA_USAGE_ENVIRON sprite_number = 8 use_power = IDLE_POWER_USE @@ -286,7 +286,10 @@ /obj/machinery/gravity_generator/main/proc/set_state(new_state) charging_state = POWER_IDLE on = new_state - use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE + if(on) + set_active_power() + else + set_idle_power() // Sound the alert if gravity was just enabled or disabled. var/alert = FALSE if(SSticker.IsRoundInProgress()) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 5b0655ddd42d3..b4748c674fc68 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -217,9 +217,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/light_construct/small, 28) desc = "A lighting fixture." layer = WALL_OBJ_LAYER max_integrity = 100 - use_power = ACTIVE_POWER_USE - idle_power_usage = 2 - active_power_usage = 20 + use_power = IDLE_POWER_USE + idle_power_usage = 0 + active_power_usage = 0 power_channel = AREA_USAGE_LIGHT //Lights are calc'd via area so they dont need to be in the machine list var/on = FALSE // 1 if on, 0 if off var/on_gs = FALSE @@ -360,6 +360,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/light/small/built, 28) addtimer(CALLBACK(src, PROC_REF(update), 0), 1) /obj/machinery/light/Destroy() + if(on) + removeStaticPower(static_power_used, AREA_USAGE_STATIC_LIGHT) var/area/A = get_area(src) if(A) on = FALSE @@ -420,22 +422,18 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/light/small/built, 28) if(trigger) burn_out() else - use_power = ACTIVE_POWER_USE set_light(BR, PO, CO) else if(has_emergency_power(LIGHT_EMERGENCY_POWER_USE) && !turned_off()) - use_power = IDLE_POWER_USE emergency_mode = TRUE START_PROCESSING(SSmachines, src) else - use_power = IDLE_POWER_USE set_light(0) update_appearance() - active_power_usage = (brightness * 10) if(on != on_gs) on_gs = on if(on) - static_power_used = brightness * 20 //20W per unit luminosity + static_power_used = brightness * LIGHT_DRAW //defined in power defines addStaticPower(static_power_used, AREA_USAGE_STATIC_LIGHT) else removeStaticPower(static_power_used, AREA_USAGE_STATIC_LIGHT) diff --git a/code/modules/power/monitor.dm b/code/modules/power/monitor.dm index b1c2a95a938f2..debdba4946bff 100644 --- a/code/modules/power/monitor.dm +++ b/code/modules/power/monitor.dm @@ -7,8 +7,8 @@ icon_keyboard = "power_key" light_color = LIGHT_COLOR_YELLOW use_power = ACTIVE_POWER_USE - idle_power_usage = 20 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL circuit = /obj/item/circuitboard/computer/powermonitor tgui_id = "PowerMonitor" @@ -49,10 +49,12 @@ /obj/machinery/computer/monitor/process() if(!get_powernet()) - use_power = IDLE_POWER_USE + if(use_static_power != IDLE_POWER_USE) + set_idle_power() search() else - use_power = ACTIVE_POWER_USE + if(use_static_power != ACTIVE_POWER_USE) + set_active_power() record() /obj/machinery/computer/monitor/proc/search() //keep in sync with /datum/computer_file/program/power_monitor's version diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 3cf5f5766097d..a386a739622d6 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -19,6 +19,7 @@ /obj/machinery/power/Destroy() disconnect_from_network() + set_no_power() return ..() /////////////////////////////// @@ -96,14 +97,47 @@ chan = power_channel A.use_power(amount, chan) -/obj/machinery/proc/addStaticPower(value, powerchannel) - var/area/A = get_area(src) +/obj/machinery/proc/addStaticPower(value, powerchannel, area/A) if(!A) - return + if(get_area(src)) + A = get_area(src) + else + return A.addStaticPower(value, powerchannel) -/obj/machinery/proc/removeStaticPower(value, powerchannel) - addStaticPower(-value, powerchannel) +/obj/machinery/proc/removeStaticPower(value, powerchannel, area/A) + addStaticPower(-value, powerchannel, A) + +/obj/machinery/proc/set_idle_power(area/A) + set_no_power(A) + if(use_power == NO_POWER_USE) + return + use_static_power = IDLE_POWER_USE + addStaticPower(idle_power_usage, power_channel + 3, A) + +/obj/machinery/proc/set_active_power(area/A) + set_no_power(A) + if(use_power == NO_POWER_USE) + return + use_static_power = ACTIVE_POWER_USE + addStaticPower(active_power_usage, power_channel + 3, A) + +/obj/machinery/proc/set_no_power(area/A) + switch(use_static_power) + if(IDLE_POWER_USE) + removeStaticPower(idle_power_usage, power_channel + 3, A) + if(ACTIVE_POWER_USE) + removeStaticPower(active_power_usage, power_channel + 3, A) + use_static_power = NO_POWER_USE + +/obj/machinery/proc/set_static_power(area/A)//used to set the actual draw to the value of use_static_power + switch(use_power) + if(NO_POWER_USE) + set_no_power(A) + if(IDLE_POWER_USE) + set_idle_power(A) + if(ACTIVE_POWER_USE) + set_active_power(A) /** * Called whenever the power settings of the containing area change @@ -112,13 +146,15 @@ * * Returns TRUE if the NOPOWER flag was toggled */ -/obj/machinery/proc/power_change() +/obj/machinery/proc/power_change(area/A) SIGNAL_HANDLER SHOULD_CALL_PARENT(1) + set_no_power(A) if(machine_stat & BROKEN) return if(powered(power_channel)) + set_static_power(A) if(machine_stat & NOPOWER) SEND_SIGNAL(src, COMSIG_MACHINERY_POWER_RESTORED) . = TRUE diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index d17e122647069..2dcaa224a71ef 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -11,8 +11,8 @@ circuit = /obj/item/circuitboard/machine/emitter use_power = NO_POWER_USE - idle_power_usage = 10 - active_power_usage = 300 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_LOW var/icon_state_on = "emitter_+a" var/icon_state_underpowered = "emitter_+u" @@ -67,7 +67,7 @@ var/max_firedelay = 120 var/firedelay = 120 var/min_firedelay = 24 - var/power_usage = 350 + var/power_usage = ACTIVE_DRAW_LOW for(var/obj/item/stock_parts/micro_laser/L in component_parts) max_firedelay -= 20 * L.rating min_firedelay -= 4 * L.rating diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index 7bc3fa552ad3e..ddcaf026a40e5 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -6,8 +6,8 @@ anchored = FALSE density = TRUE use_power = NO_POWER_USE - idle_power_usage = 500 - active_power_usage = 10000 + idle_power_usage = IDLE_DRAW_MEDIUM + active_power_usage = ACTIVE_DRAW_EXTREME * 2 dir = NORTH mouse_opacity = MOUSE_OPACITY_OPAQUE var/strength_upper_limit = 2 @@ -53,7 +53,7 @@ connected_parts.Cut() return if(!part_scan()) - use_power = IDLE_POWER_USE + set_idle_power() active = FALSE connected_parts.Cut() @@ -106,7 +106,7 @@ active = FALSE use_power = NO_POWER_USE else if(!machine_stat && construction_state == PA_CONSTRUCTION_COMPLETE) - use_power = IDLE_POWER_USE + set_idle_power() /obj/machinery/particle_accelerator/control_box/process() if(active) @@ -175,14 +175,14 @@ message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [usr ? ADMIN_LOOKUPFLW(usr) : "outside forces"] in [ADMIN_VERBOSEJMP(src)]") log_game("PA Control Computer turned [active ?"ON":"OFF"] by [usr ? "[key_name(usr)]" : "outside forces"] at [AREACOORD(src)]") if(active) - use_power = ACTIVE_POWER_USE + set_active_power() for(var/CP in connected_parts) var/obj/structure/particle_accelerator/part = CP part.strength = strength part.powered = TRUE part.update_appearance() else - use_power = IDLE_POWER_USE + set_idle_power() for(var/CP in connected_parts) var/obj/structure/particle_accelerator/part = CP part.strength = null diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 8ca409051d6c0..d25fc732abe7a 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -324,7 +324,7 @@ icon_state = "computer" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 250 + idle_power_usage = IDLE_DRAW_LOW max_integrity = 200 integrity_failure = 0.5 var/icon_screen = "solar" diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 290aec1f6c540..037256db302f1 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -19,7 +19,7 @@ icon_state = "dispenser" base_icon_state = "dispenser" use_power = IDLE_POWER_USE - idle_power_usage = 40 + idle_power_usage = IDLE_DRAW_MINIMAL interaction_flags_machine = INTERACT_MACHINE_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OFFLINE resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_dispenser diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index e8892390e189f..88e7973dd29c7 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -5,7 +5,7 @@ icon_state = "mixer0b" base_icon_state = "mixer" use_power = IDLE_POWER_USE - idle_power_usage = 40 + idle_power_usage = IDLE_DRAW_MINIMAL resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_heater diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index e53a7f20ae169..c9791666b54f1 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -7,7 +7,7 @@ icon_state = "mixer0" base_icon_state = "mixer" use_power = IDLE_POWER_USE - idle_power_usage = 20 + idle_power_usage = IDLE_DRAW_MINIMAL resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_master diff --git a/code/modules/reagents/chemistry/machinery/pandemic.dm b/code/modules/reagents/chemistry/machinery/pandemic.dm index 65bcf56ef25c4..6c85e75ccd86c 100644 --- a/code/modules/reagents/chemistry/machinery/pandemic.dm +++ b/code/modules/reagents/chemistry/machinery/pandemic.dm @@ -8,8 +8,8 @@ icon = 'icons/obj/chemical/misc.dmi' icon_state = "pandemic0" base_icon_state = "pandemic" - use_power = TRUE - idle_power_usage = 20 + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_MINIMAL resistance_flags = ACID_PROOF circuit = /obj/item/circuitboard/computer/pandemic unique_icon = TRUE diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index 5e5bd21747dcf..5beaca6299341 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -8,8 +8,8 @@ base_icon_state = "juicer" layer = BELOW_OBJ_LAYER use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 100 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM circuit = /obj/item/circuitboard/machine/reagentgrinder pass_flags = PASSTABLE resistance_flags = ACID_PROOF @@ -261,10 +261,11 @@ operating = FALSE /obj/machinery/reagentgrinder/proc/juice() - power_change() if(!beaker || machine_stat & (NOPOWER|BROKEN) || beaker.reagents.total_volume >= beaker.reagents.maximum_volume) return + set_active_power() operate_for(50, juicing = TRUE) + set_idle_power() for(var/obj/item/i in holdingitems) if(beaker.reagents.total_volume >= beaker.reagents.maximum_volume) break @@ -281,10 +282,11 @@ remove_object(I) /obj/machinery/reagentgrinder/proc/grind(mob/user) - power_change() if(!beaker || machine_stat & (NOPOWER|BROKEN) || beaker.reagents.total_volume >= beaker.reagents.maximum_volume) return + set_active_power() operate_for(60) + set_idle_power() for(var/i in holdingitems) if(beaker.reagents.total_volume >= beaker.reagents.maximum_volume) break @@ -310,10 +312,11 @@ /obj/machinery/reagentgrinder/proc/mix(mob/user) //For butter and other things that would change upon shaking or mixing - power_change() if(!beaker || machine_stat & (NOPOWER|BROKEN)) return + set_active_power() operate_for(50, juicing = TRUE) + set_idle_power() addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/machinery/reagentgrinder, mix_complete)), 50) /obj/machinery/reagentgrinder/proc/mix_complete() diff --git a/code/modules/research/bepis.dm b/code/modules/research/bepis.dm index 84d948f7c2b97..a033b59b56ae5 100644 --- a/code/modules/research/bepis.dm +++ b/code/modules/research/bepis.dm @@ -17,7 +17,7 @@ density = TRUE layer = ABOVE_MOB_LAYER use_power = IDLE_POWER_USE - active_power_usage = 1500 + active_power_usage = ACTIVE_DRAW_HIGH circuit = /obj/item/circuitboard/machine/bepis var/banking_amount = 100 @@ -254,7 +254,7 @@ return calcsuccess() use_power(MACHINE_OPERATION * power_saver) //This thing should eat your APC battery if you're not careful. - use_power = IDLE_POWER_USE //Machine shuts off after use to prevent spam and look better visually. + set_idle_power() //Machine shuts off after use to prevent spam and look better visually. update_icon_state() if("amount") var/input = text2num(params["amount"]) @@ -262,9 +262,9 @@ banking_amount = input if("toggle_power") if(use_power == ACTIVE_POWER_USE) - use_power = IDLE_POWER_USE + set_idle_power() else - use_power = ACTIVE_POWER_USE + set_active_power() update_icon_state() if("account_reset") if(use_power == IDLE_POWER_USE) diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index 36a22dac2cc76..0f8c2eb53c1d4 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -2,6 +2,10 @@ name = "technology fabricator" desc = "Makes researched and prototype items with materials and energy." layer = BELOW_OBJ_LAYER + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_HIGH + power_channel = AREA_USAGE_EQUIP var/consoleless_interface = FALSE //Whether it can be used without a console. var/efficiency_coeff = 1 //Materials needed / coeff = actual. var/list/categories = list() @@ -96,6 +100,7 @@ if(notify_admins) investigate_log("[key_name(usr)] built [amount] of [path] at [src]([type]).", INVESTIGATE_RESEARCH) message_admins("[ADMIN_LOOKUPFLW(usr)] has built [amount] of [path] at \a [src]([type]).") + set_idle_power() for(var/i in 1 to amount) var/obj/item/I = new path(get_turf(src)) if(efficient_with(I.type)) @@ -142,11 +147,11 @@ if(materials.on_hold()) say("Mineral access is on hold, please contact the quartermaster.") return FALSE - var/power = 1000 + var/power = active_power_usage amount = clamp(amount, 1, 50) for(var/M in D.materials) power += round(D.materials[M] * amount / 35) - power = min(3000, power) + power = min(ACTIVE_DRAW_EXTREME, power) use_power(power) var/coeff = efficient_with(D.build_path) ? efficiency_coeff : 1 var/list/efficient_mats = list() @@ -168,6 +173,7 @@ flick(production_animation, src) var/timecoeff = D.lathe_time_factor / efficiency_coeff addtimer(CALLBACK(src, PROC_REF(reset_busy)), (30 * timecoeff * amount) ** 0.5) + set_active_power() addtimer(CALLBACK(src, PROC_REF(do_print), D.build_path, amount, efficient_mats, D.dangerous_construction), (32 * timecoeff * amount) ** 0.8) return TRUE diff --git a/code/modules/research/nanites/nanite_chamber.dm b/code/modules/research/nanites/nanite_chamber.dm index d5d5fa79e8ca3..eb50a70af0bb4 100644 --- a/code/modules/research/nanites/nanite_chamber.dm +++ b/code/modules/research/nanites/nanite_chamber.dm @@ -9,8 +9,8 @@ use_power = IDLE_POWER_USE anchored = TRUE density = TRUE - idle_power_usage = 50 - active_power_usage = 300 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_HIGH var/locked = FALSE var/breakout_time = 1200 diff --git a/code/modules/research/nanites/public_chamber.dm b/code/modules/research/nanites/public_chamber.dm index 9e39486c20522..b149fda6baaeb 100644 --- a/code/modules/research/nanites/public_chamber.dm +++ b/code/modules/research/nanites/public_chamber.dm @@ -8,8 +8,8 @@ use_power = IDLE_POWER_USE anchored = TRUE density = TRUE - idle_power_usage = 50 - active_power_usage = 300 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_HIGH var/cloud_id = 1 var/locked = FALSE diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index 7f3693e987608..58e75c399d817 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -10,8 +10,8 @@ GLOBAL_DATUM_INIT(keycard_events, /datum/events, new) icon = 'icons/obj/monitors.dmi' icon_state = "auth_off" use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 6 + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MINIMAL power_channel = AREA_USAGE_ENVIRON req_access = list(ACCESS_KEYCARD_AUTH) resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF diff --git a/code/modules/station_goals/dna_vault.dm b/code/modules/station_goals/dna_vault.dm index 9679aa860c9cd..b894f99c255d2 100644 --- a/code/modules/station_goals/dna_vault.dm +++ b/code/modules/station_goals/dna_vault.dm @@ -120,7 +120,7 @@ icon_state = "vault" density = TRUE anchored = TRUE - idle_power_usage = 5000 + idle_power_usage = ACTIVE_DRAW_EXTREME pixel_x = -32 pixel_y = -64 light_range = 3 diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index 93fcacba45b1e..4c97b3f7eaa2f 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -47,6 +47,8 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C icon_state = "generic" layer = BELOW_OBJ_LAYER density = TRUE + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_MINIMAL verb_say = "beeps" verb_ask = "beeps" verb_exclaim = "beeps"