From 302e8212b7deb1fd03b46ddc5923fd380bc76504 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Mon, 30 Mar 2020 12:02:22 -0400 Subject: [PATCH 1/4] Add Recover() to processing subsystems --- .../subsystems/processing/chemistry.dm | 6 ++++++ .../subsystems/processing/fastprocess.dm | 7 +++++++ code/controllers/subsystems/processing/obj.dm | 7 +++++++ .../subsystems/processing/processing.dm | 21 ++++++++++++++----- .../subsystems/processing/projectiles.dm | 7 +++++++ .../subsystems/processing/turfs.dm | 7 +++++++ 6 files changed, 50 insertions(+), 5 deletions(-) diff --git a/code/controllers/subsystems/processing/chemistry.dm b/code/controllers/subsystems/processing/chemistry.dm index 34094f9fe3..129cd827e8 100644 --- a/code/controllers/subsystems/processing/chemistry.dm +++ b/code/controllers/subsystems/processing/chemistry.dm @@ -8,6 +8,12 @@ PROCESSING_SUBSYSTEM_DEF(chemistry) var/list/chemical_reagents = list() /datum/controller/subsystem/processing/chemistry/Recover() + log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSchemistry.current_thing])[SSchemistry.current_thing]([SSchemistry.current_thing.type]) - currentrun: [SSchemistry.currentrun.len] vs total: [SSchemistry.processing.len]") + var/list/old_processing = SSchemistry.processing.Copy() + for(var/datum/D in old_processing) + if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) + processing |= D + chemical_reactions = SSchemistry.chemical_reactions chemical_reagents = SSchemistry.chemical_reagents diff --git a/code/controllers/subsystems/processing/fastprocess.dm b/code/controllers/subsystems/processing/fastprocess.dm index 9622e02146..8626b21752 100644 --- a/code/controllers/subsystems/processing/fastprocess.dm +++ b/code/controllers/subsystems/processing/fastprocess.dm @@ -4,3 +4,10 @@ PROCESSING_SUBSYSTEM_DEF(fastprocess) name = "Fast Processing" wait = 2 stat_tag = "FP" + +/datum/controller/subsystem/processing/fastprocess/Recover() + log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSfastprocess.current_thing])[SSfastprocess.current_thing]([SSfastprocess.current_thing.type]) - currentrun: [SSfastprocess.currentrun.len] vs total: [SSfastprocess.processing.len]") + var/list/old_processing = SSfastprocess.processing.Copy() + for(var/datum/D in old_processing) + if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) + processing |= D \ No newline at end of file diff --git a/code/controllers/subsystems/processing/obj.dm b/code/controllers/subsystems/processing/obj.dm index 26021fb267..86c8ecf18d 100644 --- a/code/controllers/subsystems/processing/obj.dm +++ b/code/controllers/subsystems/processing/obj.dm @@ -3,3 +3,10 @@ PROCESSING_SUBSYSTEM_DEF(obj) priority = FIRE_PRIORITY_OBJ flags = SS_NO_INIT wait = 20 + +/datum/controller/subsystem/processing/obj/Recover() + log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSobj.current_thing])[SSobj.current_thing]([SSobj.current_thing.type]) - currentrun: [SSobj.currentrun.len] vs total: [SSobj.processing.len]") + var/list/old_processing = SSobj.processing.Copy() + for(var/datum/D in old_processing) + if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) + processing |= D \ No newline at end of file diff --git a/code/controllers/subsystems/processing/processing.dm b/code/controllers/subsystems/processing/processing.dm index ef54b8a4ab..0d4d157b7f 100644 --- a/code/controllers/subsystems/processing/processing.dm +++ b/code/controllers/subsystems/processing/processing.dm @@ -13,6 +13,14 @@ SUBSYSTEM_DEF(processing) var/debug_last_thing var/debug_original_process_proc // initial() does not work with procs + var/datum/current_thing + +/datum/controller/subsystem/processing/Recover() + log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSprocessing.current_thing])[SSprocessing.current_thing]([SSprocessing.current_thing.type]) - currentrun: [SSprocessing.currentrun.len] vs total: [SSprocessing.processing.len]") + var/list/old_processing = SSprocessing.processing.Copy() + for(var/datum/D in old_processing) + if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) + processing |= D /datum/controller/subsystem/processing/stat_entry() ..("[stat_tag]:[processing.len]") @@ -24,16 +32,19 @@ SUBSYSTEM_DEF(processing) var/list/current_run = currentrun while(current_run.len) - var/datum/thing = current_run[current_run.len] + current_thing = current_run[current_run.len] current_run.len-- - if(QDELETED(thing)) - processing -= thing - else if(thing.process(wait) == PROCESS_KILL) + if(QDELETED(current_thing)) + processing -= current_thing + else if(current_thing.process(wait) == PROCESS_KILL) // fully stop so that a future START_PROCESSING will work - STOP_PROCESSING(src, thing) + STOP_PROCESSING(src, current_thing) if (MC_TICK_CHECK) + current_thing = null return + current_thing = null + /datum/controller/subsystem/processing/proc/toggle_debug() if(!check_rights(R_DEBUG)) return diff --git a/code/controllers/subsystems/processing/projectiles.dm b/code/controllers/subsystems/processing/projectiles.dm index 87c9f097de..c6a7d7ec1a 100644 --- a/code/controllers/subsystems/processing/projectiles.dm +++ b/code/controllers/subsystems/processing/projectiles.dm @@ -8,6 +8,13 @@ PROCESSING_SUBSYSTEM_DEF(projectiles) var/global_pixel_speed = 2 var/global_iterations_per_move = 16 +/datum/controller/subsystem/processing/projectiles/Recover() + log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSprojectiles.current_thing])[SSprojectiles.current_thing]([SSprojectiles.current_thing.type]) - currentrun: [SSprojectiles.currentrun.len] vs total: [SSprojectiles.processing.len]") + var/list/old_processing = SSprojectiles.processing.Copy() + for(var/datum/D in old_processing) + if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) + processing |= D + /datum/controller/subsystem/processing/projectiles/proc/set_pixel_speed(new_speed) global_pixel_speed = new_speed for(var/i in processing) diff --git a/code/controllers/subsystems/processing/turfs.dm b/code/controllers/subsystems/processing/turfs.dm index 941513527e..95265333de 100644 --- a/code/controllers/subsystems/processing/turfs.dm +++ b/code/controllers/subsystems/processing/turfs.dm @@ -1,3 +1,10 @@ PROCESSING_SUBSYSTEM_DEF(turfs) name = "Turf Processing" wait = 20 + +/datum/controller/subsystem/processing/turfs/Recover() + log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSturfs.current_thing])[SSturfs.current_thing]([SSturfs.current_thing.type]) - currentrun: [SSturfs.currentrun.len] vs total: [SSturfs.processing.len]") + var/list/old_processing = SSturfs.processing.Copy() + for(var/datum/D in old_processing) + if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) + processing |= D \ No newline at end of file From 5262e97d9759921d6f7f2485f4ff557e270c831c Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Mon, 30 Mar 2020 12:14:53 -0400 Subject: [PATCH 2/4] Tweak output and check SSobjs and SSturfs for types --- code/controllers/subsystems/processing/chemistry.dm | 4 +++- code/controllers/subsystems/processing/fastprocess.dm | 4 +++- code/controllers/subsystems/processing/obj.dm | 6 +++++- code/controllers/subsystems/processing/processing.dm | 4 +++- code/controllers/subsystems/processing/projectiles.dm | 4 +++- code/controllers/subsystems/processing/turfs.dm | 6 +++++- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/code/controllers/subsystems/processing/chemistry.dm b/code/controllers/subsystems/processing/chemistry.dm index 129cd827e8..7f4fd9c42b 100644 --- a/code/controllers/subsystems/processing/chemistry.dm +++ b/code/controllers/subsystems/processing/chemistry.dm @@ -8,7 +8,9 @@ PROCESSING_SUBSYSTEM_DEF(chemistry) var/list/chemical_reagents = list() /datum/controller/subsystem/processing/chemistry/Recover() - log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSchemistry.current_thing])[SSchemistry.current_thing]([SSchemistry.current_thing.type]) - currentrun: [SSchemistry.currentrun.len] vs total: [SSchemistry.processing.len]") + log_debug("[name] subsystem Recover().") + if(SSchemistry.current_thing) + log_debug("current_thing was: (\ref[SSchemistry.current_thing])[SSchemistry.current_thing]([SSchemistry.current_thing.type]) - currentrun: [SSchemistry.currentrun.len] vs total: [SSchemistry.processing.len]") var/list/old_processing = SSchemistry.processing.Copy() for(var/datum/D in old_processing) if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) diff --git a/code/controllers/subsystems/processing/fastprocess.dm b/code/controllers/subsystems/processing/fastprocess.dm index 8626b21752..bda0bb6fb6 100644 --- a/code/controllers/subsystems/processing/fastprocess.dm +++ b/code/controllers/subsystems/processing/fastprocess.dm @@ -6,7 +6,9 @@ PROCESSING_SUBSYSTEM_DEF(fastprocess) stat_tag = "FP" /datum/controller/subsystem/processing/fastprocess/Recover() - log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSfastprocess.current_thing])[SSfastprocess.current_thing]([SSfastprocess.current_thing.type]) - currentrun: [SSfastprocess.currentrun.len] vs total: [SSfastprocess.processing.len]") + log_debug("[name] subsystem Recover().") + if(SSfastprocess.current_thing) + log_debug("current_thing was: (\ref[SSfastprocess.current_thing])[SSfastprocess.current_thing]([SSfastprocess.current_thing.type]) - currentrun: [SSfastprocess.currentrun.len] vs total: [SSfastprocess.processing.len]") var/list/old_processing = SSfastprocess.processing.Copy() for(var/datum/D in old_processing) if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) diff --git a/code/controllers/subsystems/processing/obj.dm b/code/controllers/subsystems/processing/obj.dm index 86c8ecf18d..37f3acc7c6 100644 --- a/code/controllers/subsystems/processing/obj.dm +++ b/code/controllers/subsystems/processing/obj.dm @@ -5,8 +5,12 @@ PROCESSING_SUBSYSTEM_DEF(obj) wait = 20 /datum/controller/subsystem/processing/obj/Recover() - log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSobj.current_thing])[SSobj.current_thing]([SSobj.current_thing.type]) - currentrun: [SSobj.currentrun.len] vs total: [SSobj.processing.len]") + log_debug("[name] subsystem Recover().") + if(SSobj.current_thing) + log_debug("current_thing was: (\ref[SSobj.current_thing])[SSobj.current_thing]([SSobj.current_thing.type]) - currentrun: [SSobj.currentrun.len] vs total: [SSobj.processing.len]") var/list/old_processing = SSobj.processing.Copy() for(var/datum/D in old_processing) + if(!isobj(D)) + log_debug("[name] subsystem Recover() found inappropriate item in list: [D.type]") if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) processing |= D \ No newline at end of file diff --git a/code/controllers/subsystems/processing/processing.dm b/code/controllers/subsystems/processing/processing.dm index 0d4d157b7f..3eeff489aa 100644 --- a/code/controllers/subsystems/processing/processing.dm +++ b/code/controllers/subsystems/processing/processing.dm @@ -16,7 +16,9 @@ SUBSYSTEM_DEF(processing) var/datum/current_thing /datum/controller/subsystem/processing/Recover() - log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSprocessing.current_thing])[SSprocessing.current_thing]([SSprocessing.current_thing.type]) - currentrun: [SSprocessing.currentrun.len] vs total: [SSprocessing.processing.len]") + log_debug("[name] subsystem Recover().") + if(SSprocessing.current_thing) + log_debug("current_thing was: (\ref[SSprocessing.current_thing])[SSprocessing.current_thing]([SSprocessing.current_thing.type]) - currentrun: [SSprocessing.currentrun.len] vs total: [SSprocessing.processing.len]") var/list/old_processing = SSprocessing.processing.Copy() for(var/datum/D in old_processing) if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) diff --git a/code/controllers/subsystems/processing/projectiles.dm b/code/controllers/subsystems/processing/projectiles.dm index c6a7d7ec1a..e4316304ce 100644 --- a/code/controllers/subsystems/processing/projectiles.dm +++ b/code/controllers/subsystems/processing/projectiles.dm @@ -9,7 +9,9 @@ PROCESSING_SUBSYSTEM_DEF(projectiles) var/global_iterations_per_move = 16 /datum/controller/subsystem/processing/projectiles/Recover() - log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSprojectiles.current_thing])[SSprojectiles.current_thing]([SSprojectiles.current_thing.type]) - currentrun: [SSprojectiles.currentrun.len] vs total: [SSprojectiles.processing.len]") + log_debug("[name] subsystem Recover().") + if(SSprojectiles.current_thing) + log_debug("current_thing was: (\ref[SSprojectiles.current_thing])[SSprojectiles.current_thing]([SSprojectiles.current_thing.type]) - currentrun: [SSprojectiles.currentrun.len] vs total: [SSprojectiles.processing.len]") var/list/old_processing = SSprojectiles.processing.Copy() for(var/datum/D in old_processing) if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) diff --git a/code/controllers/subsystems/processing/turfs.dm b/code/controllers/subsystems/processing/turfs.dm index 95265333de..d28f4b4809 100644 --- a/code/controllers/subsystems/processing/turfs.dm +++ b/code/controllers/subsystems/processing/turfs.dm @@ -3,8 +3,12 @@ PROCESSING_SUBSYSTEM_DEF(turfs) wait = 20 /datum/controller/subsystem/processing/turfs/Recover() - log_debug("[name] subsystem Recover(). current_thing was: (\ref[SSturfs.current_thing])[SSturfs.current_thing]([SSturfs.current_thing.type]) - currentrun: [SSturfs.currentrun.len] vs total: [SSturfs.processing.len]") + log_debug("[name] subsystem Recover().") + if(SSturfs.current_thing) + log_debug("current_thing was: (\ref[SSturfs.current_thing])[SSturfs.current_thing]([SSturfs.current_thing.type]) - currentrun: [SSturfs.currentrun.len] vs total: [SSturfs.processing.len]") var/list/old_processing = SSturfs.processing.Copy() for(var/datum/D in old_processing) + if(!isturf(D)) + log_debug("[name] subsystem Recover() found inappropriate item in list: [D.type]") if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING)) processing |= D \ No newline at end of file From 5d666f50bf279cf107d978678688dd49c35d86bd Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Mon, 30 Mar 2020 15:45:44 -0400 Subject: [PATCH 3/4] Lava uses wrong subsystem --- code/game/turfs/simulated/lava.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/game/turfs/simulated/lava.dm b/code/game/turfs/simulated/lava.dm index acf0c17317..01ad912b70 100644 --- a/code/game/turfs/simulated/lava.dm +++ b/code/game/turfs/simulated/lava.dm @@ -39,15 +39,15 @@ /turf/simulated/floor/lava/Entered(atom/movable/AM) if(burn_stuff(AM)) - START_PROCESSING(SSobj, src) + START_PROCESSING(SSturfs, src) /turf/simulated/floor/lava/hitby(atom/movable/AM) if(burn_stuff(AM)) - START_PROCESSING(SSobj, src) + START_PROCESSING(SSturfs, src) /turf/simulated/floor/lava/process() if(!burn_stuff()) - STOP_PROCESSING(SSobj, src) + return PROCESS_KILL /turf/simulated/floor/lava/proc/is_safe() //if anything matching this typecache is found in the lava, we don't burn things From b0c7ccbfef6614c1f654a2197e6d2b2b554fb4f7 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Mon, 30 Mar 2020 15:48:03 -0400 Subject: [PATCH 4/4] Autotransfer uses wrong subsystem --- code/controllers/autotransfer.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/autotransfer.dm b/code/controllers/autotransfer.dm index 6f68a8d9dc..fb8cc8286a 100644 --- a/code/controllers/autotransfer.dm +++ b/code/controllers/autotransfer.dm @@ -5,10 +5,10 @@ datum/controller/transfer_controller var/currenttick = 0 datum/controller/transfer_controller/New() timerbuffer = config.vote_autotransfer_initial - START_PROCESSING(SSobj, src) + START_PROCESSING(SSprocessing, src) datum/controller/transfer_controller/Destroy() - STOP_PROCESSING(SSobj, src) + STOP_PROCESSING(SSprocessing, src) datum/controller/transfer_controller/process() currenttick = currenttick + 1