mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 02:24:11 +01:00
Process and Process Scheduler Tweaks
This commit is contained in:
@@ -15,9 +15,17 @@ var/global/datum/controller/process/air_system/air_master
|
||||
var/failed_ticks = 0
|
||||
var/tick_progress = 0
|
||||
|
||||
// Stats
|
||||
var/last_active = 0
|
||||
var/last_excited = 0
|
||||
var/last_hpd = 0
|
||||
var/last_hotspots = 0
|
||||
var/last_asc = 0
|
||||
|
||||
/datum/controller/process/air_system/setup()
|
||||
name = "air"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
start_delay = 4
|
||||
air_master = src
|
||||
|
||||
world << "<span class='danger'>Processing Geometry...</span>"
|
||||
@@ -32,30 +40,41 @@ var/global/datum/controller/process/air_system/air_master
|
||||
current_cycle++
|
||||
process_active_turfs()
|
||||
process_excited_groups()
|
||||
scheck()
|
||||
process_high_pressure_delta()
|
||||
process_hotspots()
|
||||
process_super_conductivity()
|
||||
scheck()
|
||||
return 1
|
||||
|
||||
/datum/controller/process/air_system/statProcess()
|
||||
..()
|
||||
stat(null, "[last_active] active")
|
||||
stat(null, "[last_excited] EG|[last_hpd] HPD|[last_asc] ASC|[last_hotspots] Hot")
|
||||
|
||||
/datum/controller/process/air_system/proc/process_hotspots()
|
||||
last_hotspots = hotspots.len
|
||||
for(var/obj/effect/hotspot/H in hotspots)
|
||||
H.process()
|
||||
scheck()
|
||||
|
||||
/datum/controller/process/air_system/proc/process_super_conductivity()
|
||||
last_asc = active_super_conductivity.len
|
||||
for(var/turf/simulated/T in active_super_conductivity)
|
||||
T.super_conduct()
|
||||
scheck()
|
||||
|
||||
/datum/controller/process/air_system/proc/process_high_pressure_delta()
|
||||
last_hpd = high_pressure_delta.len
|
||||
for(var/turf/T in high_pressure_delta)
|
||||
T.high_pressure_movements()
|
||||
T.pressure_difference = 0
|
||||
high_pressure_delta.len = 0
|
||||
scheck()
|
||||
high_pressure_delta.Cut()
|
||||
|
||||
/datum/controller/process/air_system/proc/process_active_turfs()
|
||||
last_active = active_turfs.len
|
||||
for(var/turf/simulated/T in active_turfs)
|
||||
T.process_cell()
|
||||
scheck()
|
||||
|
||||
/datum/controller/process/air_system/proc/remove_from_active(var/turf/simulated/T)
|
||||
if(istype(T))
|
||||
@@ -100,6 +119,7 @@ var/global/datum/controller/process/air_system/air_master
|
||||
active_turfs |= T
|
||||
|
||||
/datum/controller/process/air_system/proc/process_excited_groups()
|
||||
last_excited = excited_groups.len
|
||||
for(var/datum/excited_group/EG in excited_groups)
|
||||
EG.breakdown_cooldown ++
|
||||
if(EG.breakdown_cooldown == 10)
|
||||
@@ -107,6 +127,7 @@ var/global/datum/controller/process/air_system/air_master
|
||||
return
|
||||
if(EG.breakdown_cooldown > 20)
|
||||
EG.dismantle()
|
||||
scheck()
|
||||
|
||||
/datum/controller/process/air_system/proc/setup_overlays()
|
||||
plmaster = new /obj/effect/overlay()
|
||||
|
||||
@@ -1,20 +1,28 @@
|
||||
/datum/controller/process/bot
|
||||
var/tmp/datum/updateQueue/updateQueueInstance
|
||||
|
||||
/datum/controller/process/bot/setup()
|
||||
name = "bot"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
updateQueueInstance = new
|
||||
|
||||
/datum/controller/process/bot/started()
|
||||
..()
|
||||
if(!updateQueueInstance)
|
||||
if(!aibots)
|
||||
aibots = list()
|
||||
else if(aibots.len)
|
||||
updateQueueInstance = new
|
||||
if(!aibots)
|
||||
aibots = list()
|
||||
|
||||
/datum/controller/process/bot/statProcess()
|
||||
..()
|
||||
stat(null, "[aibots && aibots.len] bots")
|
||||
|
||||
/datum/controller/process/bot/doWork()
|
||||
if(updateQueueInstance)
|
||||
updateQueueInstance.init(aibots, "bot_process")
|
||||
updateQueueInstance.Run()
|
||||
for(var/obj/machinery/bot/B in aibots)
|
||||
if(istype(B) && isnull(B.gcDestroyed))
|
||||
// Some bots sleep when they process, but there's not many bots, so just spawn them off
|
||||
spawn(-1)
|
||||
try
|
||||
B.bot_process()
|
||||
catch(var/exception/e)
|
||||
catchException(e, B)
|
||||
// Use src explicitly after a try/catch, or BYOND messes src up. I have no idea why.
|
||||
src.scheck()
|
||||
else
|
||||
aibots -= B
|
||||
@@ -1,11 +0,0 @@
|
||||
/datum/controller/process/disease
|
||||
var/tmp/datum/updateQueue/updateQueueInstance
|
||||
|
||||
/datum/controller/process/disease/setup()
|
||||
name = "disease"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
updateQueueInstance = new
|
||||
|
||||
/datum/controller/process/disease/doWork()
|
||||
updateQueueInstance.init(active_diseases, "process")
|
||||
updateQueueInstance.Run()
|
||||
@@ -1,5 +1,5 @@
|
||||
/datum/controller/process/emergencyShuttle/setup()
|
||||
name = "emergency shuttle"
|
||||
name = "e-shuttle"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
|
||||
if(!emergency_shuttle)
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
/datum/controller/process/garbage/setup()
|
||||
/datum/controller/process/garbage_collector/setup()
|
||||
name = "garbage"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
|
||||
if(!garbageCollector)
|
||||
garbageCollector = new
|
||||
garbageCollector = src
|
||||
|
||||
/datum/controller/process/garbage/doWork()
|
||||
garbageCollector.process()
|
||||
scheck()
|
||||
/datum/controller/process/garbage_collector/doWork()
|
||||
// Garbage collection code can be found in code\modules\garbage collection\garbage_collector.dm
|
||||
processGarbage()
|
||||
|
||||
/datum/controller/process/garbage_collector/statProcess()
|
||||
..()
|
||||
stat(null, "[del_everything ? "Off" : "On"], [queue.len] queued")
|
||||
stat(null, "Dels: [dels_count], [soft_dels] soft, [hard_dels] hard")
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
var/global/datum/controller/process/lighting/lighting_controller
|
||||
|
||||
/datum/controller/process/lighting/setup()
|
||||
name = "lighting"
|
||||
schedule_interval = LIGHTING_INTERVAL
|
||||
start_delay = 1
|
||||
lighting_controller = src
|
||||
|
||||
create_lighting_overlays()
|
||||
|
||||
/datum/controller/process/lighting/statProcess()
|
||||
..()
|
||||
stat(null, "[last_light_count] lights, [last_overlay_count] overlays")
|
||||
|
||||
// Lighting process code located in modules\lighting\lighting_process.dm
|
||||
@@ -1,6 +1,12 @@
|
||||
/datum/controller/process/machinery/setup()
|
||||
name = "machinery"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
start_delay = 12
|
||||
|
||||
/datum/controller/process/machinery/statProcess()
|
||||
..()
|
||||
stat(null, "[machines.len] machines")
|
||||
stat(null, "[powernets.len] powernets")
|
||||
|
||||
/datum/controller/process/machinery/doWork()
|
||||
process_power()
|
||||
@@ -13,13 +19,16 @@
|
||||
var/time_start = world.timeofday
|
||||
#endif
|
||||
|
||||
if(M.process() == PROCESS_KILL)
|
||||
//M.inMachineList = 0 We don't use this debugging function
|
||||
machines.Remove(M)
|
||||
continue
|
||||
try
|
||||
if(M.process() == PROCESS_KILL)
|
||||
//M.inMachineList = 0 We don't use this debugging function
|
||||
machines.Remove(M)
|
||||
continue
|
||||
|
||||
if(M && M.use_power)
|
||||
M.auto_use_power()
|
||||
if(M && M.use_power)
|
||||
M.auto_use_power()
|
||||
catch(var/exception/e)
|
||||
catchException(e, M)
|
||||
|
||||
#ifdef PROFILE_MACHINES
|
||||
var/time_end = world.timeofday
|
||||
@@ -37,8 +46,12 @@
|
||||
/datum/controller/process/machinery/proc/process_power()
|
||||
for(var/datum/powernet/powerNetwork in powernets)
|
||||
if(istype(powerNetwork) && isnull(powerNetwork.gcDestroyed))
|
||||
powerNetwork.reset()
|
||||
scheck()
|
||||
try
|
||||
powerNetwork.reset()
|
||||
catch(var/exception/e)
|
||||
catchException(e, powerNetwork)
|
||||
// Use src explicitly after a try/catch, or BYOND messes src up. I have no idea why.
|
||||
src.scheck()
|
||||
continue
|
||||
else
|
||||
powernets -= powerNetwork
|
||||
|
||||
@@ -1,27 +1,34 @@
|
||||
/datum/controller/process/mob
|
||||
var/tmp/datum/updateQueue/updateQueueInstance
|
||||
|
||||
/datum/controller/process/mob/setup()
|
||||
name = "mob"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
updateQueueInstance = new
|
||||
start_delay = 16
|
||||
if(!mob_master)
|
||||
mob_master = new
|
||||
mob_master.Setup()
|
||||
|
||||
/datum/controller/process/mob/started()
|
||||
..()
|
||||
if(!updateQueueInstance)
|
||||
if(!mob_list)
|
||||
mob_list = list()
|
||||
else if(mob_list.len)
|
||||
updateQueueInstance = new
|
||||
if(!mob_list)
|
||||
mob_list = list()
|
||||
|
||||
/datum/controller/process/mob/statProcess()
|
||||
..()
|
||||
stat(null, "[mob_list.len] mobs")
|
||||
|
||||
/datum/controller/process/mob/doWork()
|
||||
if(updateQueueInstance)
|
||||
updateQueueInstance.init(mob_list, "Life")
|
||||
updateQueueInstance.Run()
|
||||
mob_master.process()
|
||||
for(var/mob/M in mob_list)
|
||||
if(istype(M) && isnull(M.gcDestroyed))
|
||||
try
|
||||
M.Life()
|
||||
catch(var/exception/e)
|
||||
catchException(e, M)
|
||||
// Use src explicitly after a try/catch, or BYOND messes src up. I have no idea why.
|
||||
src.scheck()
|
||||
else
|
||||
mob_list -= M
|
||||
mob_master.process()
|
||||
|
||||
var/global/datum/controller/mob_system/mob_master
|
||||
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
/datum/controller/process/nanoui
|
||||
var/tmp/datum/updateQueue/updateQueueInstance
|
||||
|
||||
/datum/controller/process/nanoui/setup()
|
||||
name = "nanoui"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
updateQueueInstance = new
|
||||
|
||||
/datum/controller/process/nanoui/statProcess()
|
||||
..()
|
||||
stat(null, "[nanomanager.processing_uis.len] UIs")
|
||||
|
||||
/datum/controller/process/nanoui/doWork()
|
||||
updateQueueInstance.init(nanomanager.processing_uis, "process")
|
||||
updateQueueInstance.Run()
|
||||
for(var/datum/nanoui/NUI in nanomanager.processing_uis)
|
||||
if(istype(NUI) && isnull(NUI.gcDestroyed))
|
||||
try
|
||||
NUI.process()
|
||||
catch(var/exception/e)
|
||||
catchException(e, NUI)
|
||||
else
|
||||
nanomanager.processing_uis -= NUI
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
var/global/list/object_profiling = list()
|
||||
/datum/controller/process/obj
|
||||
var/tmp/datum/updateQueue/updateQueueInstance
|
||||
|
||||
/datum/controller/process/obj/setup()
|
||||
name = "obj"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
updateQueueInstance = new
|
||||
start_delay = 8
|
||||
|
||||
/datum/controller/process/obj/started()
|
||||
..()
|
||||
if(!updateQueueInstance)
|
||||
if(!processing_objects)
|
||||
processing_objects = list()
|
||||
else if(processing_objects.len)
|
||||
updateQueueInstance = new
|
||||
if(!processing_objects)
|
||||
processing_objects = list()
|
||||
|
||||
/datum/controller/process/obj/statProcess()
|
||||
..()
|
||||
stat(null, "[processing_objects.len] objects")
|
||||
|
||||
/datum/controller/process/obj/doWork()
|
||||
if(updateQueueInstance)
|
||||
updateQueueInstance.init(processing_objects, "process")
|
||||
updateQueueInstance.Run()
|
||||
for(var/obj/O in processing_objects)
|
||||
if(istype(O) && isnull(O.gcDestroyed))
|
||||
try
|
||||
O.process()
|
||||
catch(var/exception/e)
|
||||
catchException(e, O)
|
||||
// Use src explicitly after a try/catch, or BYOND messes src up. I have no idea why.
|
||||
src.scheck()
|
||||
else
|
||||
processing_objects -= O
|
||||
@@ -1,12 +1,21 @@
|
||||
/datum/controller/process/pipenet/setup()
|
||||
name = "pipenet"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
start_delay = 18
|
||||
|
||||
/datum/controller/process/pipenet/statProcess()
|
||||
..()
|
||||
stat(null, "[pipe_networks.len] pipe nets")
|
||||
|
||||
/datum/controller/process/pipenet/doWork()
|
||||
for(var/datum/pipe_network/pipeNetwork in pipe_networks)
|
||||
if(istype(pipeNetwork) && isnull(pipeNetwork.gcDestroyed))
|
||||
pipeNetwork.process()
|
||||
scheck()
|
||||
try
|
||||
pipeNetwork.process()
|
||||
catch(var/exception/e)
|
||||
catchException(e, pipeNetwork)
|
||||
// Use src explicitly after a try/catch, or BYOND messes src up. I have no idea why.
|
||||
src.scheck()
|
||||
continue
|
||||
else
|
||||
pipe_networks -= pipeNetwork
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/datum/controller/process/Shuttle/setup()
|
||||
name = "shuttle controller"
|
||||
name = "shuttle"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
|
||||
if(!shuttle_controller)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/datum/controller/process/supply/setup()
|
||||
name = "supply controller"
|
||||
name = "supply"
|
||||
schedule_interval = 300 // every 30 seconds
|
||||
|
||||
/datum/controller/process/supply/doWork()
|
||||
|
||||
Reference in New Issue
Block a user