diff --git a/code/__defines/MC.dm b/code/__defines/MC.dm index 57161ffac8..cb60e42bcd 100644 --- a/code/__defines/MC.dm +++ b/code/__defines/MC.dm @@ -67,14 +67,14 @@ #define SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/##X);\ /datum/controller/subsystem/##X/New(){\ NEW_SS_GLOBAL(SS##X);\ - PreInit();\ + OnNew();\ }\ /datum/controller/subsystem/##X #define PROCESSING_SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/processing/##X);\ /datum/controller/subsystem/processing/##X/New(){\ NEW_SS_GLOBAL(SS##X);\ - PreInit();\ + OnNew();\ }\ /datum/controller/subsystem/processing/##X diff --git a/code/controllers/controller.dm b/code/controllers/controller.dm index c9d5f1e565..3c298fcf20 100644 --- a/code/controllers/controller.dm +++ b/code/controllers/controller.dm @@ -1,19 +1,41 @@ -/datum/controller - var/name - // The object used for the clickable stat() button. - var/obj/effect/statclick/statclick +/// The display name of this controller. +/datum/controller/var/name +/// The atom used to provide a clickable stat line in the MC tab for this controller. +/datum/controller/var/obj/effect/statclick/statclick + + +// Do not implement any base behaviors here. +/// Called to set up this controller. /datum/controller/proc/Initialize() + return -//cleanup actions + +// Do not implement any base behaviors here. +/// Called to clean up / finalize this controller. /datum/controller/proc/Shutdown() + return -//when we enter dmm_suite.load_map + +// Do not implement any base behaviors here. +/// Called when dmm_suite begins loading a map. /datum/controller/proc/StartLoadingMap() + return -//when we exit dmm_suite.load_map + +// Do not implement any base behaviors here. +/// Called when dmm_suite finishes loading a map. /datum/controller/proc/StopLoadingMap() + return + +// Do not implement any base behaviors here. +/// To be called on the OLD instance if the controller fails in some way that requires it to be replaced. /datum/controller/proc/Recover() + return + +// Do not implement any base behaviors here. +/// Called when an update to the stat line in the MC tab is requested. /datum/controller/proc/stat_entry() + return diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 6b043b3f66..8110b78c8f 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -11,7 +11,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new //THIS IS THE INIT ORDER -//Master -> SSPreInit -> GLOB -> world -> config -> SSInit -> Failsafe +//Master -> SSOnNew -> GLOB -> world -> config -> SSInit -> Failsafe //GOT IT MEMORIZED? /datum/controller/master diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index 65f2de418d..425b111565 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -52,13 +52,21 @@ return time -/// Initializes the subsystem AFTER map load. The preferred initialization proc. Do not implement any base behaviors here. +// Do not implement any base behaviors here. +/// Initializes the subsystem exactly once, AFTER map load, run by the MC and passed REALTIMEOFDAY. The preferred initialization proc. /datum/controller/subsystem/Initialize(timeofday) return -/// Initializes the subsystem BEFORE map load. Called after recover, if recover is called. -/datum/controller/subsystem/proc/PreInit() +// Do not implement any base behaviors here. +/// Called in subsystem/New if there is an existing instance of the subsystem, on the existing instance, before it is deleted. +/datum/controller/subsystem/Recover() + return + + +// Do not implement any base behaviors here. +/// Called in subsystem/New - happens BEFORE map load, and ALSO every time the subsystem is Recovered, AFTER being Recovered. +/datum/controller/subsystem/proc/OnNew() return diff --git a/code/controllers/subsystems/air.dm b/code/controllers/subsystems/air.dm index 46e25dbf8a..a0429d8d0f 100644 --- a/code/controllers/subsystems/air.dm +++ b/code/controllers/subsystems/air.dm @@ -30,7 +30,7 @@ SUBSYSTEM_DEF(air) // This is used to tell CI WHERE the edges are. var/list/startup_active_edge_log = list() -/datum/controller/subsystem/air/PreInit() +/datum/controller/subsystem/air/OnNew() air_master = src /datum/controller/subsystem/air/Initialize(timeofday) diff --git a/code/controllers/subsystems/garbage.dm b/code/controllers/subsystems/garbage.dm index 8688768c7d..273b1c99a3 100644 --- a/code/controllers/subsystems/garbage.dm +++ b/code/controllers/subsystems/garbage.dm @@ -30,7 +30,7 @@ SUBSYSTEM_DEF(garbage) var/list/queues -/datum/controller/subsystem/garbage/PreInit() +/datum/controller/subsystem/garbage/OnNew() queues = new(GC_QUEUE_COUNT) pass_counts = new(GC_QUEUE_COUNT) fail_counts = new(GC_QUEUE_COUNT) diff --git a/code/controllers/subsystems/open_space.dm b/code/controllers/subsystems/open_space.dm index 9d9efa0a2c..9b5808a197 100644 --- a/code/controllers/subsystems/open_space.dm +++ b/code/controllers/subsystems/open_space.dm @@ -23,7 +23,6 @@ SUBSYSTEM_DEF(open_space) /datum/controller/subsystem/open_space/Recover() flags |= SS_NO_INIT // Make extra sure we don't initialize twice. - . = ..() /datum/controller/subsystem/open_space/fire(resumed, no_mc_tick) // We use a different list so any additions to the update lists during a delay from MC_TICK_CHECK diff --git a/code/controllers/subsystems/overlays.dm b/code/controllers/subsystems/overlays.dm index 35dc2b52a6..307d9b8837 100644 --- a/code/controllers/subsystems/overlays.dm +++ b/code/controllers/subsystems/overlays.dm @@ -14,7 +14,7 @@ var/global/image/stringbro = new() // Temporarily super-global because of BYOND var/global/image/iconbro = new() // Temporarily super-global because of BYOND init order dumbness. var/global/image/appearance_bro = new() // Temporarily super-global because of BYOND init order dumbness. -/datum/controller/subsystem/overlays/PreInit() +/datum/controller/subsystem/overlays/OnNew() overlay_icon_state_caches = list() overlay_icon_cache = list() queue = list() diff --git a/code/controllers/subsystems/shuttles.dm b/code/controllers/subsystems/shuttles.dm index e598632fea..342a281022 100644 --- a/code/controllers/subsystems/shuttles.dm +++ b/code/controllers/subsystems/shuttles.dm @@ -35,7 +35,7 @@ SUBSYSTEM_DEF(shuttles) var/tmp/list/current_run // Shuttles remaining to process this fire() tick -/datum/controller/subsystem/shuttles/PreInit() +/datum/controller/subsystem/shuttles/OnNew() global.shuttle_controller = src // TODO - Remove this! Change everything to point at SSshuttles intead /datum/controller/subsystem/shuttles/Initialize(timeofday) diff --git a/code/controllers/subsystems/skybox.dm b/code/controllers/subsystems/skybox.dm index 1707f80052..3df25b0f4f 100644 --- a/code/controllers/subsystems/skybox.dm +++ b/code/controllers/subsystems/skybox.dm @@ -12,7 +12,7 @@ SUBSYSTEM_DEF(skybox) var/static/list/phase_shift_by_x = list() var/static/list/phase_shift_by_y = list() -/datum/controller/subsystem/skybox/PreInit() +/datum/controller/subsystem/skybox/OnNew() //Static for (var/i in 0 to 25) var/image/im = image('icons/turf/space_dust.dmi', "[i]") @@ -60,8 +60,6 @@ SUBSYSTEM_DEF(skybox) phase_shift_by_x = get_cross_shift_list(15) phase_shift_by_y = get_cross_shift_list(15) - . = ..() - /datum/controller/subsystem/skybox/proc/get_skybox(z) if(!skybox_cache["[z]"]) diff --git a/code/controllers/subsystems/tgui.dm b/code/controllers/subsystems/tgui.dm index 307f827d2b..51fb7865c5 100644 --- a/code/controllers/subsystems/tgui.dm +++ b/code/controllers/subsystems/tgui.dm @@ -22,7 +22,7 @@ SUBSYSTEM_DEF(tgui) current.Cut() -/datum/controller/subsystem/tgui/PreInit() +/datum/controller/subsystem/tgui/OnNew() base_html = file2text('tgui/packages/tgui/public/tgui.html') diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index f4bab1ca53..c8d2af60d4 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -47,7 +47,7 @@ SUBSYSTEM_DEF(ticker) // This global variable exists for legacy support so we don't have to rename every 'ticker' to 'SSticker' yet. var/global/datum/controller/subsystem/ticker/ticker -/datum/controller/subsystem/ticker/PreInit() +/datum/controller/subsystem/ticker/OnNew() global.ticker = src // TODO - Remove this! Change everything to point at SSticker intead /datum/controller/subsystem/ticker/Initialize(timeofday) diff --git a/code/controllers/subsystems/timer.dm b/code/controllers/subsystems/timer.dm index a09bf1c94e..8ac3d243fb 100644 --- a/code/controllers/subsystems/timer.dm +++ b/code/controllers/subsystems/timer.dm @@ -28,7 +28,7 @@ SUBSYSTEM_DEF(timer) var/static/last_invoke_warning = 0 var/static/bucket_auto_reset = TRUE -/datum/controller/subsystem/timer/PreInit() +/datum/controller/subsystem/timer/OnNew() bucket_list.len = BUCKET_LEN head_offset = world.time bucket_resolution = world.tick_lag