diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 20b3f887453..4596c79ef1e 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -19,3 +19,26 @@ //For servers that can't do with any additional lag, set this to none in flightpacks.dm in subsystem/processing. #define FLIGHTSUIT_PROCESSING_NONE 0 #define FLIGHTSUIT_PROCESSING_FULL 1 + +// Subsystem init_order, from highest priority to lowest priority +// The numbers just define the ordering, they are meaningless otherwise. + +#define INIT_ORDER_JOBS 15 +#define INIT_ORDER_EVENTS 14 +#define INIT_ORDER_TICKER 13 +#define INIT_ORDER_MAPPING 12 +#define INIT_ORDER_ATOMS 11 +#define INIT_ORDER_MACHINES 9 +#define INIT_ORDER_SHUTTLE 3 +#define INIT_ORDER_TIMER 1 +#define INIT_ORDER_DEFAULT 0 +#define INIT_ORDER_AIR -1 +#define INIT_ORDER_MINIMAP -2 +#define INIT_ORDER_ASSETS -3 +#define INIT_ORDER_ICON_SMOOTHING -5 +#define INIT_ORDER_OVERLAY -6 +#define INIT_ORDER_XKEYSCORE -10 +#define INIT_ORDER_STICKY_BAN -10 +#define INIT_ORDER_LIGHTING -20 +#define INIT_ORDER_SQUEAK -40 +#define INIT_ORDER_PERSISTENCE -100 diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index e4dc9f833e0..97e3efaf4ad 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -2,7 +2,7 @@ /datum/controller/subsystem // Metadata; you should define these. name = "fire coderbus" //name of the subsystem - var/init_order = 0 //order of initialization. Higher numbers are initialized first, lower numbers later. Can be decimal and negative values. + var/init_order = INIT_ORDER_DEFAULT //order of initialization. Higher numbers are initialized first, lower numbers later. Use defines in __DEFINES/subsystems.dm for easy understanding of order. var/wait = 20 //time to wait (in deciseconds) between each call to fire(). Must be a positive integer. var/priority = 50 //When mutiple subsystems need to run in the same tick, higher priority subsystems will run first and be given a higher share of the tick before MC_TICK_CHECK triggers a sleep @@ -208,4 +208,4 @@ next_fire = world.time + wait if ("queued_priority") //editing this breaks things. return 0 - . = ..() \ No newline at end of file + . = ..() diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index 852e28077de..919b4cfce92 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -8,7 +8,7 @@ SUBSYSTEM_DEF(air) name = "Air" - init_order = -1 + init_order = INIT_ORDER_AIR priority = 20 wait = 5 flags = SS_BACKGROUND diff --git a/code/controllers/subsystem/assets.dm b/code/controllers/subsystem/assets.dm index ac8f51de0ed..607b142c59b 100644 --- a/code/controllers/subsystem/assets.dm +++ b/code/controllers/subsystem/assets.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(assets) name = "Assets" - init_order = -3 + init_order = INIT_ORDER_ASSETS flags = SS_NO_FIRE var/list/cache = list() @@ -11,4 +11,4 @@ SUBSYSTEM_DEF(assets) for(var/client/C in GLOB.clients) addtimer(CALLBACK(GLOBAL_PROC, .proc/getFilesSlow, C, cache, FALSE), 10) - ..() \ No newline at end of file + ..() diff --git a/code/controllers/subsystem/atoms.dm b/code/controllers/subsystem/atoms.dm index 7f1ee2634b4..4ca35e434d2 100644 --- a/code/controllers/subsystem/atoms.dm +++ b/code/controllers/subsystem/atoms.dm @@ -4,7 +4,7 @@ SUBSYSTEM_DEF(atoms) name = "Atoms" - init_order = 11 + init_order = INIT_ORDER_ATOMS flags = SS_NO_FIRE var/initialized = INITIALIZATION_INSSATOMS diff --git a/code/controllers/subsystem/events.dm b/code/controllers/subsystem/events.dm index cae880485c9..411d6f0b14e 100644 --- a/code/controllers/subsystem/events.dm +++ b/code/controllers/subsystem/events.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(events) name = "Events" - init_order = 6 + init_order = INIT_ORDER_EVENTS var/list/control = list() //list of all datum/round_event_control. Used for selecting events based on weight and occurrences. var/list/running = list() //list of all existing /datum/round_event diff --git a/code/controllers/subsystem/icon_smooth.dm b/code/controllers/subsystem/icon_smooth.dm index 83c58950185..84df089973f 100644 --- a/code/controllers/subsystem/icon_smooth.dm +++ b/code/controllers/subsystem/icon_smooth.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(icon_smooth) name = "Icon Smoothing" - init_order = -5 + init_order = INIT_ORDER_ICON_SMOOTHING wait = 1 priority = 35 flags = SS_TICKER @@ -29,4 +29,4 @@ SUBSYSTEM_DEF(icon_smooth) smooth_icon(A) CHECK_TICK - ..() \ No newline at end of file + ..() diff --git a/code/controllers/subsystem/ipintel.dm b/code/controllers/subsystem/ipintel.dm index 0f351c84631..fca394924d9 100644 --- a/code/controllers/subsystem/ipintel.dm +++ b/code/controllers/subsystem/ipintel.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(ipintel) name = "XKeyScore" - init_order = -10 + init_order = INIT_ORDER_XKEYSCORE flags = SS_NO_FIRE var/enabled = 0 //disable at round start to avoid checking reconnects var/throttle = 0 diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 517c72512cb..68e27c9900d 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(job) name = "Jobs" - init_order = 14 + init_order = INIT_ORDER_JOBS flags = SS_NO_FIRE var/list/occupations = list() //List of all jobs diff --git a/code/controllers/subsystem/lighting.dm b/code/controllers/subsystem/lighting.dm index 39147714ba3..eb61e5ef394 100644 --- a/code/controllers/subsystem/lighting.dm +++ b/code/controllers/subsystem/lighting.dm @@ -5,7 +5,7 @@ GLOBAL_LIST_EMPTY(lighting_update_objects) // List of lighting objects queued fo SUBSYSTEM_DEF(lighting) name = "Lighting" wait = 2 - init_order = -20 + init_order = INIT_ORDER_LIGHTING flags = SS_TICKER var/initialized = FALSE diff --git a/code/controllers/subsystem/machines.dm b/code/controllers/subsystem/machines.dm index 98527520817..ab941eb1c6b 100644 --- a/code/controllers/subsystem/machines.dm +++ b/code/controllers/subsystem/machines.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(machines) name = "Machines" - init_order = 9 + init_order = INIT_ORDER_MACHINES flags = SS_KEEP_TIMING var/list/processing = list() var/list/currentrun = list() @@ -61,4 +61,4 @@ SUBSYSTEM_DEF(machines) if (istype(SSmachines.processing)) processing = SSmachines.processing if (istype(SSmachines.powernets)) - powernets = SSmachines.powernets \ No newline at end of file + powernets = SSmachines.powernets diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index bae759ac3aa..1499bc5029f 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(mapping) name = "Mapping" - init_order = 12 + init_order = INIT_ORDER_MAPPING flags = SS_NO_FIRE var/list/nuke_tiles = list() diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 6c3ce67dc23..10c6f8e5c46 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(minimap) name = "Minimap" - init_order = -2 + init_order = INIT_ORDER_MINIMAP flags = SS_NO_FIRE var/const/MINIMAP_SIZE = 2048 var/const/TILE_SIZE = 8 diff --git a/code/controllers/subsystem/mobs.dm b/code/controllers/subsystem/mobs.dm index d9b78a77adf..f87b94bac48 100644 --- a/code/controllers/subsystem/mobs.dm +++ b/code/controllers/subsystem/mobs.dm @@ -1,6 +1,5 @@ SUBSYSTEM_DEF(mobs) name = "Mobs" - init_order = 4 priority = 100 flags = SS_KEEP_TIMING|SS_NO_INIT @@ -26,4 +25,4 @@ SUBSYSTEM_DEF(mobs) else GLOB.mob_list.Remove(M) if (MC_TICK_CHECK) - return \ No newline at end of file + return diff --git a/code/controllers/subsystem/npcpool.dm b/code/controllers/subsystem/npcpool.dm index 11d819d0678..abdeb0e9d35 100644 --- a/code/controllers/subsystem/npcpool.dm +++ b/code/controllers/subsystem/npcpool.dm @@ -11,7 +11,7 @@ SUBSYSTEM_DEF(npcpool) var/list/canBeUsed = list() var/list/needsDelegate = list() var/list/needsAssistant = list() - + var/list/processing = list() var/list/currentrun = list() var/stage diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index 80517d1e3a1..e1cf992e8b5 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(persistence) name = "Persistence" - init_order = -100 + init_order = INIT_ORDER_PERSISTENCE flags = SS_NO_FIRE var/savefile/secret_satchels var/list/satchel_blacklist = list() //this is a typecache diff --git a/code/controllers/subsystem/processing/overlays.dm b/code/controllers/subsystem/processing/overlays.dm index c28dc245fae..1a42944bb5f 100644 --- a/code/controllers/subsystem/processing/overlays.dm +++ b/code/controllers/subsystem/processing/overlays.dm @@ -3,7 +3,7 @@ PROCESSING_SUBSYSTEM_DEF(overlays) flags = SS_TICKER|SS_FIRE_IN_LOBBY wait = 1 priority = 500 - init_order = -6 + init_order = INIT_ORDER_OVERLAY stat_tag = "Ov" currentrun = null diff --git a/code/controllers/subsystem/radio.dm b/code/controllers/subsystem/radio.dm index d69575f60f1..de605cb5548 100644 --- a/code/controllers/subsystem/radio.dm +++ b/code/controllers/subsystem/radio.dm @@ -1,6 +1,5 @@ SUBSYSTEM_DEF(radio) name = "Radio" - init_order = 18 flags = SS_NO_FIRE|SS_NO_INIT var/list/datum/radio_frequency/frequencies = list() @@ -39,4 +38,4 @@ SUBSYSTEM_DEF(radio) frequency.frequency = new_frequency frequencies[f_text] = frequency - return frequency \ No newline at end of file + return frequency diff --git a/code/controllers/subsystem/religion.dm b/code/controllers/subsystem/religion.dm index df772925d40..bba7dd082e0 100644 --- a/code/controllers/subsystem/religion.dm +++ b/code/controllers/subsystem/religion.dm @@ -1,6 +1,5 @@ SUBSYSTEM_DEF(religion) name = "Religion" - init_order = 19 flags = SS_NO_FIRE|SS_NO_INIT var/religion @@ -8,4 +7,4 @@ SUBSYSTEM_DEF(religion) var/bible_name var/bible_icon_state var/bible_item_state - var/holy_weapon_type \ No newline at end of file + var/holy_weapon_type diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index 4270ff7851f..bc8c14a74d1 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -3,7 +3,7 @@ SUBSYSTEM_DEF(shuttle) name = "Shuttle" wait = 10 - init_order = 3 + init_order = INIT_ORDER_SHUTTLE flags = SS_KEEP_TIMING|SS_NO_TICK_CHECK var/list/mobile = list() @@ -505,4 +505,4 @@ SUBSYSTEM_DEF(shuttle) centcom_message = SSshuttle.centcom_message ordernum = SSshuttle.ordernum - points = SSshuttle.points \ No newline at end of file + points = SSshuttle.points diff --git a/code/controllers/subsystem/squeak.dm b/code/controllers/subsystem/squeak.dm index a4f0d6e52dd..d94efd0a4ac 100644 --- a/code/controllers/subsystem/squeak.dm +++ b/code/controllers/subsystem/squeak.dm @@ -4,7 +4,7 @@ SUBSYSTEM_DEF(squeak) name = "Squeak" - priority = 40 + init_order = INIT_ORDER_SQUEAK flags = SS_NO_FIRE var/list/exposed_wires = list() diff --git a/code/controllers/subsystem/stickyban.dm b/code/controllers/subsystem/stickyban.dm index b5702455b87..371cf22b3bf 100644 --- a/code/controllers/subsystem/stickyban.dm +++ b/code/controllers/subsystem/stickyban.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(stickyban) name = "Sticky Ban" - init_order = -10 + init_order = INIT_ORDER_STICKY_BAN flags = SS_NO_FIRE var/list/cache = list() diff --git a/code/controllers/subsystem/sun.dm b/code/controllers/subsystem/sun.dm index 7f443aadc05..7a3528cc3d9 100644 --- a/code/controllers/subsystem/sun.dm +++ b/code/controllers/subsystem/sun.dm @@ -1,7 +1,6 @@ SUBSYSTEM_DEF(sun) name = "Sun" wait = 600 - init_order = 2 flags = SS_NO_TICK_CHECK|SS_NO_INIT var/angle var/dx diff --git a/code/controllers/subsystem/tgui.dm b/code/controllers/subsystem/tgui.dm index edec49bcbbb..862dfb0f98d 100644 --- a/code/controllers/subsystem/tgui.dm +++ b/code/controllers/subsystem/tgui.dm @@ -1,7 +1,6 @@ SUBSYSTEM_DEF(tgui) name = "tgui" wait = 9 - init_order = 16 flags = SS_NO_INIT|SS_FIRE_IN_LOBBY priority = 110 diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 5d572f8a07a..0e75f5e681f 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -2,7 +2,7 @@ SUBSYSTEM_DEF(ticker) name = "Ticker" - init_order = 13 + init_order = INIT_ORDER_TICKER priority = 200 flags = SS_FIRE_IN_LOBBY|SS_KEEP_TIMING diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index 6a63f090e56..55ebbfa3524 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -4,7 +4,7 @@ SUBSYSTEM_DEF(timer) name = "Timer" wait = 1 //SS_TICKER subsystem, so wait is in ticks - init_order = 1 + init_order = INIT_ORDER_TIMER flags = SS_FIRE_IN_LOBBY|SS_TICKER|SS_NO_INIT diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 9c12f5d6712..f96d6eb8a23 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -125,6 +125,7 @@ var/datum/proximity_monitor/proximity_monitor = src.proximity_monitor if(proximity_monitor) proximity_monitor.HandleMove() + return 1 /atom/movable/proc/clean_on_move() @@ -175,7 +176,7 @@ if(stationloving && force) STOP_PROCESSING(SSinbounds, src) - + QDEL_NULL(proximity_monitor) . = ..() @@ -627,4 +628,4 @@ /atom/movable/proc/ConveyorMove(movedir) set waitfor = FALSE if(!anchored && has_gravity()) - step(src, movedir) \ No newline at end of file + step(src, movedir)