Machinery: Always use update_use_power()

This commit is contained in:
Atermonera
2020-03-23 23:21:10 -04:00
committed by VirgoBot
parent f60a39dd4d
commit cbb40196fc
145 changed files with 1645 additions and 285 deletions
+3 -3
View File
@@ -5,7 +5,7 @@
icon_state = "control"
anchored = 1
density = 1
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 100
active_power_usage = 1000
@@ -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
+1 -1
View File
@@ -16,7 +16,7 @@ proc/cardinalrange(var/center)
anchored = 1
density = 1
dir = 1
use_power = 0//Living things generally dont use power
use_power = USE_POWER_OFF //Living things generally dont use power
idle_power_usage = 0
active_power_usage = 0
+1 -1
View File
@@ -67,7 +67,7 @@
plane = TURF_PLANE
layer = ABOVE_TURF_LAYER
anchored = 1
use_power = 0
use_power = USE_POWER_OFF
clicksound = "switch"
req_access = list(access_engine_equip)
var/area/area
+3 -3
View File
@@ -13,7 +13,7 @@ var/list/fusion_cores = list()
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "core0"
density = 1
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 50
active_power_usage = 500 //multiplied by field strength
anchored = 0
@@ -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)
@@ -7,7 +7,7 @@ var/list/fuel_injectors = list()
density = 1
anchored = 0
req_access = list(access_engine)
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 10
active_power_usage = 500
@@ -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)
@@ -6,7 +6,7 @@ var/list/gyrotrons = list()
desc = "It is a heavy duty industrial gyrotron suited for powering fusion reactors."
icon_state = "emitter-off"
req_access = list(access_engine)
use_power = 1
use_power = USE_POWER_IDLE
active_power_usage = 50000
circuit = /obj/item/weapon/circuitboard/gyrotron
+2 -2
View File
@@ -5,7 +5,7 @@
density = 1
anchored = 0
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 100 //Watts, I hope. Just enough to do the computer and display things.
var/max_power = 500000
@@ -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
+1 -1
View File
@@ -4,7 +4,7 @@
icon_state = "teg"
anchored = 1
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/obj/machinery/atmospherics/unary/generator_input/input1
var/obj/machinery/atmospherics/unary/generator_input/input2
+1 -1
View File
@@ -16,7 +16,7 @@
icon_state = "TheSingGen"
anchored = 1
density = 1
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 200
active_power_usage = 1000
var/on = 1
+3 -3
View File
@@ -212,7 +212,7 @@ var/global/list/light_type_cache = list()
anchored = 1
plane = MOB_PLANE
layer = ABOVE_MOB_LAYER
use_power = 2
use_power = USE_POWER_ACTIVE
idle_power_usage = 2
active_power_usage = 10
power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list
@@ -435,14 +435,14 @@ 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 if(has_emergency_power(LIGHT_EMERGENCY_POWER_USE) && !turned_off())
use_power = 1
emergency_mode = TRUE
START_PROCESSING(SSobj, src)
else
use_power = 1
update_use_power(USE_POWER_IDLE)
set_light(0)
active_power_usage = ((light_range * light_power) * LIGHTING_POWER_FACTOR)
+1 -1
View File
@@ -6,7 +6,7 @@
icon_state = "portgen0"
density = 1
anchored = 0
use_power = 0
use_power = USE_POWER_OFF
var/active = 0
var/power_gen = 5000
+1 -1
View File
@@ -11,7 +11,7 @@
icon = 'icons/obj/power.dmi'
anchored = 1.0
var/datum/powernet/powernet = null
use_power = 0
use_power = USE_POWER_OFF
idle_power_usage = 0
active_power_usage = 0
@@ -15,7 +15,7 @@
anchored = 1.0
circuit = /obj/item/weapon/circuitboard/powermonitor
var/alerting = 0
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 300
active_power_usage = 300
var/datum/nano_module/power_monitor/power_monitor
@@ -8,7 +8,7 @@
anchored = 1
density = 0
unacidable = 1
use_power = 0
use_power = USE_POWER_OFF
light_range = 4
flags = PROXMOVE
var/obj/machinery/field_generator/FG1 = null
+1 -1
View File
@@ -10,7 +10,7 @@
req_access = list(access_engine_equip)
var/id = null
use_power = 0 //uses powernet power, not APC power
use_power = USE_POWER_OFF //uses powernet power, not APC power
active_power_usage = 30000 //30 kW laser. I guess that means 30 kJ per shot.
var/active = 0
@@ -20,7 +20,7 @@ field_generator power level display
icon_state = "Field_Gen"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/const/num_power_levels = 6 // Total number of power level icon has
var/Varedit_start = 0
var/Varpower = 0
+1 -1
View File
@@ -6,7 +6,7 @@
icon_state = "TheSingGen"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/energy = 0
var/creation_type = /obj/singularity
@@ -258,7 +258,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
icon_state = "none"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
idle_power_usage = 0
active_power_usage = 0
var/construction_state = 0
@@ -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
@@ -8,7 +8,7 @@
reference = "control_box"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
idle_power_usage = 500
active_power_usage = 70000 //70 kW per unit of strength
construction_state = 0
@@ -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
@@ -9,7 +9,7 @@
icon_state = "smasher"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/successful_craft = FALSE // Are we waiting to be emptied?
var/image/material_layer // Holds the image used for the filled overlay.
+1 -1
View File
@@ -11,7 +11,7 @@
icon_state = "smes"
density = 1
anchored = 1
use_power = 0
use_power = USE_POWER_OFF
circuit = /obj/item/weapon/circuitboard/smes
clicksound = "switch"
+2 -2
View File
@@ -13,7 +13,7 @@ GLOBAL_LIST_EMPTY(solars_list)
icon_state = "sp_base"
anchored = 1
density = 1
use_power = 0
use_power = USE_POWER_OFF
idle_power_usage = 0
active_power_usage = 0
var/id = 0
@@ -285,7 +285,7 @@ GLOBAL_LIST_EMPTY(solars_list)
icon_state = "solar"
anchored = 1
density = 1
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 250
var/id = 0
var/cdir = 0
@@ -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
+1 -1
View File
@@ -10,7 +10,7 @@
icon_state = "tracker"
anchored = 1
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/id = 0
var/sun_angle = 0 // sun angle as set by sun datum