Always call update_use_power() instead of directly setting the use_power var.

- This will let us react to the change appropriately.
- While we're here, lets define some constants so we can stop using bare numbers.
- Always use those constants when calling update_use_power()
This commit is contained in:
Leshana
2020-03-19 22:45:40 -04:00
parent efeaf058ff
commit c2d16acdca
52 changed files with 124 additions and 119 deletions

View File

@@ -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"])

View File

@@ -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")

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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()
..()

View File

@@ -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

View File

@@ -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"])

View File

@@ -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"])

View File

@@ -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, "<span class='notice'>You toggle \the [src].</span>")
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)

View File

@@ -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")

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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.")

View File

@@ -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.

View File

@@ -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

View File

@@ -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()

View File

@@ -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()

View File

@@ -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("<span class='notice'>\The [user] turns \the [src] [on ? "on" : "off"].</span>")
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)

View File

@@ -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()

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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("<span class='notice'>\The [contained] rapidly retracts back into \the [src]!</span>")
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("<span class='notice'>\The [contained] rapidly retracts back into \the [src]!</span>")
breather = null
use_power = 1
update_use_power(USE_POWER_IDLE)
else if(!breather.internal && tank)
breather.internal = tank
if(breather.internals)

View File

@@ -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)

View File

@@ -115,7 +115,7 @@ Please wait until completion...</TT><BR>
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...</TT><BR>
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

View File

@@ -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, "<span class='warning'>\The [src] has used up its charge.</span>")
return

View File

@@ -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("<span class='notice'>Teleporter engaged!</span>", 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("<span class='notice'>Teleporter disengaged!</span>", 2)
add_fingerprint(usr)

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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)

View File

@@ -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, "<span class='warning'>The holomap failed to initialize. This area of space cannot be mapped.</span>")
@@ -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()
. = ..()

View File

@@ -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"

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",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

View File

@@ -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

View File

@@ -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

View File

@@ -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))

View File

@@ -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"].")

View File

@@ -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("<span class='notice'>\icon[src] [src] pings!</span>")
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."

View File

@@ -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)

View File

@@ -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 = "<b>[src]</b> states, \"Warning, battery charge dump commencing.\""
src.visible_message(message)