mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-17 10:16:23 +01:00
Merge pull request #7026 from VOREStation/vplk-update-power-usage
More machinery power update_var() proc usage
This commit is contained in:
@@ -301,7 +301,7 @@
|
||||
|
||||
last_change = world.time
|
||||
active = 1
|
||||
use_power = USE_POWER_ACTIVE
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
|
||||
for(var/item in holographic_objs)
|
||||
derez(item)
|
||||
@@ -362,7 +362,7 @@
|
||||
|
||||
last_gravity_change = world.time
|
||||
active = 1
|
||||
use_power = USE_POWER_IDLE
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
|
||||
if(A.has_gravity)
|
||||
A.gravitychange(0)
|
||||
@@ -377,4 +377,4 @@
|
||||
linkedholodeck.gravitychange(1)
|
||||
|
||||
active = 0
|
||||
use_power = USE_POWER_IDLE
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
/obj/machinery/proc/change_power_consumption(new_power_consumption, use_power_mode = USE_POWER_IDLE)
|
||||
switch(use_power_mode)
|
||||
if(USE_POWER_IDLE)
|
||||
idle_power_usage = new_power_consumption
|
||||
update_idle_power_usage(new_power_consumption)
|
||||
if(USE_POWER_ACTIVE)
|
||||
active_power_usage = new_power_consumption
|
||||
update_active_power_usage(new_power_consumption)
|
||||
// No need to do anything else in our power scheme.
|
||||
|
||||
// Defining directly here to avoid conflicts with existing set_broken procs in our codebase that behave differently.
|
||||
|
||||
@@ -60,7 +60,7 @@ var/list/fusion_cores = list()
|
||||
if(href_list["str"])
|
||||
var/dif = text2num(href_list["str"])
|
||||
field_strength = min(max(field_strength + dif, MIN_FIELD_STR), MAX_FIELD_STR)
|
||||
active_power_usage = 500 * field_strength
|
||||
update_active_power_usage(500 * field_strength)
|
||||
if(owned_field)
|
||||
owned_field.ChangeFieldStrength(field_strength)
|
||||
|
||||
@@ -96,7 +96,7 @@ var/list/fusion_cores = list()
|
||||
/obj/machinery/power/fusion_core/proc/set_strength(var/value)
|
||||
value = CLAMP(value, MIN_FIELD_STR, MAX_FIELD_STR)
|
||||
field_strength = value
|
||||
active_power_usage = 5 * value
|
||||
update_active_power_usage(5 * value)
|
||||
if(owned_field)
|
||||
owned_field.ChangeFieldStrength(value)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ var/list/gyrotrons = list()
|
||||
|
||||
/obj/machinery/power/emitter/gyrotron/Initialize()
|
||||
gyrotrons += src
|
||||
active_power_usage = mega_energy * 50000
|
||||
update_active_power_usage(mega_energy * 50000)
|
||||
default_apply_parts()
|
||||
. = ..()
|
||||
|
||||
@@ -31,7 +31,7 @@ var/list/gyrotrons = list()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/emitter/gyrotron/process()
|
||||
active_power_usage = mega_energy * 50000
|
||||
update_active_power_usage(mega_energy * 50000)
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/power/emitter/gyrotron/get_rand_burst_delay()
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
to_chat(usr, "<span class='warning'>That's not a valid number.</span>")
|
||||
return 1
|
||||
G.mega_energy = CLAMP(new_val, 1, 50)
|
||||
G.active_power_usage = G.mega_energy * 1500
|
||||
G.update_active_power_usage(G.mega_energy * 1500)
|
||||
updateUsrDialog()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -391,14 +391,14 @@ var/global/list/light_type_cache = list()
|
||||
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
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
emergency_mode = TRUE
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
set_light(0)
|
||||
|
||||
active_power_usage = ((light_range * light_power) * LIGHTING_POWER_FACTOR)
|
||||
update_active_power_usage((light_range * light_power) * LIGHTING_POWER_FACTOR)
|
||||
|
||||
|
||||
/obj/machinery/light/attack_generic(var/mob/user, var/damage)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
/obj/machinery/particle_accelerator/control_box/New()
|
||||
wires = new(src)
|
||||
connected_parts = list()
|
||||
active_power_usage = initial(active_power_usage) * (strength + 1)
|
||||
update_active_power_usage(initial(active_power_usage) * (strength + 1))
|
||||
..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Destroy()
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
var/tot_rating = 0
|
||||
for(var/obj/item/weapon/stock_parts/SP in src)
|
||||
tot_rating += SP.rating
|
||||
idle_power_usage /= max(1, tot_rating)
|
||||
update_idle_power_usage(initial(idle_power_usage) / max(1, tot_rating))
|
||||
|
||||
/obj/machinery/r_n_d/server/Initialize()
|
||||
. = ..()
|
||||
|
||||
@@ -153,9 +153,10 @@
|
||||
|
||||
create_shields()
|
||||
|
||||
idle_power_usage = 0
|
||||
var/new_power_usage = 0
|
||||
for(var/obj/machinery/shield/shield_tile in deployed_shields)
|
||||
idle_power_usage += shield_tile.shield_idle_power
|
||||
new_power_usage += shield_tile.shield_idle_power
|
||||
update_idle_power_usage(new_power_usage)
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
|
||||
/obj/machinery/shieldgen/proc/shields_down()
|
||||
@@ -205,7 +206,7 @@
|
||||
new_power_usage += shield_tile.shield_idle_power
|
||||
|
||||
if (new_power_usage != idle_power_usage)
|
||||
idle_power_usage = new_power_usage
|
||||
update_idle_power_usage(new_power_usage)
|
||||
use_power(0)
|
||||
|
||||
check_delay = 60
|
||||
|
||||
Reference in New Issue
Block a user