Speeds up area power usage handling, and apc process(). Cleans up related code (#51002)

About The Pull Request

/area/proc/usage() attempts to give list-like access to a bunch of vars. Why not make it a list instead and avoid all the proc calls? Might be room for followup here, to do something to powered(), use_power() etc.

Some legacy machinery was ignoring the default machinery use_power pulling from the machine's power channel by default

Total power usage was unused, APCs ignored it in favor of calculating it themselves :)

I also renamed the defines because they were in the danger zone of being very common words.
Changelog

cl Naksu
code: optimized area power usage calculations.
/cl
This commit is contained in:
vuonojenmustaturska
2020-05-11 11:33:56 +12:00
committed by GitHub
parent b9920f6caf
commit 5e1f57de77
34 changed files with 184 additions and 210 deletions
+6
View File
@@ -67,6 +67,11 @@
return
else
linked.linked = src
var/area/my_area = get_area(src)
if(my_area)
linked.power_usage = my_area.power_usage
else
linked.power_usage = new /list(AREA_USAGE_LEN)
generate_program_list()
load_program(offline_program, FALSE, FALSE)
@@ -75,6 +80,7 @@
emergency_shutdown()
if(linked)
linked.linked = null
linked.power_usage = new /list(AREA_USAGE_LEN)
return ..()
/obj/machinery/computer/holodeck/power_change()