standardize & document controller/subs definitions

renames "PreInit" to OnNew because that's what it actually is.
This commit is contained in:
spookerton
2022-04-24 07:40:14 +01:00
parent cdf7c84c06
commit fbd8d3c46b
13 changed files with 51 additions and 24 deletions
+29 -7
View File
@@ -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
+1 -1
View File
@@ -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
+11 -3
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
@@ -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
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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)
+1 -3
View File
@@ -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]"])
+1 -1
View File
@@ -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')
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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