diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index 41ba2cf705..0d00363292 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -214,10 +214,10 @@ if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) return 0 if(signal.data["power"]) - use_power = text2num(signal.data["power"]) + update_use_power(text2num(signal.data["power"])) if(signal.data["power_toggle"]) - use_power = !use_power + update_use_power(!use_power) if(signal.data["direction"]) pump_direction = text2num(signal.data["direction"]) diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index b4b8187f45..8f3f84feb0 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -160,12 +160,12 @@ Thus, the two variables affect pump operation are set in New(): if(signal.data["power"]) if(text2num(signal.data["power"])) - use_power = 1 + update_use_power(USE_POWER_IDLE) else - use_power = 0 + update_use_power(USE_POWER_OFF) if("power_toggle" in signal.data) - use_power = !use_power + update_use_power(!use_power) if(signal.data["set_output_pressure"]) target_pressure = between( @@ -199,7 +199,7 @@ Thus, the two variables affect pump operation are set in New(): if(..()) return 1 if(href_list["power"]) - use_power = !use_power + update_use_power(!use_power) switch(href_list["set_press"]) if ("min") diff --git a/code/ATMOSPHERICS/components/omni_devices/filter.dm b/code/ATMOSPHERICS/components/omni_devices/filter.dm index 074c6c528d..df40f7da63 100644 --- a/code/ATMOSPHERICS/components/omni_devices/filter.dm +++ b/code/ATMOSPHERICS/components/omni_devices/filter.dm @@ -161,13 +161,13 @@ switch(href_list["command"]) if("power") if(!configuring) - use_power = !use_power + update_use_power(!use_power) else - use_power = 0 + update_use_power(USE_POWER_OFF) if("configure") configuring = !configuring if(configuring) - use_power = 0 + update_use_power(USE_POWER_OFF) //only allows config changes when in configuring mode ~otherwise you'll get weird pressure stuff going on if(configuring && !use_power) diff --git a/code/ATMOSPHERICS/components/omni_devices/mixer.dm b/code/ATMOSPHERICS/components/omni_devices/mixer.dm index 47c78427f0..0e77be767b 100644 --- a/code/ATMOSPHERICS/components/omni_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/omni_devices/mixer.dm @@ -178,13 +178,13 @@ switch(href_list["command"]) if("power") if(!configuring) - use_power = !use_power + update_use_power(!use_power) else - use_power = 0 + update_use_power(USE_POWER_OFF) if("configure") configuring = !configuring if(configuring) - use_power = 0 + update_use_power(USE_POWER_OFF) //only allows config changes when in configuring mode ~otherwise you'll get weird pressure stuff going on if(configuring && !use_power) diff --git a/code/ATMOSPHERICS/components/omni_devices/omni_base.dm b/code/ATMOSPHERICS/components/omni_devices/omni_base.dm index 1a82bab1e2..10e4d655f8 100644 --- a/code/ATMOSPHERICS/components/omni_devices/omni_base.dm +++ b/code/ATMOSPHERICS/components/omni_devices/omni_base.dm @@ -67,7 +67,7 @@ last_flow_rate = 0 if(error_check()) - use_power = 0 + update_use_power(USE_POWER_OFF) if((stat & (NOPOWER|BROKEN)) || !use_power) return 0 diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm index e900303e22..bc93df0384 100755 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -73,7 +73,7 @@ icon_state += use_power ? "on" : "off" else icon_state += "off" - use_power = 0 + update_use_power(USE_POWER_OFF) /obj/machinery/atmospherics/trinary/atmos_filter/process() ..() diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm index 8bf3d3477c..15048f5efb 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm @@ -35,7 +35,7 @@ icon_state += use_power ? "on" : "off" else icon_state += "off" - use_power = 0 + update_use_power(USE_POWER_OFF) /obj/machinery/atmospherics/trinary/mixer/New() ..() @@ -114,7 +114,7 @@ /obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list) if(..()) return 1 if(href_list["power"]) - use_power = !use_power + update_use_power(!use_power) if(href_list["set_press"]) var/max_flow_rate = min(air1.volume, air2.volume) var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[max_flow_rate]L/s)","Flow Rate Control",src.set_flow_rate) as num diff --git a/code/ATMOSPHERICS/components/unary/cold_sink.dm b/code/ATMOSPHERICS/components/unary/cold_sink.dm index 0fddd6d8e8..68fe41779d 100644 --- a/code/ATMOSPHERICS/components/unary/cold_sink.dm +++ b/code/ATMOSPHERICS/components/unary/cold_sink.dm @@ -99,7 +99,7 @@ if(..()) return 1 if(href_list["toggleStatus"]) - use_power = !use_power + update_use_power(!use_power) update_icon() if(href_list["temp"]) var/amount = text2num(href_list["temp"]) diff --git a/code/ATMOSPHERICS/components/unary/heat_source.dm b/code/ATMOSPHERICS/components/unary/heat_source.dm index 7a2caa1d9d..c71c6d3dc2 100644 --- a/code/ATMOSPHERICS/components/unary/heat_source.dm +++ b/code/ATMOSPHERICS/components/unary/heat_source.dm @@ -119,7 +119,7 @@ if(..()) return 1 if(href_list["toggleStatus"]) - use_power = !use_power + update_use_power(!use_power) update_icon() if(href_list["temp"]) var/amount = text2num(href_list["temp"]) diff --git a/code/ATMOSPHERICS/components/unary/outlet_injector.dm b/code/ATMOSPHERICS/components/unary/outlet_injector.dm index 5e62fe5802..324e5de89b 100644 --- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm @@ -132,10 +132,10 @@ return 0 if(signal.data["power"]) - use_power = text2num(signal.data["power"]) + update_use_power(text2num(signal.data["power"])) if(signal.data["power_toggle"]) - use_power = !use_power + update_use_power(!use_power) if(signal.data["inject"]) spawn inject() @@ -160,7 +160,7 @@ /obj/machinery/atmospherics/unary/outlet_injector/attack_hand(mob/user as mob) to_chat(user, "You toggle \the [src].") injecting = !injecting - use_power = injecting + update_use_power(injecting ? USE_POWER_IDLE : USE_POWER_OFF) update_icon() /obj/machinery/atmospherics/unary/outlet_injector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index f30def6e07..0e1e12bb99 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -173,7 +173,7 @@ return 1 if (!node) - use_power = 0 + update_use_power(USE_POWER_OFF) if(!can_pump()) return 0 @@ -295,10 +295,10 @@ pump_direction = 1 if(signal.data["power"] != null) - use_power = text2num(signal.data["power"]) + update_use_power(text2num(signal.data["power"])) if(signal.data["power_toggle"] != null) - use_power = !use_power + update_use_power(!use_power) if(signal.data["checks"] != null) if (signal.data["checks"] == "default") diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index 34897b66ef..1de9feaa53 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -135,7 +135,7 @@ return 1 if (!node) - use_power = 0 + update_use_power(USE_POWER_OFF) //broadcast_status() if(!use_power || (stat & (NOPOWER|BROKEN))) return 0 @@ -180,21 +180,21 @@ return 0 if(signal.data["power"] != null) - use_power = text2num(signal.data["power"]) + update_use_power(text2num(signal.data["power"])) if(signal.data["power_toggle"] != null) - use_power = !use_power + update_use_power(!use_power) if(signal.data["panic_siphon"]) //must be before if("scrubbing" thing panic = text2num(signal.data["panic_siphon"]) if(panic) - use_power = 1 + update_use_power(USE_POWER_IDLE) scrubbing = 0 else scrubbing = 1 if(signal.data["toggle_panic_siphon"] != null) panic = !panic if(panic) - use_power = 1 + update_use_power(USE_POWER_IDLE) scrubbing = 0 else scrubbing = 1 diff --git a/code/__defines/machinery.dm b/code/__defines/machinery.dm index 3676071d7c..f7c2457b98 100644 --- a/code/__defines/machinery.dm +++ b/code/__defines/machinery.dm @@ -11,6 +11,11 @@ var/global/defer_powernet_rebuild = 0 // True if net rebuild will be called #define DOOR_CRUSH_DAMAGE 20 #define ALIEN_SELECT_AFK_BUFFER 1 // How many minutes that a person can be AFK before not being allowed to be an alien. +// Constants for machine's use_power +#define USE_POWER_OFF 0 // No continuous power use +#define USE_POWER_IDLE 1 // Machine is using power at its idle power level +#define USE_POWER_ACTIVE 2 // Machine is using power at its active power level + // Channel numbers for power. #define EQUIP 1 #define LIGHT 2 diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index f6750215bc..ec919e6dc4 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -386,7 +386,7 @@ M.client.perspective = EYE_PERSPECTIVE M.client.eye = src M.loc = src - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) occupant = M update_icon() @@ -406,7 +406,7 @@ if(A in component_parts) continue A.loc = src.loc - update_use_power(1) + update_use_power(USE_POWER_IDLE) update_icon() toggle_filter() toggle_pump() diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 5b061b4fb9..859aba6c43 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -192,7 +192,7 @@ if(!regulating_temperature) //check for when we should start adjusting temperature if(!get_danger_level(target_temperature, TLV["temperature"]) && abs(environment.temperature - target_temperature) > 2.0) - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) regulating_temperature = 1 audible_message("\The [src] clicks as it starts [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\ "You hear a click and a faint electronic hum.") @@ -200,7 +200,7 @@ else //check for when we should stop adjusting temperature if(get_danger_level(target_temperature, TLV["temperature"]) || abs(environment.temperature - target_temperature) <= 0.5) - update_use_power(1) + update_use_power(USE_POWER_IDLE) regulating_temperature = 0 audible_message("\The [src] clicks quietly as it stops [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\ "You hear a click as a faint electronic humming stops.") diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index ff26049fa6..2250c219fa 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -246,7 +246,7 @@ return busy = 1 - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) //Check if we still have the materials. var/coeff = (making.no_scale ? 1 : mat_efficiency) //stacks are unaffected by production coefficient @@ -265,7 +265,7 @@ sleep(build_time) busy = 0 - update_use_power(1) + update_use_power(USE_POWER_IDLE) update_icon() // So lid opens //Sanity check. diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 0ceae52046..97ed6ed9fb 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -118,16 +118,16 @@ /obj/machinery/cell_charger/process() //to_world("ccpt [charging] [stat]") if((stat & (BROKEN|NOPOWER)) || !anchored) - update_use_power(0) + update_use_power(USE_POWER_OFF) return if(charging && !charging.fully_charged()) charging.give(efficiency*CELLRATE) - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) update_icon() else - update_use_power(1) + update_use_power(USE_POWER_IDLE) /obj/machinery/cell_charger/RefreshParts() var/E = 0 diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 2968ae8aaf..5ec0b065bd 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -170,7 +170,7 @@ src.current_camera = C if(current_camera) current_camera.camera_computers_using_this.Add(src) - use_power = 2 + update_use_power(USE_POWER_ACTIVE) var/mob/living/L = current_camera.loc if(istype(L)) L.tracking_initiated() diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 9f10ff4c90..977f49b65a 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -291,7 +291,7 @@ unbuckle_mob(occupant, force = TRUE) occupant = null current_heat_capacity = initial(current_heat_capacity) - update_use_power(1) + update_use_power(USE_POWER_IDLE) return /obj/machinery/atmospherics/unary/cryo_cell/proc/put_mob(mob/living/carbon/M as mob) if(stat & (NOPOWER|BROKEN)) @@ -322,7 +322,7 @@ vis_contents |= occupant occupant.pixel_y += 19 current_heat_capacity = HEAT_CAPACITY_HUMAN - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) // M.metabslow = 1 add_fingerprint(usr) update_icon() diff --git a/code/game/machinery/floor_light.dm b/code/game/machinery/floor_light.dm index f02d3c2855..2c391a07ce 100644 --- a/code/game/machinery/floor_light.dm +++ b/code/game/machinery/floor_light.dm @@ -72,7 +72,7 @@ var/list/floor_light_cache = list() return on = !on - if(on) use_power = 2 + if(on) update_use_power(USE_POWER_ACTIVE) visible_message("\The [user] turns \the [src] [on ? "on" : "off"].") update_brightness() return @@ -81,11 +81,11 @@ var/list/floor_light_cache = list() ..() var/need_update if((!anchored || broken()) && on) - use_power = 0 + update_use_power(USE_POWER_OFF) on = 0 need_update = 1 else if(use_power && !on) - use_power = 0 + update_use_power(USE_POWER_OFF) need_update = 1 if(need_update) update_brightness() @@ -95,7 +95,7 @@ var/list/floor_light_cache = list() if(light_range != default_light_range || light_power != default_light_power || light_color != default_light_colour) set_light(default_light_range, default_light_power, default_light_colour) else - use_power = 0 + update_use_power(USE_POWER_OFF) if(light_range || light_power) set_light(0) diff --git a/code/game/machinery/holosign.dm b/code/game/machinery/holosign.dm index 9a656ac3be..89f17c5ab0 100644 --- a/code/game/machinery/holosign.dm +++ b/code/game/machinery/holosign.dm @@ -19,7 +19,7 @@ if(stat & (BROKEN|NOPOWER)) return lit = !lit - use_power = lit ? 2 : 1 + update_use_power(lit ? USE_POWER_ACTIVE : USE_POWER_IDLE) update_icon() /obj/machinery/holosign/update_icon() @@ -34,7 +34,7 @@ ..() if(stat & NOPOWER) lit = 0 - use_power = 0 + update_use_power(USE_POWER_OFF) update_icon() diff --git a/code/game/machinery/jukebox.dm b/code/game/machinery/jukebox.dm index f2808dbc18..f71a334447 100644 --- a/code/game/machinery/jukebox.dm +++ b/code/game/machinery/jukebox.dm @@ -249,7 +249,7 @@ datum/track/New(var/title_name, var/audio) main_area.forced_ambience = null playing = 0 - update_use_power(1) + update_use_power(USE_POWER_IDLE) update_icon() @@ -271,7 +271,7 @@ datum/track/New(var/title_name, var/audio) main_area.play_ambience(M) playing = 1 - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) update_icon() // Advance to the next track - Don't start playing it unless we were already playing diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm index 9f97ab0360..eb5a91ccbe 100644 --- a/code/game/machinery/magnet.dm +++ b/code/game/machinery/magnet.dm @@ -142,10 +142,10 @@ // Update power usage: if(on) - use_power = 2 + update_use_power(USE_POWER_ACTIVE) active_power_usage = electricity_level*15 else - use_power = 0 + update_use_power(USE_POWER_OFF) // Overload conditions: /* // Eeeehhh kinda stupid diff --git a/code/game/machinery/neonsign.dm b/code/game/machinery/neonsign.dm index fe5d5370a8..6d406a8f36 100644 --- a/code/game/machinery/neonsign.dm +++ b/code/game/machinery/neonsign.dm @@ -19,7 +19,7 @@ if(stat & (BROKEN|NOPOWER)) return lit = !lit - use_power = lit ? 2 : 1 + update_use_power(lit ? USE_POWER_ACTIVE : USE_POWER_IDLE) update_icon() /obj/machinery/neonsign/update_icon() @@ -34,7 +34,7 @@ ..() if(stat & NOPOWER) lit = 0 - use_power = 0 + update_use_power(USE_POWER_OFF) update_icon() diff --git a/code/game/machinery/oxygen_pump.dm b/code/game/machinery/oxygen_pump.dm index 7f2b310ed6..10c96a6b6a 100644 --- a/code/game/machinery/oxygen_pump.dm +++ b/code/game/machinery/oxygen_pump.dm @@ -73,7 +73,7 @@ if(breather.internals) breather.internals.icon_state = "internal0" breather = null - use_power = 1 + update_use_power(USE_POWER_IDLE) /obj/machinery/oxygen_pump/attack_ai(mob/user as mob) ui_interact(user) @@ -90,7 +90,7 @@ breather.internal = tank if(breather.internals) breather.internals.icon_state = "internal1" - use_power = 2 + update_use_power(USE_POWER_ACTIVE) /obj/machinery/oxygen_pump/proc/can_apply_to_target(var/mob/living/carbon/human/target, mob/user as mob) if(!user) @@ -162,7 +162,7 @@ contained.forceMove(src) src.visible_message("\The [contained] rapidly retracts back into \the [src]!") breather = null - use_power = 1 + update_use_power(USE_POWER_IDLE) else if(!breather.internal && tank) breather.internal = tank if(breather.internals) @@ -287,7 +287,7 @@ contained.forceMove(src) src.visible_message("\The [contained] rapidly retracts back into \the [src]!") breather = null - use_power = 1 + update_use_power(USE_POWER_IDLE) else if(!breather.internal && tank) breather.internal = tank if(breather.internals) diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index 92c28366fa..79007144d5 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -117,12 +117,12 @@ /obj/machinery/recharger/process() if(stat & (NOPOWER|BROKEN) || !anchored) - update_use_power(0) + update_use_power(USE_POWER_OFF) icon_state = icon_state_idle return if(!charging) - update_use_power(1) + update_use_power(USE_POWER_IDLE) icon_state = icon_state_idle else var/obj/item/weapon/cell/C = charging.get_cell() @@ -130,10 +130,10 @@ if(!C.fully_charged()) icon_state = icon_state_charging C.give(CELLRATE*efficiency) - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) else icon_state = icon_state_charged - update_use_power(1) + update_use_power(USE_POWER_IDLE) /obj/machinery/recharger/emp_act(severity) if(stat & (NOPOWER|BROKEN) || !anchored) diff --git a/code/game/machinery/robot_fabricator.dm b/code/game/machinery/robot_fabricator.dm index 7c5f8cafa0..d415162f80 100644 --- a/code/game/machinery/robot_fabricator.dm +++ b/code/game/machinery/robot_fabricator.dm @@ -115,7 +115,7 @@ Please wait until completion...
if(!isnull(building)) if(metal_amount >= build_cost) operating = 1 - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) metal_amount = max(0, metal_amount - build_cost) @@ -128,7 +128,7 @@ Please wait until completion...
if(!isnull(being_built)) being_built.loc = get_turf(src) being_built = null - update_use_power(1) + update_use_power(USE_POWER_IDLE) operating = 0 overlays -= "fab-active" return diff --git a/code/game/machinery/supplybeacon.dm b/code/game/machinery/supplybeacon.dm index 9f228be5d4..e515aaa36b 100644 --- a/code/game/machinery/supplybeacon.dm +++ b/code/game/machinery/supplybeacon.dm @@ -58,7 +58,7 @@ /obj/machinery/power/supply_beacon/attack_hand(var/mob/user) if(expended) - use_power = 0 + update_use_power(USE_POWER_OFF) to_chat (user, "\The [src] has used up its charge.") return diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index a0bdb5cd43..1955c52a6c 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -356,8 +356,8 @@ if(com) com.icon_state = "tele1" use_power(5000) - update_use_power(2) - com.update_use_power(2) + update_use_power(USE_POWER_ACTIVE) + com.update_use_power(USE_POWER_ACTIVE) for(var/mob/O in hearers(src, null)) O.show_message("Teleporter engaged!", 2) add_fingerprint(usr) @@ -371,8 +371,8 @@ if(com) com.icon_state = "tele0" com.accurate = 0 - com.update_use_power(1) - update_use_power(1) + com.update_use_power(USE_POWER_IDLE) + update_use_power(USE_POWER_IDLE) for(var/mob/O in hearers(src, null)) O.show_message("Teleporter disengaged!", 2) add_fingerprint(usr) diff --git a/code/game/machinery/virtual_reality/ar_console.dm b/code/game/machinery/virtual_reality/ar_console.dm index 1f4c8c16fe..f4c6049487 100644 --- a/code/game/machinery/virtual_reality/ar_console.dm +++ b/code/game/machinery/virtual_reality/ar_console.dm @@ -73,7 +73,7 @@ if(A in component_parts) continue A.loc = src.loc - update_use_power(1) + update_use_power(USE_POWER_IDLE) update_icon() /obj/machinery/vr_sleeper/alien/enter_vr() diff --git a/code/game/machinery/virtual_reality/vr_console.dm b/code/game/machinery/virtual_reality/vr_console.dm index dcd6e555b9..2bdfc53464 100644 --- a/code/game/machinery/virtual_reality/vr_console.dm +++ b/code/game/machinery/virtual_reality/vr_console.dm @@ -174,7 +174,7 @@ M.client.perspective = EYE_PERSPECTIVE M.client.eye = src M.loc = src - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) occupant = M update_icon() @@ -203,7 +203,7 @@ if(A in component_parts) continue A.loc = src.loc - update_use_power(1) + update_use_power(USE_POWER_IDLE) update_icon() /obj/machinery/vr_sleeper/proc/enter_vr() diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 24176ef0f8..bc6ef51556 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -48,11 +48,11 @@ if(stat) return if(busy) - use_power = 2 + update_use_power(USE_POWER_ACTIVE) progress += speed check_build() else - use_power = 1 + update_use_power(USE_POWER_IDLE) update_icon() /obj/machinery/mecha_part_fabricator/update_icon() diff --git a/code/game/mecha/mech_prosthetics.dm b/code/game/mecha/mech_prosthetics.dm index f554c936c6..925a24dc1f 100644 --- a/code/game/mecha/mech_prosthetics.dm +++ b/code/game/mecha/mech_prosthetics.dm @@ -52,11 +52,11 @@ if(stat) return if(busy) - use_power = 2 + update_use_power(USE_POWER_ACTIVE) progress += speed check_build() else - use_power = 1 + update_use_power(USE_POWER_IDLE) update_icon() /obj/machinery/pros_fabricator/update_icon() diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index d14c37d97e..feebada82a 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -539,7 +539,7 @@ Pump.air2.gas["nitrogen"] = 3750 //The contents of 2 canisters. Pump.air2.temperature = 50 Pump.air2.update_values() - Pump.use_power=1 + Pump.update_use_power(USE_POWER_IDLE) Pump.target_pressure = 4500 Pump.update_icon() diff --git a/code/modules/holodeck/HolodeckControl.dm b/code/modules/holodeck/HolodeckControl.dm index ed1ced9c78..0147c1194c 100644 --- a/code/modules/holodeck/HolodeckControl.dm +++ b/code/modules/holodeck/HolodeckControl.dm @@ -224,7 +224,7 @@ damaged = 1 loadProgram(powerdown_program, 0) active = 0 - use_power = 1 + update_use_power(USE_POWER_IDLE) for(var/mob/M in range(10,src)) M.show_message("The holodeck overloads!") @@ -271,7 +271,7 @@ linkedholodeck.gravitychange(1) active = 0 - use_power = 1 + update_use_power(USE_POWER_IDLE) /obj/machinery/computer/HolodeckControl/proc/loadProgram(var/prog, var/check_delay = 1) diff --git a/code/modules/holomap/station_holomap.dm b/code/modules/holomap/station_holomap.dm index d38875f220..3237f79590 100644 --- a/code/modules/holomap/station_holomap.dm +++ b/code/modules/holomap/station_holomap.dm @@ -126,7 +126,7 @@ GLOB.moved_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition) GLOB.dir_set_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition) GLOB.destroyed_event.register(watching_mob, src, /obj/machinery/station_map/proc/stopWatching) - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) if(bogus) to_chat(user, "The holomap failed to initialize. This area of space cannot be mapped.") @@ -156,7 +156,7 @@ GLOB.dir_set_event.unregister(watching_mob, src) GLOB.destroyed_event.unregister(watching_mob, src) watching_mob = null - update_use_power(1) + update_use_power(USE_POWER_IDLE) /obj/machinery/station_map/power_change() . = ..() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 1d42d8370e..065972a23c 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -319,14 +319,14 @@ var/list/ai_verbs_default = list( qdel(src) return if(powered_ai.APU_power) - use_power = 0 + update_use_power(USE_POWER_OFF) return if(!powered_ai.anchored) loc = powered_ai.loc - use_power = 0 + update_use_power(USE_POWER_OFF) use_power(50000) // Less optimalised but only called if AI is unwrenched. This prevents usage of wrenching as method to keep AI operational without power. Intellicard is for that. if(powered_ai.anchored) - use_power = 2 + update_use_power(USE_POWER_ACTIVE) /mob/living/silicon/ai/proc/pick_icon() set category = "AI Settings" diff --git a/code/modules/modular_computers/NTNet/NTNet_relay.dm b/code/modules/modular_computers/NTNet/NTNet_relay.dm index d659caaf40..5720d3b6e7 100644 --- a/code/modules/modular_computers/NTNet/NTNet_relay.dm +++ b/code/modules/modular_computers/NTNet/NTNet_relay.dm @@ -38,9 +38,9 @@ /obj/machinery/ntnet_relay/process() if(operable()) - use_power = 2 + update_use_power(USE_POWER_ACTIVE) else - use_power = 1 + update_use_power(USE_POWER_IDLE) if(dos_overload) dos_overload = max(0, dos_overload - dos_dissipate) diff --git a/code/modules/power/antimatter/control.dm b/code/modules/power/antimatter/control.dm index 260730391c..3e2c2a6e51 100644 --- a/code/modules/power/antimatter/control.dm +++ b/code/modules/power/antimatter/control.dm @@ -211,10 +211,10 @@ /obj/machinery/power/am_control_unit/proc/toggle_power() active = !active if(active) - use_power = 2 + update_use_power(USE_POWER_ACTIVE) visible_message("The [src.name] starts up.") else - use_power = 1 + update_use_power(USE_POWER_IDLE) visible_message("The [src.name] shuts down.") update_icon() return diff --git a/code/modules/power/fusion/core/_core.dm b/code/modules/power/fusion/core/_core.dm index 99b0346e62..648643e5e2 100644 --- a/code/modules/power/fusion/core/_core.dm +++ b/code/modules/power/fusion/core/_core.dm @@ -70,7 +70,7 @@ var/list/fusion_cores = list() owned_field = new(loc, src) owned_field.ChangeFieldStrength(field_strength) icon_state = "core1" - use_power = 2 + update_use_power(USE_POWER_ACTIVE) . = 1 /obj/machinery/power/fusion_core/proc/Shutdown(var/force_rupture) @@ -82,7 +82,7 @@ var/list/fusion_cores = list() owned_field.RadiateAll() qdel(owned_field) owned_field = null - use_power = 1 + update_use_power(USE_POWER_IDLE) /obj/machinery/power/fusion_core/proc/AddParticles(var/name, var/quantity = 1) if(owned_field) diff --git a/code/modules/power/fusion/fuel_assembly/fuel_injector.dm b/code/modules/power/fusion/fuel_assembly/fuel_injector.dm index 80a512b91b..ef25aaae1f 100644 --- a/code/modules/power/fusion/fuel_assembly/fuel_injector.dm +++ b/code/modules/power/fusion/fuel_assembly/fuel_injector.dm @@ -103,13 +103,13 @@ var/list/fuel_injectors = list() if(!injecting && cur_assembly) icon_state = "injector1" injecting = 1 - use_power = 1 + update_use_power(USE_POWER_IDLE) /obj/machinery/fusion_fuel_injector/proc/StopInjecting() if(injecting) injecting = 0 icon_state = "injector0" - use_power = 0 + update_use_power(USE_POWER_OFF) /obj/machinery/fusion_fuel_injector/proc/Inject() if(!injecting) diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 2eadfc520a..f77deba261 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -156,7 +156,7 @@ user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the bolts holding [src.name] to the floor.", \ "You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.", \ "You hear a ratchet.") - use_power = anchored + update_use_power(anchored ? USE_POWER_IDLE : USE_POWER_ACTIVE) if(anchored) // Powernet connection stuff. connect_to_network() else diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index ab91a82510..85a19aa12f 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -320,10 +320,10 @@ var/global/list/light_type_cache = list() on = 0 set_light(0) else - use_power = 2 + update_use_power(USE_POWER_ACTIVE) set_light(brightness_range, brightness_power, brightness_color) else - use_power = 1 + update_use_power(USE_POWER_IDLE) set_light(0) active_power_usage = ((light_range * light_power) * LIGHTING_POWER_FACTOR) diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index 7460830f21..50e9fd27c5 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -383,10 +383,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin if(src.construction_state < 3)//Was taken apart, update state update_state() if(use_power) - use_power = 0 + update_use_power(USE_POWER_OFF) src.construction_state = temp_state if(src.construction_state >= 3) - use_power = 1 + update_use_power(USE_POWER_IDLE) update_icon() return 1 return 0 diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index bcdd0d5036..2ff5fba318 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -42,7 +42,7 @@ /obj/machinery/particle_accelerator/control_box/update_state() if(construction_state < 3) - update_use_power(0) + update_use_power(USE_POWER_OFF) assembled = 0 active = 0 for(var/obj/structure/particle_accelerator/part in connected_parts) @@ -52,7 +52,7 @@ connected_parts = list() return if(!part_scan()) - update_use_power(1) + update_use_power(USE_POWER_IDLE) active = 0 connected_parts = list() @@ -138,9 +138,9 @@ ..() if(stat & NOPOWER) active = 0 - update_use_power(0) + update_use_power(USE_POWER_OFF) else if(!stat && construction_state == 3) - update_use_power(1) + update_use_power(USE_POWER_IDLE) /obj/machinery/particle_accelerator/control_box/process() @@ -212,13 +212,13 @@ message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [key_name(usr, usr.client)](?) in ([x],[y],[z] - JMP)",0,1) log_game("PACCEL([x],[y],[z]) [key_name(usr)] turned [active?"ON":"OFF"].") if(active) - update_use_power(2) + update_use_power(USE_POWER_ACTIVE) for(var/obj/structure/particle_accelerator/part in connected_parts) part.strength = src.strength part.powered = 1 part.update_icon() else - update_use_power(1) + update_use_power(USE_POWER_IDLE) for(var/obj/structure/particle_accelerator/part in connected_parts) part.strength = null part.powered = 0 diff --git a/code/modules/power/supermatter/setup_supermatter.dm b/code/modules/power/supermatter/setup_supermatter.dm index 7477623805..c0b63d9ce1 100644 --- a/code/modules/power/supermatter/setup_supermatter.dm +++ b/code/modules/power/supermatter/setup_supermatter.dm @@ -126,7 +126,7 @@ GLOBAL_LIST_BOILERPLATE(all_engine_setup_markers, /obj/effect/engine_setup) log_and_message_admins("## WARNING: Unable to locate pump at [x] [y] [z]!") return SETUP_WARNING P.target_pressure = P.max_pressure_setting - P.use_power = 1 + P.update_use_power(USE_POWER_IDLE) P.update_icon() return SETUP_OK @@ -259,7 +259,7 @@ GLOBAL_LIST_BOILERPLATE(all_engine_setup_markers, /obj/effect/engine_setup) return SETUP_WARNING F.rebuild_filtering_list() - F.use_power = 1 + F.update_use_power(USE_POWER_IDLE) F.update_icon() return SETUP_OK diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 8a2e9796cd..b8aba13939 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -359,7 +359,7 @@ // charge the gas reservoir and perform flush if ready /obj/machinery/disposal/process() if(!air_contents || (stat & BROKEN)) // nothing can happen if broken - update_use_power(0) + update_use_power(USE_POWER_OFF) return flush_count++ @@ -377,7 +377,7 @@ flush() if(mode != 1) //if off or ready, no need to charge - update_use_power(1) + update_use_power(USE_POWER_IDLE) else if(air_contents.return_pressure() >= SEND_PRESSURE) mode = 2 //if full enough, switch to ready mode update() @@ -386,7 +386,7 @@ /obj/machinery/disposal/proc/pressurize() if(stat & NOPOWER) // won't charge if no power - update_use_power(0) + update_use_power(USE_POWER_OFF) return var/atom/L = loc // recharging from loc turf diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm index e764e0b516..19a720e9ad 100644 --- a/code/modules/shieldgen/emergency_shield.dm +++ b/code/modules/shieldgen/emergency_shield.dm @@ -156,7 +156,7 @@ idle_power_usage = 0 for(var/obj/machinery/shield/shield_tile in deployed_shields) idle_power_usage += shield_tile.shield_idle_power - update_use_power(1) + update_use_power(USE_POWER_IDLE) /obj/machinery/shieldgen/proc/shields_down() if(!active) return 0 //If it's already off, how did this get called? @@ -166,7 +166,7 @@ collapse_shields() - update_use_power(0) + update_use_power(USE_POWER_OFF) /obj/machinery/shieldgen/proc/create_shields() for(var/turf/target_tile in range(2, src)) diff --git a/code/modules/shieldgen/shield_diffuser.dm b/code/modules/shieldgen/shield_diffuser.dm index c30f8a7351..39f4c02aaf 100644 --- a/code/modules/shieldgen/shield_diffuser.dm +++ b/code/modules/shieldgen/shield_diffuser.dm @@ -57,7 +57,7 @@ update_icon() return enabled = !enabled - use_power = enabled + 1 + update_use_power(enabled ? USE_POWER_ACTIVE : USE_POWER_IDLE) update_icon() to_chat(usr, "You turn \the [src] [enabled ? "on" : "off"].") diff --git a/code/modules/xenoarcheaology/artifacts/autocloner.dm b/code/modules/xenoarcheaology/artifacts/autocloner.dm index e8ee5a16c1..1fa0cc6244 100644 --- a/code/modules/xenoarcheaology/artifacts/autocloner.dm +++ b/code/modules/xenoarcheaology/artifacts/autocloner.dm @@ -54,7 +54,7 @@ //if we've finished growing... if(time_spent_spawning >= time_per_spawn) time_spent_spawning = 0 - use_power = 1 + update_use_power(USE_POWER_IDLE) src.visible_message("\icon[src] [src] pings!") icon_state = "cellold1" desc = "It's full of a bubbling viscous liquid, and is lit by a mysterious glow." @@ -63,11 +63,11 @@ //if we're getting close to finished, kick into overdrive power usage if(time_spent_spawning / time_per_spawn > 0.75) - use_power = 2 + update_use_power(USE_POWER_ACTIVE) icon_state = "cellold2" desc = "It's full of a bubbling viscous liquid, and is lit by a mysterious glow. A dark shape appears to be forming inside..." else - use_power = 1 + update_use_power(USE_POWER_IDLE) icon_state = "cellold1" desc = "It's full of a bubbling viscous liquid, and is lit by a mysterious glow." diff --git a/code/modules/xenoarcheaology/artifacts/replicator.dm b/code/modules/xenoarcheaology/artifacts/replicator.dm index 9301ab4784..33f539fae1 100644 --- a/code/modules/xenoarcheaology/artifacts/replicator.dm +++ b/code/modules/xenoarcheaology/artifacts/replicator.dm @@ -104,7 +104,7 @@ max_spawn_time = rand(30,100) if(!spawning_types.len || !stored_materials.len) - use_power = 1 + update_use_power(USE_POWER_IDLE) icon_state = "borgcharger0(old)" else if(prob(5)) @@ -145,7 +145,7 @@ spawning_types.Add(construction[construction[index]]) spawn_progress_time = 0 - use_power = 2 + update_use_power(USE_POWER_ACTIVE) icon_state = "borgcharger1(old)" else src.visible_message(fail_message) diff --git a/code/modules/xenoarcheaology/tools/artifact_harvester.dm b/code/modules/xenoarcheaology/tools/artifact_harvester.dm index 480061f9bb..ee2feeabb3 100644 --- a/code/modules/xenoarcheaology/tools/artifact_harvester.dm +++ b/code/modules/xenoarcheaology/tools/artifact_harvester.dm @@ -80,7 +80,7 @@ //check if we've finished if(inserted_battery.stored_charge >= inserted_battery.capacity) - use_power = 1 + update_use_power(USE_POWER_IDLE) harvesting = 0 cur_artifact.anchored = 0 cur_artifact.being_used = 0 @@ -105,7 +105,7 @@ //if there's no charge left, finish if(inserted_battery.stored_charge <= 0) - use_power = 1 + update_use_power(USE_POWER_IDLE) inserted_battery.stored_charge = 0 harvesting = 0 if(inserted_battery.battery_effect && inserted_battery.battery_effect.activated) @@ -191,7 +191,7 @@ if(source_effect) harvesting = 1 - use_power = 2 + update_use_power(USE_POWER_ACTIVE) cur_artifact.anchored = 1 cur_artifact.being_used = 1 icon_state = "incubator_on" @@ -235,7 +235,7 @@ inserted_battery.battery_effect.ToggleActivate(1) last_process = world.time harvesting = -1 - use_power = 2 + update_use_power(USE_POWER_ACTIVE) icon_state = "incubator_on" var/message = "[src] states, \"Warning, battery charge dump commencing.\"" src.visible_message(message)