mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 05:23:22 +01:00
machinery_process() & auto_use_power efficiency tweaks (#2657)
changes: Machinery now uses machinery_process() instead of process(), allowing machines to be put into SSprocessing-style lists in addition to the machinery list. Automatic power calculations now involve less proc-calls.
This commit is contained in:
@@ -74,8 +74,8 @@
|
||||
sortTim(cameranet.cameras, /proc/cmp_camera)
|
||||
cameranet.cameras_unsorted = FALSE
|
||||
|
||||
var/list/curr_machinery = src.processing_machinery
|
||||
var/list/curr_powersinks = src.processing_powersinks
|
||||
var/list/curr_machinery = processing_machinery
|
||||
var/list/curr_powersinks = processing_powersinks
|
||||
|
||||
while (curr_machinery.len)
|
||||
var/obj/machinery/M = curr_machinery[curr_machinery.len]
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
if (M.machinery_processing)
|
||||
processes_this_tick++
|
||||
switch (M.process())
|
||||
switch (M.machinery_process())
|
||||
if (PROCESS_KILL)
|
||||
remove_machine(M)
|
||||
if (M_NO_PROCESS)
|
||||
@@ -99,12 +99,26 @@
|
||||
if (start_tick != world.time)
|
||||
// Slept.
|
||||
if (!slept_in_process[M.type])
|
||||
log_debug("SSmachinery: Type '[M.type]' slept during process().")
|
||||
log_debug("SSmachinery: Type '[M.type]' slept during machinery_process().")
|
||||
slept_in_process[M.type] = TRUE
|
||||
|
||||
if (M.use_power)
|
||||
powerusers_this_tick++
|
||||
M.auto_use_power()
|
||||
if (M.has_special_power_checks)
|
||||
M.auto_use_power()
|
||||
else
|
||||
var/area/A = M.loc ? M.loc.loc : null
|
||||
if (isarea(A))
|
||||
var/chan = M.power_channel
|
||||
if (A.powered(chan))
|
||||
var/usage = 0
|
||||
switch (M.use_power)
|
||||
if (1)
|
||||
usage = M.idle_power_usage
|
||||
if (2)
|
||||
usage = M.active_power_usage
|
||||
|
||||
A.use_power(usage, chan)
|
||||
|
||||
if (no_mc_tick)
|
||||
CHECK_TICK
|
||||
|
||||
Reference in New Issue
Block a user