From c66314d28276007ec37216b3d9f9acd1600a17c9 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Fri, 4 Dec 2015 00:21:45 -0500 Subject: [PATCH 1/7] Make stats in the MC tab clickable --- code/controllers/{verbs.dm => admin.dm} | 127 ++++++++++++++---------- code/controllers/failsafe.dm | 15 ++- code/controllers/master_controller.dm | 22 ++-- code/controllers/subsystems.dm | 13 ++- code/modules/mob/mob.dm | 21 ++-- tgstation.dme | 2 +- 6 files changed, 124 insertions(+), 76 deletions(-) rename code/controllers/{verbs.dm => admin.dm} (61%) diff --git a/code/controllers/verbs.dm b/code/controllers/admin.dm similarity index 61% rename from code/controllers/verbs.dm rename to code/controllers/admin.dm index 923eff76e7f..de9da078fc2 100644 --- a/code/controllers/verbs.dm +++ b/code/controllers/admin.dm @@ -1,54 +1,73 @@ -//TODO: rewrite and standardise all controller datums to the datum/controller type -//TODO: allow all controllers to be deleted for clean restarts (see WIP master controller stuff) - MC done - lighting done - -/client/proc/restart_controller(controller in list("Master","Failsafe")) - set category = "Debug" - set name = "Restart Controller" - set desc = "Restart one of the various periodic loop controllers for the game (be careful!)" - - if(!holder) return - usr = null - src = null - switch(controller) - if("Master") - new /datum/controller/game_controller() - master_controller.process() - feedback_add_details("admin_verb","RMC") - if("Failsafe") - new /datum/controller/failsafe() - feedback_add_details("admin_verb","RFailsafe") - - message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.") - return - - -/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Jobs","Radio","Configuration", "Cameras")) - set category = "Debug" - set name = "Debug Controller" - set desc = "Debug the various periodic loop controllers for the game (be careful!)" - - if(!holder) return - switch(controller) - if("Master") - debug_variables(master_controller) - - if("Failsafe") - debug_variables(Failsafe) - - if("Ticker") - debug_variables(ticker) - - if("Jobs") - debug_variables(SSjob) - - if("Radio") - debug_variables(radio_controller) - - if("Configuration") - debug_variables(config) - - if("Cameras") - debug_variables(cameranet) - - message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.") - return +//TODO: rewrite and standardise all controller datums to the datum/controller type +//TODO: allow all controllers to be deleted for clean restarts (see WIP master controller stuff) - MC done - lighting done + +/obj/effect/statclick + var/target + +/obj/effect/statclick/New(text, target) + src.name = text + src.target = target + +/obj/effect/statclick/proc/update(text) + src.name = text + return src + +/obj/effect/statclick + var/class + +/obj/effect/statclick/debug/Click() + if(!usr.client.holder) + return + if(!class) + if(istype(target, /datum/subsystem)) + class = "subsystem" + else if(istype(target, /datum/controller)) + class = "controller" + else + class = "unknown" + + usr.client.debug_variables(target) + message_admins("Admin [key_name_admin(usr)] is debugging the [target] [class].") + +/client/proc/restart_controller(controller in list("Master", "Failsafe")) + set category = "Debug" + set name = "Restart Controller" + set desc = "Restart one of the various periodic loop controllers for the game (be careful!)" + + if(!holder) + return + switch(controller) + if("Master") + new /datum/controller/game_controller() + master_controller.process() + feedback_add_details("admin_verb","RMC") + if("Failsafe") + new /datum/controller/failsafe() + feedback_add_details("admin_verb","RFailsafe") + + message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.") + +/client/proc/debug_controller(controller in list("Master", "Failsafe", "Ticker", "Jobs", "Radio", "Configuration", "Cameras")) + set category = "Debug" + set name = "Debug Controller" + set desc = "Debug the various periodic loop controllers for the game (be careful!)" + + if(!holder) + return + switch(controller) + if("Master") + debug_variables(master_controller) + if("Failsafe") + debug_variables(Failsafe) + if("Ticker") + debug_variables(ticker) + if("Jobs") + debug_variables(SSjob) + if("Radio") + debug_variables(radio_controller) + if("Configuration") + debug_variables(config) + if("Cameras") + debug_variables(cameranet) + + message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.") diff --git a/code/controllers/failsafe.dm b/code/controllers/failsafe.dm index 86aef1dc056..d6c80c5a381 100644 --- a/code/controllers/failsafe.dm +++ b/code/controllers/failsafe.dm @@ -1,11 +1,13 @@ var/datum/controller/failsafe/Failsafe /datum/controller/failsafe // This thing pretty much just keeps poking the master controller + var/name = "Failsafe" var/processing_interval = 100 //poke the MC every 10 seconds - set to 0 to disable - var/MC_iteration = 0 var/MC_defcon = 0 //alert level. For every poke that fails this is raised by 1. When it reaches 5 the MC is replaced with a new one. (effectively killing any master_controller.process() and starting a new one) + var/obj/effect/statclick/statclick // clickable stat button + /datum/controller/failsafe/New() //There can be only one failsafe. Out with the old in with the new (that way we can restart the Failsafe by spawning a new one) if(Failsafe != src) @@ -18,7 +20,8 @@ var/datum/controller/failsafe/Failsafe /datum/controller/failsafe/process() spawn(0) while(1) //more efficient than recursivly calling ourself over and over. background = 1 ensures we do not trigger an infinite loop - if(!master_controller) new /datum/controller/game_controller() //replace the missing master_controller! This should never happen. + if(!master_controller) + new /datum/controller/game_controller() //replace the missing master_controller! This should never happen. if(processing_interval > 0) if(master_controller.processing_interval > 0) //only poke if these overrides aren't in effect @@ -40,4 +43,10 @@ var/datum/controller/failsafe/Failsafe sleep(processing_interval) else MC_defcon = 0 - sleep(100) \ No newline at end of file + sleep(100) + +/datum/controller/failsafe/proc/stat_entry() + if(!statclick) + statclick = new/obj/effect/statclick/debug("Initializing...", src) + + stat("Failsafe Controller:", statclick.update("Defcon: [Failsafe.MC_defcon] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.MC_iteration])")) diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 6895eec77ac..3fb82f885d2 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -6,7 +6,8 @@ var/global/datum/controller/game_controller/master_controller = new() /datum/controller/game_controller - var/processing_interval = 1 //The minimum length of time between MC ticks (in deciseconds). The highest this can be without affecting schedules, is the GCD of all subsystem var/wait. Set to 0 to disable all processing. + var/name = "Master" + var/processing_interval = 1 // The minimum length of time between MC ticks (in deciseconds). The highest this can be without affecting schedules, is the GCD of all subsystem var/wait. Set to 0 to disable all processing. var/iteration = 0 var/cost = 0 var/SSCostPerSecond = 0 @@ -14,6 +15,8 @@ var/global/datum/controller/game_controller/master_controller = new() var/list/subsystems = list() + var/obj/effect/statclick/statclick // clickable stat button + /datum/controller/game_controller/New() //There can be only one master_controller. Out with the old and in with the new. if(master_controller != src) @@ -71,7 +74,7 @@ calculate the longest number of ticks the MC can wait between each cycle without crewmonitor.generateMiniMaps() populate_asset_cache() - world << "Initializations complete" + world << "Initializations Complete!" world.sleep_offline = 1 world.fps = config.fps @@ -84,7 +87,8 @@ calculate the longest number of ticks the MC can wait between each cycle without #define MC_AVERAGE(average, current) (0.8*(average) + 0.2*(current)) /datum/controller/game_controller/process() - if(!Failsafe) new /datum/controller/failsafe() + if(!Failsafe) + new /datum/controller/failsafe() // (re)Start the failsafe. spawn(0) var/timer = world.time for(var/datum/subsystem/SS in subsystems) @@ -125,13 +129,13 @@ calculate the longest number of ticks the MC can wait between each cycle without sleep(-1) cost = MC_AVERAGE(cost, world.timeofday - start_time) - if (SubSystemRan) + if(SubSystemRan) calculateSScost() var/extrasleep = 0 - if (startingtick < world.time || start_time+1 < world.timeofday) + if(startingtick < world.time || start_time+1 < world.timeofday) //we caused byond to miss a tick, sleep a bit extra extrasleep += world.tick_lag*2 - if (world.cpu > 80) + if(world.cpu > 80) extrasleep += extrasleep+processing_interval sleep(processing_interval+extrasleep) else @@ -167,3 +171,9 @@ calculate the longest number of ticks the MC can wait between each cycle without world.log << msg subsystems = master_controller.subsystems + +/datum/controller/game_controller/proc/stat_entry() + if(!statclick) + statclick = new/obj/effect/statclick/debug("Initializing...", src) + + stat("Master Controller:", statclick.update("[round(master_controller.cost, 0.001)]ds (Interval: [master_controller.processing_interval] | Iteration:[master_controller.iteration])")) diff --git a/code/controllers/subsystems.dm b/code/controllers/subsystems.dm index 9ea5bc0c7c3..9c2c6e74dbf 100644 --- a/code/controllers/subsystems.dm +++ b/code/controllers/subsystems.dm @@ -24,6 +24,8 @@ var/cost = 0 //average time to execute var/times_fired = 0 //number of times we have called fire() + var/obj/effect/statclick/statclick // clickable stat button + //used to initialize the subsystem BEFORE the map has loaded /datum/subsystem/New() @@ -37,19 +39,22 @@ //used to initialize the subsystem AFTER the map has loaded /datum/subsystem/proc/Initialize(start_timeofday, zlevel) var/time = (world.timeofday - start_timeofday) / 10 - var/msg = "Initialized [name] SubSystem within [time] seconds" - if (zlevel) + var/msg = "Initialized [name] subsystem within [time] seconds!" + if(zlevel) testing(msg) return world << "[msg]" //hook for printing stats to the "MC" statuspanel for admins to see performance and related stats etc. /datum/subsystem/proc/stat_entry(msg) + if(!statclick) + statclick = new/obj/effect/statclick/debug("Initializing...", src) + var/dwait = "" if (dynamic_wait) dwait = "DWait:[round(wait,0.1)]ds " - stat(name, "[round(cost,0.001)]ds\t[dwait][msg]") + stat(name, statclick.update("[round(cost,0.001)]ds\t[dwait][msg]")) //could be used to postpone a costly subsystem for (default one) var/cycles, cycles //for instance, during cpu intensive operations like explosions @@ -59,4 +64,4 @@ //usually called via datum/subsystem/New() when replacing a subsystem (i.e. due to a recurring crash) //should attempt to salvage what it can from the old instance of subsystem -/datum/subsystem/proc/Recover() +/datum/subsystem/proc/Recover() \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index bf7825f5343..ff20083da39 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -650,18 +650,23 @@ var/list/slot_equipment_priority = list( \ if(client && client.holder) if(statpanel("MC")) - stat("Location:","([x], [y], [z])") - stat("CPU:","[world.cpu]") - stat("Instances:","[world.contents.len]") - + stat("Location:", "([x], [y], [z])") + stat("CPU:", "[world.cpu]") + stat("Instances:", "[world.contents.len]") if(master_controller) - stat("MasterController:","[round(master_controller.cost,0.001)]ds (Interval:[master_controller.processing_interval] | Iteration:[master_controller.iteration])") - stat("Subsystem cost per second:","[round(master_controller.SSCostPerSecond,0.001)]ds") + master_controller.stat_entry() + else + stat("Master Controller:", "ERROR") + if(Failsafe) + Failsafe.stat_entry() + else + stat("Failsafe Controller:", "ERROR") + if(master_controller) + stat("Subsystems:", "[round(master_controller.SSCostPerSecond, 0.001)]ds") + stat(null) for(var/datum/subsystem/SS in master_controller.subsystems) if(SS.can_fire) SS.stat_entry() - else - stat("MasterController:","ERROR") if(listed_turf && client) if(!TurfAdjacent(listed_turf)) diff --git a/tgstation.dme b/tgstation.dme index 783cea66dd8..eb4129eb273 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -138,11 +138,11 @@ #include "code\ATMOSPHERICS\pipes\heat_exchange\junction.dm" #include "code\ATMOSPHERICS\pipes\heat_exchange\manifold.dm" #include "code\ATMOSPHERICS\pipes\heat_exchange\simple.dm" +#include "code\controllers\admin.dm" #include "code\controllers\configuration.dm" #include "code\controllers\failsafe.dm" #include "code\controllers\master_controller.dm" #include "code\controllers\subsystems.dm" -#include "code\controllers\verbs.dm" #include "code\controllers\subsystem\air.dm" #include "code\controllers\subsystem\diseases.dm" #include "code\controllers\subsystem\events.dm" From 97ca70cd345cdad38102e40c1de35de65add7df2 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Fri, 4 Dec 2015 15:40:58 -0600 Subject: [PATCH 2/7] Rework Master Controller, Failsafe, and Subsystem code --- code/controllers/admin.dm | 37 +--- code/controllers/configuration.dm | 10 + code/controllers/controller.dm | 4 + code/controllers/failsafe.dm | 65 +++--- code/controllers/master.dm | 198 ++++++++++++++++++ code/controllers/master_controller.dm | 179 ---------------- code/controllers/subsystem/assets.dm | 23 ++ code/controllers/subsystem/minimap.dm | 181 ++++++++++++++++ code/controllers/subsystem/nano.dm | 4 +- code/controllers/subsystem/ticker.dm | 5 +- code/controllers/subsystems.dm | 20 +- code/game/machinery/computer/crew.dm | 175 +--------------- code/modules/admin/admin_verbs.dm | 2 - code/modules/admin/verbs/mapping.dm | 2 +- code/modules/client/asset_cache.dm | 24 +-- code/modules/client/client procs.dm | 4 +- .../living/silicon/ai/freelook/cameranet.dm | 12 +- code/modules/mob/mob.dm | 15 +- code/world.dm | 3 +- tgstation.dme | 5 +- 20 files changed, 509 insertions(+), 459 deletions(-) create mode 100644 code/controllers/controller.dm create mode 100644 code/controllers/master.dm delete mode 100644 code/controllers/master_controller.dm create mode 100644 code/controllers/subsystem/assets.dm create mode 100644 code/controllers/subsystem/minimap.dm diff --git a/code/controllers/admin.dm b/code/controllers/admin.dm index de9da078fc2..99b7452a12b 100644 --- a/code/controllers/admin.dm +++ b/code/controllers/admin.dm @@ -1,6 +1,4 @@ -//TODO: rewrite and standardise all controller datums to the datum/controller type -//TODO: allow all controllers to be deleted for clean restarts (see WIP master controller stuff) - MC done - lighting done - +// Clickable stat() button. /obj/effect/statclick var/target @@ -23,12 +21,16 @@ class = "subsystem" else if(istype(target, /datum/controller)) class = "controller" + else if(istype(target, /datum)) + class = "datum" else class = "unknown" usr.client.debug_variables(target) message_admins("Admin [key_name_admin(usr)] is debugging the [target] [class].") + +// Debug verbs. /client/proc/restart_controller(controller in list("Master", "Failsafe")) set category = "Debug" set name = "Restart Controller" @@ -38,36 +40,11 @@ return switch(controller) if("Master") - new /datum/controller/game_controller() - master_controller.process() + new/datum/controller/master() + Master.process() feedback_add_details("admin_verb","RMC") if("Failsafe") new /datum/controller/failsafe() feedback_add_details("admin_verb","RFailsafe") message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.") - -/client/proc/debug_controller(controller in list("Master", "Failsafe", "Ticker", "Jobs", "Radio", "Configuration", "Cameras")) - set category = "Debug" - set name = "Debug Controller" - set desc = "Debug the various periodic loop controllers for the game (be careful!)" - - if(!holder) - return - switch(controller) - if("Master") - debug_variables(master_controller) - if("Failsafe") - debug_variables(Failsafe) - if("Ticker") - debug_variables(ticker) - if("Jobs") - debug_variables(SSjob) - if("Radio") - debug_variables(radio_controller) - if("Configuration") - debug_variables(config) - if("Cameras") - debug_variables(cameranet) - - message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.") diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 9d891ac4864..b68ec62bd32 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -11,6 +11,8 @@ var/autoadmin_rank = "Game Admin" /datum/configuration + var/name = "Configuration" // datum name + var/server_name = null // server name (the name of the game window) var/station_name = null // station name (the name of the station in-game) var/server_suffix = 0 // generate numeric suffix based on server port @@ -183,6 +185,8 @@ var/maprotation = 1 var/maprotatechancedelta = 0.75 + // The object used for the clickable stat() button. + var/obj/effect/statclick/statclick /datum/configuration/New() @@ -699,3 +703,9 @@ if(M.required_players <= crew) runnable_modes[M] = probabilities[M.config_tag] return runnable_modes + +/datum/configuration/proc/stat_entry() + if(!statclick) + statclick = new/obj/effect/statclick/debug("Edit", src) + + stat("[name]:", statclick) \ No newline at end of file diff --git a/code/controllers/controller.dm b/code/controllers/controller.dm new file mode 100644 index 00000000000..7c87599e699 --- /dev/null +++ b/code/controllers/controller.dm @@ -0,0 +1,4 @@ +/datum/controller + var/name + // The object used for the clickable stat() button. + var/obj/effect/statclick/statclick \ No newline at end of file diff --git a/code/controllers/failsafe.dm b/code/controllers/failsafe.dm index d6c80c5a381..61b3a2cf9b3 100644 --- a/code/controllers/failsafe.dm +++ b/code/controllers/failsafe.dm @@ -1,52 +1,65 @@ + /** + * Failsafe + * + * Pretty much pokes the MC to make sure it's still alive. + **/ + var/datum/controller/failsafe/Failsafe /datum/controller/failsafe // This thing pretty much just keeps poking the master controller - var/name = "Failsafe" - var/processing_interval = 100 //poke the MC every 10 seconds - set to 0 to disable - var/MC_iteration = 0 - var/MC_defcon = 0 //alert level. For every poke that fails this is raised by 1. When it reaches 5 the MC is replaced with a new one. (effectively killing any master_controller.process() and starting a new one) + name = "Failsafe" - var/obj/effect/statclick/statclick // clickable stat button + // The length of time to check on the MC (in deciseconds). + // Set to 0 to disable. + var/processing_interval = 100 + // The alert level. For every failed poke, we drop a DEFCON level. Once we hit DEFCON 1, restart the MC. + var/defcon = 0 + + // Track the MC iteration to make sure its still on track. + var/master_iteration = 0 /datum/controller/failsafe/New() - //There can be only one failsafe. Out with the old in with the new (that way we can restart the Failsafe by spawning a new one) + // Highlander-style: there can only be one! Kill off the old and replace it with the new. if(Failsafe != src) if(istype(Failsafe)) qdel(Failsafe) Failsafe = src Failsafe.process() - /datum/controller/failsafe/process() spawn(0) - while(1) //more efficient than recursivly calling ourself over and over. background = 1 ensures we do not trigger an infinite loop - if(!master_controller) - new /datum/controller/game_controller() //replace the missing master_controller! This should never happen. - + while(1) // More efficient than recursion, 1 to avoid an infinite loop. + if(!Master) + // Replace the missing Master! This should never, ever happen. + new /datum/controller/master() + // Only poke it if overrides are not in effect. if(processing_interval > 0) - if(master_controller.processing_interval > 0) //only poke if these overrides aren't in effect - if(MC_iteration == master_controller.iteration) //master_controller hasn't finished processing in the defined interval - switch(MC_defcon) - if(0 to 3) - ++MC_defcon + if(Master.processing_interval > 0) + // Check if processing is done yet. + if(Master.iteration == master_iteration) + switch(defcon) + if(1 to 3) + ++defcon if(4) - admins << "Warning. The Master Controller has not fired in the last [MC_defcon*processing_interval] ticks. Automatic restart in [processing_interval] ticks." - MC_defcon = 5 + admins << "Warning: DEFCON [defcon]. The Master Controller has not fired in the last [defcon * processing_interval] ticks. Automatic restart in [processing_interval] ticks." + defcon = 5 if(5) - admins << "Warning. The Master Controller has still not fired within the last [MC_defcon*processing_interval] ticks. Killing and restarting..." - new /datum/controller/game_controller() //replace the old master_controller (hence killing the old one's process) - master_controller.process() //Start it rolling again - MC_defcon = 0 + admins << "Warning: DEFCON [defcon]. The Master Controller has still not fired within the last [defcon * processing_interval] ticks. Killing and restarting..." + // Replace the old master controller by creating a new one. + new/datum/controller/master() + // Get it rolling again. + Master.process() + defcon = 0 else - MC_defcon = 0 - MC_iteration = master_controller.iteration + defcon = 0 + master_iteration = Master.iteration sleep(processing_interval) else - MC_defcon = 0 + defcon = 0 sleep(100) /datum/controller/failsafe/proc/stat_entry() if(!statclick) statclick = new/obj/effect/statclick/debug("Initializing...", src) - stat("Failsafe Controller:", statclick.update("Defcon: [Failsafe.MC_defcon] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.MC_iteration])")) + stat("Failsafe Controller:", statclick.update("Defcon: [Failsafe.defcon] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])")) diff --git a/code/controllers/master.dm b/code/controllers/master.dm new file mode 100644 index 00000000000..2f94574a797 --- /dev/null +++ b/code/controllers/master.dm @@ -0,0 +1,198 @@ + /** + * CarnMC + * + * Simplified MC; designed to fail fast and respawn. + * This ensures Master.process() never doubles up. + * It will kill itself and any sleeping procs if needed. + * + * All core systems are subsystems. + * They are process()'d by this Master Controller. + **/ + +var/global/datum/controller/master/Master = new() + +/datum/controller/master + name = "Master" + + // The minimum length of time between MC ticks (in deciseconds). + // The highest this can be without affecting schedules is the GCD of all subsystem waits. + // Set to 0 to disable all processing. + var/processing_interval = 1 + // The iteration of the MC. + var/iteration = 0 + // The cost (in deciseconds) of the MC loop. + var/cost = 0 + + // A list of subsystems to process(). + var/list/subsystems = list() + // The cost of running the subsystems (in deciseconds). + var/subsystem_cost = 0 + // The type of the last subsystem to be process()'d. + var/last_type_processed + +/datum/controller/master/New() + // Highlander-style: there can only be one! Kill off the old and replace it with the new. + if(Master != src) + if(istype(Master)) + Recover() + qdel(Master) + else + init_subtypes(/datum/subsystem, subsystems) + Master = src + processing_interval = calculate_gcd() + +/datum/controller/master/Destroy() + ..() + // Tell qdel() to Del() this object. + return QDEL_HINT_HARDDEL_NOW + +/datum/controller/master/proc/Recover() + var/msg = "## DEBUG: [time2text(world.timeofday)] MC restarted. Reports:\n" + for(var/varname in Master.vars) + switch(varname) + if("name", "tag", "bestF", "type", "parent_type", "vars", "statclick") // Built-in junk. + continue + else + var/varval = Master.vars[varname] + if(istype(varval, /datum)) // Check if it has a type var. + var/datum/D = varval + msg += "\t [varname] = [D.type]\n" + else + msg += "\t [varname] = [varval]\n" + world.log << msg + + subsystems = Master.subsystems + +/datum/controller/master/proc/Setup(zlevel) + // Per-Z-level subsystems. + if (zlevel && zlevel > 0 && zlevel <= world.maxz) + for(var/datum/subsystem/SS in subsystems) + SS.Initialize(world.timeofday, zlevel) + sleep(-1) + return + world << "Initializing Subsystems..." + + + // Sort subsystems by priority, so they initialize in the correct order. + sortTim(subsystems, /proc/cmp_subsystem_priority) + + // Pick a random away mission. + createRandomZlevel() + // Set up Z-level transistions. + setup_map_transitions() + + // Generate asteroid. + for(1 to max_secret_rooms) + make_mining_asteroid_secret() + + // Initialize subsystems. + for(var/datum/subsystem/SS in subsystems) + SS.Initialize(world.timeofday, zlevel) + sleep(-1) + + world << "Initializations Complete!" + + // Set world options. + world.sleep_offline = 1 + world.fps = config.fps + + sleep(-1) + + // Loop. + Master.process() + +// Notify the MC that the round has started. +/datum/controller/master/proc/RoundStart() + for(var/datum/subsystem/SS in subsystems) + SS.can_fire = 1 + SS.next_fire = world.time + rand(0, SS.wait) // Stagger subsystems. + +// Used to smooth out costs to try and avoid oscillation. +#define MC_AVERAGE(average, current) (0.8 * (average) + 0.2 * (current)) +/datum/controller/master/process() + if(!Failsafe) + new/datum/controller/failsafe() // (re)Start the failsafe. + spawn(0) + // Schedule the first run of the Subsystems. + var/timer = world.time + for(var/datum/subsystem/SS in subsystems) + timer += processing_interval + SS.next_fire = timer + + var/start_time + while(1) // More efficient than recursion, 1 to avoid an infinite loop. + if(processing_interval > 0) + ++iteration + var/startingtick = world.time // Store when we started this iteration. + start_time = world.timeofday + + var/ran_subsystems = 0 + for(var/datum/subsystem/SS in subsystems) + if(SS.can_fire > 0) + if(SS.next_fire <= world.time && SS.last_fire + (SS.wait * 0.5) <= world.time) // Check if it's time. + ran_subsystems = 1 + timer = world.timeofday + last_type_processed = SS.type + SS.last_fire = world.time + SS.fire() // Fire the subsystem and record the cost. + SS.cost = MC_AVERAGE(SS.cost, world.timeofday - timer) + if(SS.dynamic_wait) // Adjust wait depending on lag. + var/oldwait = SS.wait + var/global_delta = (subsystem_cost - (SS.cost / (SS.wait / 10))) - 1 + var/newwait = (SS.cost - SS.dwait_buffer + global_delta) * SS.dwait_delta + newwait = newwait * (world.cpu / 100 + 1) + newwait = MC_AVERAGE(oldwait, newwait) + SS.wait = Clamp(newwait, SS.dwait_lower, SS.dwait_upper) + if(oldwait != SS.wait) + processing_interval = calculate_gcd() + SS.next_fire += SS.wait + ++SS.times_fired + // If we caused BYOND to miss a tick, stop processing for a bit... + if(startingtick < world.time || start_time + 1 < world.timeofday) + break + sleep(-1) + + cost = MC_AVERAGE(cost, world.timeofday - start_time) + if(ran_subsystems) + var/oldcost = subsystem_cost + var/newcost = 0 + for(var/datum/subsystem/SS in subsystems) + if (!SS.can_fire) + continue + newcost += SS.cost / (SS.wait / 10) + subsystem_cost = MC_AVERAGE(oldcost, newcost) + + var/extrasleep = 0 + // If we caused BYOND to miss a tick, sleep a bit extra... + if(startingtick < world.time || start_time + 1 < world.timeofday) + extrasleep += world.tick_lag * 2 + // If we are loading the server too much, sleep a bit extra... + if(world.cpu > 80) + extrasleep += extrasleep + processing_interval + sleep(processing_interval + extrasleep) + else + sleep(50) +#undef MC_AVERAGE + +// Determine the GCD of subsystem waits: the longest the MC can wait while still staying on schedule. +/datum/controller/master/proc/calculate_gcd() + var/GCD + // The shortest possible fire rate is the lowest of two ticks or 1 decisecond. + var/minimumInterval = min(world.tick_lag * 2, 1) + + // Loop over each subsystem and determine the GCD based on its wait value. + for(var/datum/subsystem/SS in subsystems) + if(SS.wait) + GCD = Gcd(round(SS.wait * 10), GCD) + GCD = round(GCD) + // If the GCD is less than the minimum, just use the minimum. + if(GCD < minimumInterval * 10) + GCD = minimumInterval * 10 + // Return GCD. + return GCD / 10 + +/datum/controller/master/proc/stat_entry() + if(!statclick) + statclick = new/obj/effect/statclick/debug("Initializing...", src) + + stat("Master Controller:", statclick.update("[round(Master.cost, 0.001)]ds (Interval: [Master.processing_interval] | Iteration:[Master.iteration])")) diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm deleted file mode 100644 index 3fb82f885d2..00000000000 --- a/code/controllers/master_controller.dm +++ /dev/null @@ -1,179 +0,0 @@ -//simplified MC that is designed to fail when procs 'break'. When it fails it's just replaced with a new one. -//It ensures master_controller.process() is never doubled up by killing the MC (hence terminating any of its sleeping procs) - -//Update: all core-systems are now placed inside subsystem datums. This makes them highly configurable and easy to work with. - -var/global/datum/controller/game_controller/master_controller = new() - -/datum/controller/game_controller - var/name = "Master" - var/processing_interval = 1 // The minimum length of time between MC ticks (in deciseconds). The highest this can be without affecting schedules, is the GCD of all subsystem var/wait. Set to 0 to disable all processing. - var/iteration = 0 - var/cost = 0 - var/SSCostPerSecond = 0 - var/last_thing_processed - - var/list/subsystems = list() - - var/obj/effect/statclick/statclick // clickable stat button - -/datum/controller/game_controller/New() - //There can be only one master_controller. Out with the old and in with the new. - if(master_controller != src) - if(istype(master_controller)) - Recover() - qdel(master_controller) - else - init_subtypes(/datum/subsystem, subsystems) - - master_controller = src - calculateGCD() - -/datum/controller/game_controller/Destroy() - ..() - return QDEL_HINT_HARDDEL_NOW - - -/* -calculate the longest number of ticks the MC can wait between each cycle without causing subsystems to not fire on schedule -*/ -/datum/controller/game_controller/proc/calculateGCD() - var/GCD - //shortest fire rate is the lower of two ticks or 1ds - var/minimumInterval = min(world.tick_lag*2,1) - for(var/datum/subsystem/SS in subsystems) - if(SS.wait) - GCD = Gcd(round(SS.wait*10), GCD) - GCD = round(GCD) - if(GCD < minimumInterval*10) - GCD = minimumInterval*10 - processing_interval = GCD/10 - -/datum/controller/game_controller/proc/setup(zlevel) - if (zlevel && zlevel > 0 && zlevel <= world.maxz) - for(var/datum/subsystem/S in subsystems) - S.Initialize(world.timeofday, zlevel) - sleep(-1) - return - world << "Initializing Subsystems..." - - - //sort subsystems by priority, so they initialize in the correct order - sortTim(subsystems, /proc/cmp_subsystem_priority) - - createRandomZlevel() //gate system - setup_map_transitions() - for(var/i=0, iInitializations Complete!" - - world.sleep_offline = 1 - world.fps = config.fps - - sleep(-1) - - process() - -//used for smoothing out the cost values so they don't fluctuate wildly -#define MC_AVERAGE(average, current) (0.8*(average) + 0.2*(current)) - -/datum/controller/game_controller/process() - if(!Failsafe) - new /datum/controller/failsafe() // (re)Start the failsafe. - spawn(0) - var/timer = world.time - for(var/datum/subsystem/SS in subsystems) - timer += processing_interval - SS.next_fire = timer - - var/start_time - - while(1) //far more efficient than recursively calling ourself - if(processing_interval > 0) - ++iteration - var/startingtick = world.time - start_time = world.timeofday - var/SubSystemRan = 0 - for(var/datum/subsystem/SS in subsystems) - if(SS.can_fire > 0) - if(SS.next_fire <= world.time && SS.last_fire+(SS.wait*0.5) <= world.time) - SubSystemRan = 1 - timer = world.timeofday - last_thing_processed = SS.type - SS.last_fire = world.time - SS.fire() - SS.cost = MC_AVERAGE(SS.cost, world.timeofday - timer) - if (SS.dynamic_wait) - var/oldwait = SS.wait - var/GlobalCostDelta = (SSCostPerSecond-(SS.cost/(SS.wait/10)))-1 - var/NewWait = (SS.cost-SS.dwait_buffer+GlobalCostDelta)*SS.dwait_delta - NewWait = NewWait*(world.cpu/100+1) - NewWait = MC_AVERAGE(oldwait,NewWait) - SS.wait = Clamp(NewWait,SS.dwait_lower,SS.dwait_upper) - if (oldwait != SS.wait) - calculateGCD() - SS.next_fire += SS.wait - ++SS.times_fired - //we caused byond to miss a tick, stop processing for a bit - if (startingtick < world.time || start_time+1 < world.timeofday) - break - sleep(-1) - - cost = MC_AVERAGE(cost, world.timeofday - start_time) - if(SubSystemRan) - calculateSScost() - var/extrasleep = 0 - if(startingtick < world.time || start_time+1 < world.timeofday) - //we caused byond to miss a tick, sleep a bit extra - extrasleep += world.tick_lag*2 - if(world.cpu > 80) - extrasleep += extrasleep+processing_interval - sleep(processing_interval+extrasleep) - else - sleep(50) - -/datum/controller/game_controller/proc/calculateSScost() - var/newcost = 0 - for(var/datum/subsystem/SS in subsystems) - if (!SS.can_fire) - continue - newcost += SS.cost/(SS.wait/10) - SSCostPerSecond = MC_AVERAGE(SSCostPerSecond,newcost) - -#undef MC_AVERAGE - -/datum/controller/game_controller/proc/roundHasStarted() - for(var/datum/subsystem/SS in subsystems) - SS.can_fire = 1 - SS.next_fire = world.time + rand(0,SS.wait) - -/datum/controller/game_controller/proc/Recover() - var/msg = "## DEBUG: [time2text(world.timeofday)] MC restarted. Reports:\n" - for(var/varname in master_controller.vars) - switch(varname) - if("tag","bestF","type","parent_type","vars") continue - else - var/varval = master_controller.vars[varname] - if(istype(varval,/datum)) - var/datum/D = varval - msg += "\t [varname] = [D.type]\n" - else - msg += "\t [varname] = [varval]\n" - world.log << msg - - subsystems = master_controller.subsystems - -/datum/controller/game_controller/proc/stat_entry() - if(!statclick) - statclick = new/obj/effect/statclick/debug("Initializing...", src) - - stat("Master Controller:", statclick.update("[round(master_controller.cost, 0.001)]ds (Interval: [master_controller.processing_interval] | Iteration:[master_controller.iteration])")) diff --git a/code/controllers/subsystem/assets.dm b/code/controllers/subsystem/assets.dm new file mode 100644 index 00000000000..06cd9c0bcc9 --- /dev/null +++ b/code/controllers/subsystem/assets.dm @@ -0,0 +1,23 @@ +var/datum/subsystem/assets/SSasset + +/datum/subsystem/assets + name = "Assets" + priority = 19 + + var/list/cache = list() + +/datum/subsystem/assets/New() + NEW_SS_GLOBAL(SSassets) + +/datum/subsystem/assets/Initialize(timeofday, zlevel) + if (zlevel) + return ..() + for(var/type in typesof(/datum/asset) - list(/datum/asset, /datum/asset/simple)) + var/datum/asset/A = new type() + A.register() + + for(var/client/C in clients) + // Doing this to a client too soon after they've connected can cause issues, also the proc we call sleeps. + spawn(10) + getFilesSlow(C, cache, FALSE) + ..() diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm new file mode 100644 index 00000000000..55983952e63 --- /dev/null +++ b/code/controllers/subsystem/minimap.dm @@ -0,0 +1,181 @@ +// Activate this to debug tile mismatches in the minimap. +// This will store the full information on each tile and compare it the next time you run the minimap. +// It can be used to find out what's changed since the last iteration. +// Only activate this when you need it - this should never be active on a live server! +// #define MINIMAP_DEBUG + +var/datum/subsystem/minimap/SSminimap + +/datum/subsystem/minimap + name = "Minimap" + priority = 20 + + var/const/MAX_ICON_DIMENSION = 1024 + var/const/ICON_SIZE = 4 + +/datum/subsystem/minimap/New() + NEW_SS_GLOBAL(SSminimap) + +/datum/subsystem/minimap/Initialize(timeofday, zlevel) + if (zlevel) + return ..() + for(var/z = 1 to world.maxz) + generate(z) + for (var/z = 1 to world.maxz) + register_asset("minimap_[z].png", file("[getMinimapFile(z)].png")) + ..() + +/datum/subsystem/minimap/proc/generate(z, x1 = 1, y1 = 1, x2 = world.maxx, y2 = world.maxy) + var/result_path = "[src.getMinimapFile(z)].png" + var/hash_path = "[src.getMinimapFile(z)].md5" + var/list/tiles = block(locate(x1, y1, z), locate(x2, y2, z)) + var/hash = "" + var/temp + var/obj/obj + + #ifdef MINIMAP_DEBUG + var/tiledata_path = "data/minimaps/debug_tiledata_[z].sav" + var/savefile/F = new/savefile(tiledata_path) + #endif + + // Note for future developer: If you have tiles on the map with random or dynamic icons this hash check will fail + // every time. You'll have to modify this code to generate a unique hash for your object. + // Don't forget to modify the minimap generation code to use a default icon (or skip generation altogether). + for (var/turf/tile in tiles) + if (istype(tile.loc, /area/asteroid) || istype(tile.loc, /area/mine/unexplored) || istype(tile, /turf/simulated/mineral) || (istype(tile.loc, /area/space) && istype(tile, /turf/simulated/floor/plating/asteroid))) + temp = "/area/asteroid" + else if (istype(tile.loc, /area/mine) && istype(tile, /turf/simulated/floor/plating/asteroid)) + temp = "/area/mine/explored" + else if (tile.loc.type == /area/start || (tile.type == /turf/space && !(locate(/obj/structure/lattice) in tile)) || istype(tile, /turf/space/transit)) + temp = "/turf/space" + if (locate(/obj/structure/lattice/catwalk) in tile) + + else + else if (tile.type == /turf/space) + if (locate(/obj/structure/lattice/catwalk) in tile) + temp = "/obj/structure/lattice/catwalk" + else + temp = "/obj/structure/lattice" + else if (tile.type == /turf/simulated/floor/plating/abductor) + temp = "/turf/simulated/floor/plating/abductor" + else if (tile.type == /turf/simulated/floor/plating && (locate(/obj/structure/window/shuttle) in tile)) + temp = "/obj/structure/window/shuttle" + else + temp = "[tile.icon][tile.icon_state][tile.dir]" + + obj = locate(/obj/structure/transit_tube) in tile + + if (obj) temp = "[temp]/obj/structure/transit_tube[obj.icon_state][obj.dir]" + + #ifdef MINIMAP_DEBUG + if (F["/[tile.y]/[tile.x]"] && F["/[tile.y]/[tile.x]"] != temp) + CRASH("Mismatch: [tile.type] at [tile.x],[tile.y],[tile.z] ([tile.icon], [tile.icon_state], [tile.dir])") + else + F["/[tile.y]/[tile.x]"] << temp + #endif + + hash = md5("[hash][temp]") + + if (fexists(result_path)) + if (!fexists(hash_path) || trim(file2text(hash_path)) != hash) + fdel(result_path) + fdel(hash_path) + + if (!fexists(result_path)) + ASSERT(x1 > 0) + ASSERT(y1 > 0) + ASSERT(x2 <= world.maxx) + ASSERT(y2 <= world.maxy) + + var/icon/map_icon = new/icon('html/mapbase1024.png') + + // map_icon is fine and contains only 1 direction at this point. + + ASSERT(map_icon.Width() == MAX_ICON_DIMENSION && map_icon.Height() == MAX_ICON_DIMENSION) + + + var/i = 0 + var/icon/turf_icon + var/icon/obj_icon + var/old_icon + var/old_icon_state + var/old_dir + var/new_icon + var/new_icon_state + var/new_dir + + for (var/turf/tile in tiles) + if (tile.loc.type != /area/start && (tile.type != /turf/space || (locate(/obj/structure/lattice) in tile) || (locate(/obj/structure/transit_tube) in tile)) && !istype(tile, /turf/space/transit)) + if (istype(tile.loc, /area/asteroid) || istype(tile.loc, /area/mine/unexplored) || istype(tile, /turf/simulated/mineral) || (istype(tile.loc, /area/space) && istype(tile, /turf/simulated/floor/plating/asteroid))) + new_icon = 'icons/turf/mining.dmi' + new_icon_state = "rock" + new_dir = 2 + else if (istype(tile.loc, /area/mine) && istype(tile, /turf/simulated/floor/plating/asteroid)) + new_icon = 'icons/turf/floors.dmi' + new_icon_state = "asteroid" + new_dir = 2 + else if (tile.type == /turf/simulated/floor/plating/abductor) + new_icon = 'icons/turf/floors.dmi' + new_icon_state = "alienpod1" + new_dir = 2 + else if (tile.type == /turf/space) + obj = locate(/obj/structure/lattice) in tile + + if (!obj) obj = locate(/obj/structure/transit_tube) in tile + + ASSERT(obj != null) + + if (obj) + new_icon = obj.icon + new_dir = obj.dir + new_icon_state = obj.icon_state + else if (tile.type == /turf/simulated/floor/plating && (locate(/obj/structure/window/shuttle) in tile)) + new_icon = 'icons/obj/structures.dmi' + new_dir = 2 + new_icon_state = "swindow" + else + new_icon = tile.icon + new_icon_state = tile.icon_state + new_dir = tile.dir + + if (new_icon != old_icon || new_icon_state != old_icon_state || new_dir != old_dir) + old_icon = new_icon + old_icon_state = new_icon_state + old_dir = new_dir + + turf_icon = new/icon(new_icon, new_icon_state, new_dir, 1, 0) + turf_icon.Scale(ICON_SIZE, ICON_SIZE) + + if (tile.type != /turf/space || (locate(/obj/structure/lattice) in tile)) + obj = locate(/obj/structure/transit_tube) in tile + + if (obj) + obj_icon = new/icon(obj.icon, obj.icon_state, obj.dir, 1, 0) + obj_icon.Scale(ICON_SIZE, ICON_SIZE) + turf_icon.Blend(obj_icon, ICON_OVERLAY) + + map_icon.Blend(turf_icon, ICON_OVERLAY, ((tile.x - 1) * ICON_SIZE), ((tile.y - 1) * ICON_SIZE)) + + if ((++i) % 512 == 0) sleep(1) // deliberate delay to avoid lag spikes + + else + sleep(-1) // avoid sleeping if possible: prioritize pending procs + + // BYOND BUG: map_icon now contains 4 directions? Create a new icon with only a single state. + var/icon/result_icon = new/icon() + + result_icon.Insert(map_icon, "", SOUTH, 1, 0) + + fcopy(result_icon, result_path) + text2file(hash, hash_path) + +/datum/subsystem/minimap/proc/getMinimapFile(zlevel) + return "data/minimaps/map_[zlevel]" + +/datum/subsystem/minimap/proc/sendMinimaps(client/client) + for (var/z = 1 to world.maxz) + send_asset(client, "minimap_[z].png") + +#ifdef MINIMAP_DEBUG +#undef MINIMAP_DEBUG +#endif \ No newline at end of file diff --git a/code/controllers/subsystem/nano.dm b/code/controllers/subsystem/nano.dm index 44665c1a57d..d3abbc9f871 100644 --- a/code/controllers/subsystem/nano.dm +++ b/code/controllers/subsystem/nano.dm @@ -11,13 +11,11 @@ var/datum/subsystem/nano/SSnano /datum/subsystem/nano/New() - NEW_SS_GLOBAL(SSnano) // Register the subsystem. - + NEW_SS_GLOBAL(SSnano) /datum/subsystem/nano/stat_entry() ..("O:[open_uis.len]|P:[processing_uis.len]") // Show how many interfaces we have open/are processing. - /datum/subsystem/nano/fire() // Process UIs. for(var/thing in processing_uis) var/datum/nanoui/ui = thing diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index cc39f2d6e6a..e0e07ae2303 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -20,7 +20,7 @@ var/datum/subsystem/ticker/ticker var/list/datum/mind/minds = list() //The characters in the game. Used for objective tracking. - //These bible variables should be a preference + //These bible variables should be a preference var/Bible_icon_state //icon_state the chaplain has chosen for his bible var/Bible_item_state //item_state the chaplain has chosen for his bible var/Bible_name //name of the bible @@ -178,8 +178,7 @@ var/datum/subsystem/ticker/ticker equip_characters() data_core.manifest() - master_controller.roundHasStarted() - + Master.RoundStart() world << "Welcome to [station_name()], enjoy your stay!" world << sound('sound/AI/welcome.ogg') diff --git a/code/controllers/subsystems.dm b/code/controllers/subsystems.dm index 9c2c6e74dbf..32486ba9486 100644 --- a/code/controllers/subsystems.dm +++ b/code/controllers/subsystems.dm @@ -1,32 +1,34 @@ #define NEW_SS_GLOBAL(varname) if(varname != src){if(istype(varname)){Recover();qdel(varname);}varname = src;} /datum/subsystem - //things you will want to define + // Metadata; you should define these. var/name //name of the subsystem var/priority = 0 //priority affects order of initialization. Higher priorities are initialized first, lower priorities later. Can be decimal and negative values. var/wait = 20 //time to wait (in deciseconds) between each call to fire(). Must be a positive integer. - //Dynamic Wait - A system for scaling a subsystem's fire rate based on lag - //The algorithm is: (cost-dwait_buffer+AvgCostOfAllOtherSSPerSecond)*dwait_delta - //defaults are pretty sane for most use cases. - //you can change how quickly it starts scaling back with dwait_buffer, - //and you can change how much it scales back with dwait_delta + // Dynamic Wait + // A system for scaling a subsystem's fire rate based on lag. + // The algorithm is: (cost - dwait_buffer + subsystem_cost) * dwait_delta + // Defaults are pretty sane for most use cases. + // You can change how quickly it starts scaling back with dwait_buffer, + // and you can change how much it scales back with dwait_delta. var/dynamic_wait = 0 //changes the wait based on the amount of time it took to process var/dwait_upper = 20 //longest wait can be under dynamic_wait var/dwait_lower = 5 //shortest wait can be under dynamic_wait var/dwait_delta = 7 //How much should processing time effect dwait. or basically: wait = cost*dwait_delta var/dwait_buffer = 0.7 //This number is subtracted from the processing time before calculating its new wait - //things you will probably want to leave alone + // Bookkeeping variables; probably shouldn't mess with these. var/can_fire = 0 //prevent fire() calls var/last_fire = 0 //last world.time we called fire() var/next_fire = 0 //scheduled world.time for next fire() var/cost = 0 //average time to execute var/times_fired = 0 //number of times we have called fire() - var/obj/effect/statclick/statclick // clickable stat button + // The object used for the clickable stat() button. + var/obj/effect/statclick/statclick -//used to initialize the subsystem BEFORE the map has loaded +// Used to initialize the subsystem BEFORE the map has loaded /datum/subsystem/New() //previously, this would have been named 'process()' but that name is used everywhere for different things! diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm index 8b1269d8883..9ecc9cd17ec 100644 --- a/code/game/machinery/computer/crew.dm +++ b/code/game/machinery/computer/crew.dm @@ -26,10 +26,6 @@ var/global/datum/crewmonitor/crewmonitor = new var/list/jobs var/list/interfaces var/list/data - var/const/MAX_ICON_DIMENSION = 1024 - var/const/ICON_SIZE = 4 - var/initialized = FALSE - var/max_initialized_zlevel = 0 /datum/crewmonitor/New() . = ..() @@ -257,176 +253,7 @@ var/global/datum/crewmonitor/crewmonitor = new /datum/crewmonitor/proc/queueUpdate(z) addtimer(crewmonitor, "update", 5, TRUE, z) -/datum/crewmonitor/proc/generateMiniMaps() - for(var/z = 1 to world.maxz) - generateMiniMap(z) - for (var/z = 1 to world.maxz) - register_asset("minimap_[z].png", file("[getMinimapFile(z)].png")) - - max_initialized_zlevel = world.maxz - - world << "All minimaps have been generated." - initialized = TRUE - /datum/crewmonitor/proc/sendResources(var/client/client) send_asset(client, "crewmonitor.js") send_asset(client, "crewmonitor.css") - for (var/z = 1 to max_initialized_zlevel) - send_asset(client, "minimap_[z].png") - -/datum/crewmonitor/proc/getMinimapFile(z) - return "data/minimaps/map_[z]" - -// Activate this to debug tile mismatches in the minimap. -// This will store the full information on each tile and compare it the next time you run the minimap. -// It can be used to find out what's changed since the last iteration. -// Only activate this when you need it - this should never be active on a live server! -// #define MINIMAP_DEBUG - -/datum/crewmonitor/proc/generateMiniMap(z, x1 = 1, y1 = 1, x2 = world.maxx, y2 = world.maxy) - var/result_path = "[src.getMinimapFile(z)].png" - var/hash_path = "[src.getMinimapFile(z)].md5" - var/list/tiles = block(locate(x1, y1, z), locate(x2, y2, z)) - var/hash = "" - var/temp - var/obj/obj - - #ifdef MINIMAP_DEBUG - var/tiledata_path = "data/minimaps/debug_tiledata_[z].sav" - var/savefile/F = new/savefile(tiledata_path) - #endif - - // Note for future developer: If you have tiles on the map with random or dynamic icons this hash check will fail - // every time. You'll have to modify this code to generate a unique hash for your object. - // Don't forget to modify the minimap generation code to use a default icon (or skip generation altogether). - for (var/turf/tile in tiles) - if (istype(tile.loc, /area/asteroid) || istype(tile.loc, /area/mine/unexplored) || istype(tile, /turf/simulated/mineral) || (istype(tile.loc, /area/space) && istype(tile, /turf/simulated/floor/plating/asteroid))) - temp = "/area/asteroid" - else if (istype(tile.loc, /area/mine) && istype(tile, /turf/simulated/floor/plating/asteroid)) - temp = "/area/mine/explored" - else if (tile.loc.type == /area/start || (tile.type == /turf/space && !(locate(/obj/structure/lattice) in tile)) || istype(tile, /turf/space/transit)) - temp = "/turf/space" - if (locate(/obj/structure/lattice/catwalk) in tile) - - else - else if (tile.type == /turf/space) - if (locate(/obj/structure/lattice/catwalk) in tile) - temp = "/obj/structure/lattice/catwalk" - else - temp = "/obj/structure/lattice" - else if (tile.type == /turf/simulated/floor/plating/abductor) - temp = "/turf/simulated/floor/plating/abductor" - else if (tile.type == /turf/simulated/floor/plating && (locate(/obj/structure/window/shuttle) in tile)) - temp = "/obj/structure/window/shuttle" - else - temp = "[tile.icon][tile.icon_state][tile.dir]" - - obj = locate(/obj/structure/transit_tube) in tile - - if (obj) temp = "[temp]/obj/structure/transit_tube[obj.icon_state][obj.dir]" - - #ifdef MINIMAP_DEBUG - if (F["/[tile.y]/[tile.x]"] && F["/[tile.y]/[tile.x]"] != temp) - CRASH("Mismatch: [tile.type] at [tile.x],[tile.y],[tile.z] ([tile.icon], [tile.icon_state], [tile.dir])") - else - F["/[tile.y]/[tile.x]"] << temp - #endif - - hash = md5("[hash][temp]") - - if (fexists(result_path)) - if (!fexists(hash_path) || trim(file2text(hash_path)) != hash) - fdel(result_path) - fdel(hash_path) - - if (!fexists(result_path)) - ASSERT(x1 > 0) - ASSERT(y1 > 0) - ASSERT(x2 <= world.maxx) - ASSERT(y2 <= world.maxy) - - var/icon/map_icon = new/icon('html/mapbase1024.png') - - // map_icon is fine and contains only 1 direction at this point. - - ASSERT(map_icon.Width() == MAX_ICON_DIMENSION && map_icon.Height() == MAX_ICON_DIMENSION) - - - var/i = 0 - var/icon/turf_icon - var/icon/obj_icon - var/old_icon - var/old_icon_state - var/old_dir - var/new_icon - var/new_icon_state - var/new_dir - - for (var/turf/tile in tiles) - if (tile.loc.type != /area/start && (tile.type != /turf/space || (locate(/obj/structure/lattice) in tile) || (locate(/obj/structure/transit_tube) in tile)) && !istype(tile, /turf/space/transit)) - if (istype(tile.loc, /area/asteroid) || istype(tile.loc, /area/mine/unexplored) || istype(tile, /turf/simulated/mineral) || (istype(tile.loc, /area/space) && istype(tile, /turf/simulated/floor/plating/asteroid))) - new_icon = 'icons/turf/mining.dmi' - new_icon_state = "rock" - new_dir = 2 - else if (istype(tile.loc, /area/mine) && istype(tile, /turf/simulated/floor/plating/asteroid)) - new_icon = 'icons/turf/floors.dmi' - new_icon_state = "asteroid" - new_dir = 2 - else if (tile.type == /turf/simulated/floor/plating/abductor) - new_icon = 'icons/turf/floors.dmi' - new_icon_state = "alienpod1" - new_dir = 2 - else if (tile.type == /turf/space) - obj = locate(/obj/structure/lattice) in tile - - if (!obj) obj = locate(/obj/structure/transit_tube) in tile - - ASSERT(obj != null) - - if (obj) - new_icon = obj.icon - new_dir = obj.dir - new_icon_state = obj.icon_state - else if (tile.type == /turf/simulated/floor/plating && (locate(/obj/structure/window/shuttle) in tile)) - new_icon = 'icons/obj/structures.dmi' - new_dir = 2 - new_icon_state = "swindow" - else - new_icon = tile.icon - new_icon_state = tile.icon_state - new_dir = tile.dir - - if (new_icon != old_icon || new_icon_state != old_icon_state || new_dir != old_dir) - old_icon = new_icon - old_icon_state = new_icon_state - old_dir = new_dir - - turf_icon = new/icon(new_icon, new_icon_state, new_dir, 1, 0) - turf_icon.Scale(ICON_SIZE, ICON_SIZE) - - if (tile.type != /turf/space || (locate(/obj/structure/lattice) in tile)) - obj = locate(/obj/structure/transit_tube) in tile - - if (obj) - obj_icon = new/icon(obj.icon, obj.icon_state, obj.dir, 1, 0) - obj_icon.Scale(ICON_SIZE, ICON_SIZE) - turf_icon.Blend(obj_icon, ICON_OVERLAY) - - map_icon.Blend(turf_icon, ICON_OVERLAY, ((tile.x - 1) * ICON_SIZE), ((tile.y - 1) * ICON_SIZE)) - - if ((++i) % 512 == 0) sleep(1) // deliberate delay to avoid lag spikes - - else - sleep(-1) // avoid sleeping if possible: prioritize pending procs - - // BYOND BUG: map_icon now contains 4 directions? Create a new icon with only a single state. - var/icon/result_icon = new/icon() - - result_icon.Insert(map_icon, "", SOUTH, 1, 0) - - fcopy(result_icon, result_path) - text2file(hash, hash_path) - -#ifdef MINIMAP_DEBUG -#undef MINIMAP_DEBUG -#endif + SSminimap.sendMinimaps(client) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 894d847646b..07881623118 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -118,7 +118,6 @@ var/list/admin_verbs_debug = list( /client/proc/cmd_admin_list_open_jobs, /client/proc/Debug2, /client/proc/cmd_debug_make_powernets, - /client/proc/debug_controller, /client/proc/cmd_debug_mob_lists, /client/proc/cmd_admin_delete, /client/proc/cmd_debug_del_all, @@ -203,7 +202,6 @@ var/list/admin_verbs_hideable = list( /client/proc/Debug2, /client/proc/reload_admins, /client/proc/cmd_debug_make_powernets, - /client/proc/debug_controller, /client/proc/startSinglo, /client/proc/cmd_debug_mob_lists, /client/proc/cmd_debug_del_all, diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 74384f6a8c4..ad7d2574683 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -58,7 +58,7 @@ var/intercom_range_display_status = 0 set category = "Mapping" set name = "Camera Report" - if(!master_controller) + if(!Master) alert(usr,"Master_controller not found.","Sec Camera Report") return 0 diff --git a/code/modules/client/asset_cache.dm b/code/modules/client/asset_cache.dm index 721a7827941..2ce122f85fd 100644 --- a/code/modules/client/asset_cache.dm +++ b/code/modules/client/asset_cache.dm @@ -17,9 +17,6 @@ You can set verify to TRUE if you want send() to sleep until the client has the //When sending mutiple assets, how many before we give the client a quaint little sending resources message #define ASSET_CACHE_TELL_CLIENT_AMOUNT 8 -//List of ALL assets for the above, format is list(filename = asset). -/var/global/list/asset_cache = list() - /client var/list/cache = list() // List of all assets sent to this client by the asset cache. var/list/completed_asset_jobs = list() // List of all completed jobs, awaiting acknowledgement. @@ -44,7 +41,7 @@ You can set verify to TRUE if you want send() to sleep until the client has the if(client.cache.Find(asset_name) || client.sending.Find(asset_name)) return 0 - client << browse_rsc(asset_cache[asset_name], asset_name) + client << browse_rsc(SSasset.cache[asset_name], asset_name) if(!verify || !winexists(client, "asset_cache_browser")) // Can't access the asset cache browser, rip. if (client) client.cache += asset_name @@ -94,8 +91,8 @@ You can set verify to TRUE if you want send() to sleep until the client has the if (unreceived.len >= ASSET_CACHE_TELL_CLIENT_AMOUNT) client << "Sending Resources..." for(var/asset in unreceived) - if (asset in asset_cache) - client << browse_rsc(asset_cache[asset], asset) + if (asset in SSasset.cache) + client << browse_rsc(SSasset.cache[asset], asset) if(!verify || !winexists(client, "asset_cache_browser")) // Can't access the asset cache browser, rip. if (client) @@ -127,7 +124,7 @@ You can set verify to TRUE if you want send() to sleep until the client has the //This proc will download the files without clogging up the browse() queue, used for passively sending files on connection start. //The proc calls procs that sleep for long times. -proc/getFilesSlow(var/client/client, var/list/files, var/register_asset = TRUE) +/proc/getFilesSlow(var/client/client, var/list/files, var/register_asset = TRUE) for(var/file in files) if (!client) break @@ -139,18 +136,7 @@ proc/getFilesSlow(var/client/client, var/list/files, var/register_asset = TRUE) //This proc "registers" an asset, it adds it to the cache for further use, you cannot touch it from this point on or you'll fuck things up. //if it's an icon or something be careful, you'll have to copy it before further use. /proc/register_asset(var/asset_name, var/asset) - asset_cache[asset_name] = asset - -//From here on out it's populating the asset cache. -/proc/populate_asset_cache() - for(var/type in typesof(/datum/asset) - list(/datum/asset, /datum/asset/simple)) - var/datum/asset/A = new type() - A.register() - - for(var/client/C in clients) - //doing this to a client too soon after they've connected can cause issues, also the proc we call sleeps - spawn(10) - getFilesSlow(C, asset_cache, FALSE) + SSasset.cache[asset_name] = asset //These datums are used to populate the asset cache, the proc "register()" does this. diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 162739f4b2c..f05466bf81d 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -179,7 +179,7 @@ var/next_external_rsc = 0 else if (isnum(player_age) && player_age < config.notify_new_player_age) message_admins("New user: [key_name_admin(src)] just connected with an age of [player_age] day[(player_age==1?"":"s")]") - + sync_client_with_db() send_resources() @@ -328,4 +328,4 @@ var/next_external_rsc = 0 ) spawn (10) //Precache the client with all other assets slowly, so as to not block other browse() calls - getFilesSlow(src, asset_cache, register_asset = FALSE) + getFilesSlow(src, SSasset.cache, register_asset = FALSE) diff --git a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm b/code/modules/mob/living/silicon/ai/freelook/cameranet.dm index dfa2e7bb970..a858c975505 100644 --- a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm +++ b/code/modules/mob/living/silicon/ai/freelook/cameranet.dm @@ -7,12 +7,17 @@ var/const/CHUNK_SIZE = 16 // Only chunk sizes that are to the power of 2. E.g: 2 var/datum/cameranet/cameranet = new() /datum/cameranet + var/name = "Camera Net" // Name to show for VV and stat() + // The cameras on the map, no matter if they work or not. Updated in obj/machinery/camera.dm by New() and Del(). var/list/cameras = list() // The chunks of the map, mapping the areas that the cameras can see. var/list/chunks = list() var/ready = 0 + // The object used for the clickable stat() button. + var/obj/effect/statclick/statclick + // Checks if a chunk has been Generated in x, y, z. /datum/cameranet/proc/chunkGenerated(x, y, z) x &= ~(CHUNK_SIZE - 1) @@ -142,6 +147,11 @@ var/datum/cameranet/cameranet = new() return 1 return 0 +/datum/cameranet/proc/stat_entry() + if(!statclick) + statclick = new/obj/effect/statclick/debug("Initializing...", src) + + stat(name, statclick.update("Cameras: [cameranet.cameras.len] | Chunks: [cameranet.chunks.len]")) // Debug verb for VVing the chunk that the turf is in. /* @@ -151,4 +161,4 @@ var/datum/cameranet/cameranet = new() if(cameranet.chunkGenerated(x, y, z)) var/datum/camerachunk/chunk = cameranet.getCameraChunk(x, y, z) usr.client.debug_variables(chunk) -*/ +*/ \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index ff20083da39..1c252214669 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -653,20 +653,21 @@ var/list/slot_equipment_priority = list( \ stat("Location:", "([x], [y], [z])") stat("CPU:", "[world.cpu]") stat("Instances:", "[world.contents.len]") - if(master_controller) - master_controller.stat_entry() + config.stat_entry() + if(Master) + Master.stat_entry() else stat("Master Controller:", "ERROR") if(Failsafe) Failsafe.stat_entry() else stat("Failsafe Controller:", "ERROR") - if(master_controller) - stat("Subsystems:", "[round(master_controller.SSCostPerSecond, 0.001)]ds") + if(Master) + stat("Subsystems:", "[round(Master.subsystem_cost, 0.001)]ds") stat(null) - for(var/datum/subsystem/SS in master_controller.subsystems) - if(SS.can_fire) - SS.stat_entry() + for(var/datum/subsystem/SS in Master.subsystems) + SS.stat_entry() + cameranet.stat_entry() if(listed_turf && client) if(!TurfAdjacent(listed_turf)) diff --git a/code/world.dm b/code/world.dm index d47c2a97b62..fd74041e456 100644 --- a/code/world.dm +++ b/code/world.dm @@ -54,9 +54,8 @@ var/global/list/map_transition_config = MAP_TRANSITION_CONFIG data_core = new /datum/datacore() - spawn(-1) - master_controller.setup() + Master.Setup() process_teleport_locs() //Sets up the wizard teleport locations SortAreas() //Build the list of all existing areas and sort it alphabetically diff --git a/tgstation.dme b/tgstation.dme index eb4129eb273..49766e6760f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -140,16 +140,19 @@ #include "code\ATMOSPHERICS\pipes\heat_exchange\simple.dm" #include "code\controllers\admin.dm" #include "code\controllers\configuration.dm" +#include "code\controllers\controller.dm" #include "code\controllers\failsafe.dm" -#include "code\controllers\master_controller.dm" +#include "code\controllers\master.dm" #include "code\controllers\subsystems.dm" #include "code\controllers\subsystem\air.dm" +#include "code\controllers\subsystem\assets.dm" #include "code\controllers\subsystem\diseases.dm" #include "code\controllers\subsystem\events.dm" #include "code\controllers\subsystem\garbage.dm" #include "code\controllers\subsystem\jobs.dm" #include "code\controllers\subsystem\lighting.dm" #include "code\controllers\subsystem\machines.dm" +#include "code\controllers\subsystem\minimap.dm" #include "code\controllers\subsystem\mobs.dm" #include "code\controllers\subsystem\nano.dm" #include "code\controllers\subsystem\npcpool.dm" From 703290e4a9a88369b788eabd3641b38496589e62 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Fri, 4 Dec 2015 15:45:23 -0600 Subject: [PATCH 3/7] Take feedback into account --- code/controllers/admin.dm | 6 +++--- code/controllers/subsystem/assets.dm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/controllers/admin.dm b/code/controllers/admin.dm index 99b7452a12b..8e947f69a4f 100644 --- a/code/controllers/admin.dm +++ b/code/controllers/admin.dm @@ -3,14 +3,14 @@ var/target /obj/effect/statclick/New(text, target) - src.name = text + name = text src.target = target /obj/effect/statclick/proc/update(text) - src.name = text + name = text return src -/obj/effect/statclick +/obj/effect/statclick/debug var/class /obj/effect/statclick/debug/Click() diff --git a/code/controllers/subsystem/assets.dm b/code/controllers/subsystem/assets.dm index 06cd9c0bcc9..fc57053c338 100644 --- a/code/controllers/subsystem/assets.dm +++ b/code/controllers/subsystem/assets.dm @@ -7,7 +7,7 @@ var/datum/subsystem/assets/SSasset var/list/cache = list() /datum/subsystem/assets/New() - NEW_SS_GLOBAL(SSassets) + NEW_SS_GLOBAL(SSasset) /datum/subsystem/assets/Initialize(timeofday, zlevel) if (zlevel) From 34b717afb436c27cea975470552b36a238f821d1 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Fri, 4 Dec 2015 22:25:24 -0600 Subject: [PATCH 4/7] radio_controller -> SSradio, SSbp -> SSnpc --- .../components/binary_devices/dp_vent_pump.dm | 8 +++---- .../components/binary_devices/passive_gate.dm | 8 +++---- .../components/binary_devices/pump.dm | 8 +++---- .../components/binary_devices/volume_pump.dm | 8 +++---- .../components/trinary_devices/filter.dm | 8 +++---- .../unary_devices/outlet_injector.dm | 8 +++---- .../components/unary_devices/vent_pump.dm | 8 +++---- .../components/unary_devices/vent_scrubber.dm | 8 +++---- code/controllers/master.dm | 15 +++++------- code/controllers/subsystem/npcpool.dm | 6 ++--- code/controllers/subsystem/radio.dm | 4 ++-- .../subsystem/server_maintenance.dm | 5 ++++ code/controllers/subsystem/shuttles/supply.dm | 2 +- code/controllers/subsystem/ticker.dm | 6 ++--- code/game/asteroid.dm | 4 ++++ code/game/communications.dm | 2 +- code/game/machinery/airlock_control.dm | 20 ++++++++-------- code/game/machinery/alarm.dm | 10 ++++---- code/game/machinery/atmo_control.dm | 24 +++++++++---------- code/game/machinery/atmoalter/meter.dm | 2 +- code/game/machinery/computer/atmos_alert.dm | 8 +++---- .../game/machinery/computer/communications.dm | 2 +- code/game/machinery/doors/alarmlock.dm | 8 +++---- .../embedded_controller_base.dm | 8 +++---- code/game/machinery/magnet.dm | 16 ++++++------- code/game/machinery/status_display.dm | 8 +++---- code/game/machinery/telecomms/broadcasting.dm | 4 ++-- code/game/objects/items/devices/PDA/cart.dm | 2 +- code/game/objects/items/devices/PDA/radio.dm | 10 ++++---- .../items/devices/radio/electropack.dm | 12 +++++----- .../objects/items/devices/radio/headset.dm | 2 +- .../game/objects/items/devices/radio/radio.dm | 6 ++--- .../objects/items/weapons/storage/toolbox.dm | 2 +- code/modules/admin/verbs/diagnostics.dm | 4 ++-- code/modules/assembly/signaler.dm | 12 +++++----- code/modules/client/preferences_toggles.dm | 2 +- code/modules/events/alien_infestation.dm | 2 +- code/modules/mob/interactive.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 2 +- .../mob/living/carbon/human/whisper.dm | 4 ++-- code/modules/mob/say_readme.dm | 2 +- 41 files changed, 143 insertions(+), 139 deletions(-) diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index 7ec41e04ea2..f82323920df 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -33,8 +33,8 @@ Acts like a normal vent, but has an input AND output. //OUTPUT_MAX: Do not pass output_pressure_max /obj/machinery/atmospherics/components/binary/dp_vent_pump/Destroy() - if(radio_controller) - radio_controller.remove_object(src, frequency) + if(SSradio) + SSradio.remove_object(src, frequency) return ..() /obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume @@ -117,10 +117,10 @@ Acts like a normal vent, but has an input AND output. //Radio remote control /obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) - radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) + radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA) /obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/broadcast_status() if(!radio_connection) diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index b3a06a7581c..c43e9c33b72 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -23,8 +23,8 @@ Passive gate is similar to the regular pump except: var/datum/radio_frequency/radio_connection /obj/machinery/atmospherics/components/binary/passive_gate/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) return ..() /obj/machinery/atmospherics/components/binary/passive_gate/update_icon_nopipes() @@ -68,10 +68,10 @@ Passive gate is similar to the regular pump except: //Radio remote control /obj/machinery/atmospherics/components/binary/passive_gate/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) - radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) + radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA) /obj/machinery/atmospherics/components/binary/passive_gate/proc/broadcast_status() if(!radio_connection) diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index 454702d06bf..5062bd6dcf3 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -27,8 +27,8 @@ Thus, the two variables affect pump operation are set in New(): var/datum/radio_frequency/radio_connection /obj/machinery/atmospherics/components/binary/pump/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) if(radio_connection) radio_connection = null return ..() @@ -73,10 +73,10 @@ Thus, the two variables affect pump operation are set in New(): //Radio remote control /obj/machinery/atmospherics/components/binary/pump/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) - radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA) + radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA) /obj/machinery/atmospherics/components/binary/pump/proc/broadcast_status() if(!radio_connection) diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm index 7ad3b927e7b..ead30d5e6d9 100644 --- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm @@ -27,8 +27,8 @@ Thus, the two variables affect pump operation are set in New(): var/datum/radio_frequency/radio_connection /obj/machinery/atmospherics/components/binary/volume_pump/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) return ..() /obj/machinery/atmospherics/components/binary/volume_pump/on @@ -70,10 +70,10 @@ Thus, the two variables affect pump operation are set in New(): return 1 /obj/machinery/atmospherics/components/binary/volume_pump/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) - radio_connection = radio_controller.add_object(src, frequency) + radio_connection = SSradio.add_object(src, frequency) /obj/machinery/atmospherics/components/binary/volume_pump/proc/broadcast_status() if(!radio_connection) diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm index 2f176d0185a..11b47197251 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -39,14 +39,14 @@ Filter types: flipped = 1 /obj/machinery/atmospherics/components/trinary/filter/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) - radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) + radio_connection = SSradio.add_object(src, frequency, RADIO_ATMOSIA) /obj/machinery/atmospherics/components/trinary/filter/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) return ..() /obj/machinery/atmospherics/components/trinary/filter/update_icon() diff --git a/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm b/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm index df9af8f6cfc..14d15192db1 100644 --- a/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm @@ -17,8 +17,8 @@ level = 1 /obj/machinery/atmospherics/components/unary/outlet_injector/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) return ..() /obj/machinery/atmospherics/components/unary/outlet_injector/on @@ -79,10 +79,10 @@ flick("inje_inject", src) /obj/machinery/atmospherics/components/unary/outlet_injector/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) - radio_connection = radio_controller.add_object(src, frequency) + radio_connection = SSradio.add_object(src, frequency) /obj/machinery/atmospherics/components/unary/outlet_injector/proc/broadcast_status() if(!radio_connection) diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm index 67581c3aa98..fd6fef1583a 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm @@ -60,8 +60,8 @@ id_tag = num2text(uid) /obj/machinery/atmospherics/components/unary/vent_pump/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) radio_connection = null if(initial_loc) initial_loc.air_vent_info -= id_tag @@ -154,10 +154,10 @@ //Radio remote control /obj/machinery/atmospherics/components/unary/vent_pump/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) - radio_connection = radio_controller.add_object(src, frequency,radio_filter_in) + radio_connection = SSradio.add_object(src, frequency,radio_filter_in) /obj/machinery/atmospherics/components/unary/vent_pump/proc/broadcast_status() if(!radio_connection) diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm index c67090bf6d5..1e4e34f5b3a 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm @@ -49,8 +49,8 @@ id_tag = num2text(uid) /obj/machinery/atmospherics/components/unary/vent_scrubber/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) radio_connection = null if(initial_loc) initial_loc.air_scrub_info -= id_tag @@ -103,9 +103,9 @@ icon_state = "scrub_purge" /obj/machinery/atmospherics/components/unary/vent_scrubber/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, radio_filter_in) + radio_connection = SSradio.add_object(src, frequency, radio_filter_in) /obj/machinery/atmospherics/components/unary/vent_scrubber/proc/broadcast_status() if(!radio_connection) diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 2f94574a797..805092ef621 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -70,27 +70,24 @@ var/global/datum/controller/master/Master = new() SS.Initialize(world.timeofday, zlevel) sleep(-1) return - world << "Initializing Subsystems..." - - - // Sort subsystems by priority, so they initialize in the correct order. - sortTim(subsystems, /proc/cmp_subsystem_priority) + world << "Initializing subsystems..." // Pick a random away mission. createRandomZlevel() + // Generate asteroid. + make_mining_asteroid_secrets() // Set up Z-level transistions. setup_map_transitions() - // Generate asteroid. - for(1 to max_secret_rooms) - make_mining_asteroid_secret() + // Sort subsystems by priority, so they initialize in the correct order. + sortTim(subsystems, /proc/cmp_subsystem_priority) // Initialize subsystems. for(var/datum/subsystem/SS in subsystems) SS.Initialize(world.timeofday, zlevel) sleep(-1) - world << "Initializations Complete!" + world << "Initializations complete!" // Set world options. world.sleep_offline = 1 diff --git a/code/controllers/subsystem/npcpool.dm b/code/controllers/subsystem/npcpool.dm index 580464eca10..4032b00640c 100644 --- a/code/controllers/subsystem/npcpool.dm +++ b/code/controllers/subsystem/npcpool.dm @@ -1,7 +1,7 @@ -var/datum/subsystem/npcpool/SSbp +var/datum/subsystem/npcpool/SSnpc /datum/subsystem/npcpool - name = "NPCPool" + name = "NPC Pool" priority = 100 var/list/canBeUsed = list() @@ -17,7 +17,7 @@ var/datum/subsystem/npcpool/SSbp botPool_l |= toInsert /datum/subsystem/npcpool/New() - NEW_SS_GLOBAL(SSbp) + NEW_SS_GLOBAL(SSnpc) /datum/subsystem/npcpool/stat_entry() ..("T:[botPool_l.len + botPool_l_non.len]|D:[needsDelegate.len]|A:[needsAssistant.len + needsHelp_non.len]|U:[canBeUsed.len + canBeUsed_non.len]") diff --git a/code/controllers/subsystem/radio.dm b/code/controllers/subsystem/radio.dm index 110f48d8f42..932118812c8 100644 --- a/code/controllers/subsystem/radio.dm +++ b/code/controllers/subsystem/radio.dm @@ -1,4 +1,4 @@ -var/datum/subsystem/radio/radio_controller +var/datum/subsystem/radio/SSradio /datum/subsystem/radio name = "Radio" @@ -7,7 +7,7 @@ var/datum/subsystem/radio/radio_controller var/list/datum/radio_frequency/frequencies = list() /datum/subsystem/radio/New() - NEW_SS_GLOBAL(radio_controller) + NEW_SS_GLOBAL(SSradio) /datum/subsystem/radio/proc/add_object(obj/device, new_frequency as num, filter = null as text|null) var/f_text = num2text(new_frequency) diff --git a/code/controllers/subsystem/server_maintenance.dm b/code/controllers/subsystem/server_maintenance.dm index 1aa7ef7d1cc..1799052df99 100644 --- a/code/controllers/subsystem/server_maintenance.dm +++ b/code/controllers/subsystem/server_maintenance.dm @@ -1,8 +1,13 @@ +var/datum/subsystem/server_maint/SSserver + /datum/subsystem/server_maint name = "Server Tasks" wait = 6000 priority = 19 +/datum/subsystem/server_maint/New() + NEW_SS_GLOBAL(SSserver) + /datum/subsystem/server_maint/fire() //handle kicking inactive players if(config.kick_inactive > 0) diff --git a/code/controllers/subsystem/shuttles/supply.dm b/code/controllers/subsystem/shuttles/supply.dm index 05aeb4b9dec..8c76c882de6 100644 --- a/code/controllers/subsystem/shuttles/supply.dm +++ b/code/controllers/subsystem/shuttles/supply.dm @@ -547,7 +547,7 @@ /obj/machinery/computer/supplycomp/proc/post_signal(command) - var/datum/radio_frequency/frequency = radio_controller.return_frequency(1435) + var/datum/radio_frequency/frequency = SSradio.return_frequency(1435) if(!frequency) return diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index e0e07ae2303..bc7e0196040 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -67,7 +67,7 @@ var/datum/subsystem/ticker/ticker switch(current_state) if(GAME_STATE_STARTUP) timeLeft = config.lobby_countdown * 10 - world << "Welcome to the pre-game lobby!" + world << "Welcome to the pre-game lobby!" world << "Please, setup your character and select ready. Game will start in [config.lobby_countdown] seconds" current_state = GAME_STATE_PREGAME @@ -204,7 +204,7 @@ var/datum/subsystem/ticker/ticker return 1 - //Plus it provides an easy way to make cinematics for other events. Just use this as a template +//Plus it provides an easy way to make cinematics for other events. Just use this as a template /datum/subsystem/ticker/proc/station_explosion_cinematic(station_missed=0, override = null) if( cinematic ) return //already a cinematic in progress! @@ -260,8 +260,6 @@ var/datum/subsystem/ticker/ticker if(2) //nuke was nowhere nearby //TODO: a really distant explosion animation sleep(50) world << sound('sound/effects/explosionfar.ogg') - - else //station was destroyed if( mode && !override ) override = mode.name diff --git a/code/game/asteroid.dm b/code/game/asteroid.dm index c20598b3882..36d8d88adcf 100644 --- a/code/game/asteroid.dm +++ b/code/game/asteroid.dm @@ -36,6 +36,10 @@ var/global/max_secret_rooms = 6 ////////////// +/proc/make_mining_asteroid_secrets() + for(1 to max_secret_rooms) + make_mining_asteroid_secret() + /proc/make_mining_asteroid_secret() var/valid = 0 var/turf/T = null diff --git a/code/game/communications.dm b/code/game/communications.dm index 5a153270173..d9c1595ec2e 100644 --- a/code/game/communications.dm +++ b/code/game/communications.dm @@ -1,7 +1,7 @@ /* HOW IT WORKS - The radio_controller is a global object maintaining all radio transmissions, think about it as about "ether". + The SSradio is a global object maintaining all radio transmissions, think about it as about "ether". Note that walkie-talkie, intercoms and headsets handle transmission using nonstandard way. procs: diff --git a/code/game/machinery/airlock_control.dm b/code/game/machinery/airlock_control.dm index ece732690c3..13426cbbdfe 100644 --- a/code/game/machinery/airlock_control.dm +++ b/code/game/machinery/airlock_control.dm @@ -73,10 +73,10 @@ /obj/machinery/door/airlock/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) if(new_frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) + radio_connection = SSradio.add_object(src, frequency, RADIO_AIRLOCK) /obj/machinery/door/airlock/initialize() @@ -89,12 +89,12 @@ /obj/machinery/door/airlock/New() ..() - if(radio_controller) + if(SSradio) set_frequency(frequency) /obj/machinery/door/airlock/Destroy() - if(frequency && radio_controller) - radio_controller.remove_object(src,frequency) + if(frequency && SSradio) + SSradio.remove_object(src,frequency) return ..() /obj/machinery/airlock_sensor @@ -152,9 +152,9 @@ update_icon() /obj/machinery/airlock_sensor/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) + radio_connection = SSradio.add_object(src, frequency, RADIO_AIRLOCK) /obj/machinery/airlock_sensor/initialize() set_frequency(frequency) @@ -162,10 +162,10 @@ /obj/machinery/airlock_sensor/New() ..() - if(radio_controller) + if(SSradio) set_frequency(frequency) /obj/machinery/airlock_sensor/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) return ..() \ No newline at end of file diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index dd54da398a7..7c758008d1d 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -146,8 +146,8 @@ src.initialize() /obj/machinery/alarm/Destroy() - if(radio_controller) - radio_controller.remove_object(src, frequency) + if(SSradio) + SSradio.remove_object(src, frequency) qdel(wires) wires = null return ..() @@ -227,9 +227,9 @@ send_signal(id_tag, list("status") ) /obj/machinery/alarm/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_TO_AIRALARM) + radio_connection = SSradio.add_object(src, frequency, RADIO_TO_AIRALARM) /obj/machinery/alarm/proc/send_signal(target, list/command)//sends signal 'command' to 'target'. Returns 0 if no radio connection, 1 otherwise if(!radio_connection) @@ -652,7 +652,7 @@ /obj/machinery/alarm/proc/post_alert(alert_level) - var/datum/radio_frequency/frequency = radio_controller.return_frequency(alarm_frequency) + var/datum/radio_frequency/frequency = SSradio.return_frequency(alarm_frequency) if(!frequency) return diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm index 1c71111943c..89c4d084ced 100644 --- a/code/game/machinery/atmo_control.dm +++ b/code/game/machinery/atmo_control.dm @@ -64,9 +64,9 @@ /obj/machinery/air_sensor/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) + radio_connection = SSradio.add_object(src, frequency, RADIO_ATMOSIA) /obj/machinery/air_sensor/initialize() set_frequency(frequency) @@ -74,13 +74,13 @@ /obj/machinery/air_sensor/New() ..() SSair.atmos_machinery += src - if(radio_controller) + if(SSradio) set_frequency(frequency) /obj/machinery/air_sensor/Destroy() SSair.atmos_machinery -= src - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) return ..() ///////////////////////////////////////////////////////////// @@ -102,7 +102,7 @@ /obj/machinery/computer/general_air_control/New() ..() - if(radio_controller) + if(SSradio) set_frequency(frequency) /obj/machinery/computer/general_air_control/attack_hand(mob/user) @@ -178,14 +178,14 @@ return output /obj/machinery/computer/general_air_control/Destroy() - if(radio_controller) - radio_controller.remove_object(src, frequency) + if(SSradio) + SSradio.remove_object(src, frequency) return ..() /obj/machinery/computer/general_air_control/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) + radio_connection = SSradio.add_object(src, frequency, RADIO_ATMOSIA) /obj/machinery/computer/general_air_control/initialize() set_frequency(frequency) @@ -222,8 +222,8 @@ /obj/machinery/computer/general_air_control/large_tank_control/proc/reconnect(mob/user) //This hacky madness is the evidence of the fact that a lot of machines were never meant to be constructable, im so sorry you had to see this var/list/IO = list() - var/datum/radio_frequency/air_freq = radio_controller.return_frequency(1443) - var/datum/radio_frequency/gas_freq = radio_controller.return_frequency(1441) + var/datum/radio_frequency/air_freq = SSradio.return_frequency(1443) + var/datum/radio_frequency/gas_freq = SSradio.return_frequency(1441) var/list/devices = air_freq.devices["_default"] devices |= gas_freq.devices["_default"] for(var/obj/machinery/atmospherics/components/unary/vent_pump/U in devices) diff --git a/code/game/machinery/atmoalter/meter.dm b/code/game/machinery/atmoalter/meter.dm index fed2393ef09..b5fa7a1e49b 100644 --- a/code/game/machinery/atmoalter/meter.dm +++ b/code/game/machinery/atmoalter/meter.dm @@ -59,7 +59,7 @@ icon_state = "meter4" if(frequency) - var/datum/radio_frequency/radio_connection = radio_controller.return_frequency(frequency) + var/datum/radio_frequency/radio_connection = SSradio.return_frequency(frequency) if(!radio_connection) return diff --git a/code/game/machinery/computer/atmos_alert.dm b/code/game/machinery/computer/atmos_alert.dm index 99d2fdfe0de..b69d4831d93 100644 --- a/code/game/machinery/computer/atmos_alert.dm +++ b/code/game/machinery/computer/atmos_alert.dm @@ -18,8 +18,8 @@ set_frequency(receive_frequency) /obj/machinery/computer/atmos_alert/Destroy() - if(radio_controller) - radio_controller.remove_object(src, receive_frequency) + if(SSradio) + SSradio.remove_object(src, receive_frequency) return ..() /obj/machinery/computer/atmos_alert/receive_signal(datum/signal/signal) @@ -41,9 +41,9 @@ /obj/machinery/computer/atmos_alert/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, receive_frequency) + SSradio.remove_object(src, receive_frequency) receive_frequency = new_frequency - radio_connection = radio_controller.add_object(src, receive_frequency, RADIO_ATMOSIA) + radio_connection = SSradio.add_object(src, receive_frequency, RADIO_ATMOSIA) /obj/machinery/computer/atmos_alert/attack_hand(mob/user) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 67be162a428..f13ce7edf07 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -588,7 +588,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12 /obj/machinery/computer/communications/proc/post_status(command, data1, data2) - var/datum/radio_frequency/frequency = radio_controller.return_frequency(1435) + var/datum/radio_frequency/frequency = SSradio.return_frequency(1435) if(!frequency) return diff --git a/code/game/machinery/doors/alarmlock.dm b/code/game/machinery/doors/alarmlock.dm index c8525f3520d..e0fae3766f0 100644 --- a/code/game/machinery/doors/alarmlock.dm +++ b/code/game/machinery/doors/alarmlock.dm @@ -16,15 +16,15 @@ air_connection = new /obj/machinery/door/airlock/alarmlock/Destroy() - if(radio_controller) - radio_controller.remove_object(src,air_frequency) + if(SSradio) + SSradio.remove_object(src,air_frequency) air_connection = null return ..() /obj/machinery/door/airlock/alarmlock/initialize() ..() - radio_controller.remove_object(src, air_frequency) - air_connection = radio_controller.add_object(src, air_frequency, RADIO_TO_AIRALARM) + SSradio.remove_object(src, air_frequency) + air_connection = SSradio.add_object(src, air_frequency, RADIO_TO_AIRALARM) open() /obj/machinery/door/airlock/alarmlock/receive_signal(datum/signal/signal) diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm index 6acfaafc359..02de1393820 100644 --- a/code/game/machinery/embedded_controller/embedded_controller_base.dm +++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm @@ -75,8 +75,8 @@ var/datum/radio_frequency/radio_connection /obj/machinery/embedded_controller/radio/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) return ..() /obj/machinery/embedded_controller/radio/initialize() @@ -90,6 +90,6 @@ signal = null /obj/machinery/embedded_controller/radio/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency) + radio_connection = SSradio.add_object(src, frequency) diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm index 1a1c4e8f9fa..d848eab6e40 100644 --- a/code/game/machinery/magnet.dm +++ b/code/game/machinery/magnet.dm @@ -36,15 +36,15 @@ center = T spawn(10) // must wait for map loading to finish - if(radio_controller) - radio_controller.add_object(src, freq, RADIO_MAGNETS) + if(SSradio) + SSradio.add_object(src, freq, RADIO_MAGNETS) spawn() magnetic_process() /obj/machinery/magnetic_module/Destroy() - if(radio_controller) - radio_controller.remove_object(src, freq) + if(SSradio) + SSradio.remove_object(src, freq) . = ..() center = null @@ -234,16 +234,16 @@ spawn(45) // must wait for map loading to finish - if(radio_controller) - radio_connection = radio_controller.add_object(src, frequency, RADIO_MAGNETS) + if(SSradio) + radio_connection = SSradio.add_object(src, frequency, RADIO_MAGNETS) if(path) // check for default path filter_path() // renders rpath /obj/machinery/magnetic_controller/Destroy() - if(radio_controller) - radio_controller.remove_object(src, frequency) + if(SSradio) + SSradio.remove_object(src, frequency) . = ..() magnets = null rpath = null diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index d3e952699f7..77fd9702487 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -45,12 +45,12 @@ /obj/machinery/status_display/New() ..() spawn(5) // must wait for map loading to finish - if(radio_controller) - radio_controller.add_object(src, frequency) + if(SSradio) + SSradio.add_object(src, frequency) /obj/machinery/status_display/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) return ..() // timed process diff --git a/code/game/machinery/telecomms/broadcasting.dm b/code/game/machinery/telecomms/broadcasting.dm index 021987f862b..eb7b344c1fb 100644 --- a/code/game/machinery/telecomms/broadcasting.dm +++ b/code/game/machinery/telecomms/broadcasting.dm @@ -179,7 +179,7 @@ var/mob/living/carbon/human/H = new M = H - var/datum/radio_frequency/connection = radio_controller.return_frequency(frequency) + var/datum/radio_frequency/connection = SSradio.return_frequency(frequency) var/display_freq = connection.frequency @@ -209,7 +209,7 @@ // --- Broadcast to syndicate radio! --- else if(data == 3) - var/datum/radio_frequency/syndicateconnection = radio_controller.return_frequency(SYND_FREQ) + var/datum/radio_frequency/syndicateconnection = SSradio.return_frequency(SYND_FREQ) for (var/obj/item/device/radio/R in syndicateconnection.devices["[RADIO_CHAT]"]) var/turf/position = get_turf(R) diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index c2e5012de02..b6401056796 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -251,7 +251,7 @@ /obj/item/weapon/cartridge/proc/post_status(command, data1, data2) - var/datum/radio_frequency/frequency = radio_controller.return_frequency(1435) + var/datum/radio_frequency/frequency = SSradio.return_frequency(1435) if(!frequency) return diff --git a/code/game/objects/items/devices/PDA/radio.dm b/code/game/objects/items/devices/PDA/radio.dm index 593249e2214..c127be39aa9 100644 --- a/code/game/objects/items/devices/PDA/radio.dm +++ b/code/game/objects/items/devices/PDA/radio.dm @@ -26,12 +26,12 @@ /obj/item/radio/integrated/signal/New() ..() - if(radio_controller) + if(SSradio) initialize() /obj/item/radio/integrated/signal/Destroy() - if(radio_controller) - radio_controller.remove_object(src, frequency) + if(SSradio) + SSradio.remove_object(src, frequency) return ..() /obj/item/radio/integrated/signal/initialize() @@ -41,9 +41,9 @@ set_frequency(frequency) /obj/item/radio/integrated/signal/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency) + radio_connection = SSradio.add_object(src, frequency) /obj/item/radio/integrated/signal/proc/send_signal(message="ACTIVATE") diff --git a/code/game/objects/items/devices/radio/electropack.dm b/code/game/objects/items/devices/radio/electropack.dm index ce8e17ac87e..a47e980cc72 100644 --- a/code/game/objects/items/devices/radio/electropack.dm +++ b/code/game/objects/items/devices/radio/electropack.dm @@ -18,12 +18,12 @@ return (FIRELOSS) /obj/item/device/electropack/initialize() - if(radio_controller) - radio_controller.add_object(src, frequency, RADIO_CHAT) + if(SSradio) + SSradio.add_object(src, frequency, RADIO_CHAT) /obj/item/device/electropack/Destroy() - if(radio_controller) - radio_controller.remove_object(src, frequency) + if(SSradio) + SSradio.remove_object(src, frequency) return ..() /obj/item/device/electropack/attack_hand(mob/user) @@ -65,9 +65,9 @@ if(((istype(usr, /mob/living/carbon/human) && ((!( ticker ) || (ticker && ticker.mode != "monkey")) && usr.contents.Find(src))) || (usr.contents.Find(master) || (in_range(src, usr) && istype(loc, /turf))))) usr.set_machine(src) if(href_list["freq"]) - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = sanitize_frequency(frequency + text2num(href_list["freq"])) - radio_controller.add_object(src, frequency, RADIO_CHAT) + SSradio.add_object(src, frequency, RADIO_CHAT) else if(href_list["code"]) code += text2num(href_list["code"]) diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 477464d6f3f..06e56ce4994 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -222,7 +222,7 @@ for(var/ch_name in channels) - radio_controller.remove_object(src, radiochannels[ch_name]) + SSradio.remove_object(src, radiochannels[ch_name]) secure_radio_connections[ch_name] = null diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index ae179e356e8..36faa0c5dbb 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -50,7 +50,7 @@ wires.CutWireIndex(WIRE_TRANSMIT) secure_radio_connections = new ..() - if(radio_controller) + if(SSradio) initialize() @@ -248,7 +248,7 @@ be prepared to disregard any comments in all of tcomms code. i tried my best to keep them somewhat up-to-date, but eh */ - //get the frequency you buttface. radios no longer use the radio_controller. confusing for future generations, convenient for me. + //get the frequency you buttface. radios no longer use the SSradio. confusing for future generations, convenient for me. var/freq if(channel && channels && channels.len > 0) if (channel == "department") @@ -587,7 +587,7 @@ for(var/ch_name in channels) - radio_controller.remove_object(src, radiochannels[ch_name]) + SSradio.remove_object(src, radiochannels[ch_name]) secure_radio_connections[ch_name] = null diff --git a/code/game/objects/items/weapons/storage/toolbox.dm b/code/game/objects/items/weapons/storage/toolbox.dm index 3724eaf9b0e..b87c609a238 100644 --- a/code/game/objects/items/weapons/storage/toolbox.dm +++ b/code/game/objects/items/weapons/storage/toolbox.dm @@ -104,4 +104,4 @@ /obj/item/weapon/storage/toolbox/suicide_act(mob/user) user.visible_message("[user] robusts \himself with the toolbox! It looks like \he's trying to commit suicide..") - return (BRUTELOSS) + return (BRUTELOSS) diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index dce65ac5269..c1284154c64 100644 --- a/code/modules/admin/verbs/diagnostics.dm +++ b/code/modules/admin/verbs/diagnostics.dm @@ -64,9 +64,9 @@ "_default" = "NO_FILTER" ) var/output = "Radio Report
" - for (var/fq in radio_controller.frequencies) + for (var/fq in SSradio.frequencies) output += "Freq: [fq]
" - var/list/datum/radio_frequency/fqs = radio_controller.frequencies[fq] + var/list/datum/radio_frequency/fqs = SSradio.frequencies[fq] if (!fqs) output += "  ERROR
" continue diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index e013747aa01..463abc6c5e4 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -20,8 +20,8 @@ return /obj/item/device/assembly/signaler/Destroy() - if(radio_controller) - radio_controller.remove_object(src,frequency) + if(SSradio) + SSradio.remove_object(src,frequency) return ..() /obj/item/device/assembly/signaler/activate() @@ -135,13 +135,13 @@ Code: /obj/item/device/assembly/signaler/proc/set_frequency(new_frequency) - if(!radio_controller) + if(!SSradio) sleep(20) - if(!radio_controller) + if(!SSradio) return - radio_controller.remove_object(src, frequency) + SSradio.remove_object(src, frequency) frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT) + radio_connection = SSradio.add_object(src, frequency, RADIO_CHAT) return // Embedded signaller used in grenade construction. diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index d541b162d21..4f944500504 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -236,4 +236,4 @@ var/list/ghost_forms = list("ghost","ghostking","ghostian2","skeleghost","ghost_ set category = "Preferences" set desc = "Allows you to access the Setup Character screen. Changes to your character won't take effect until next round, but other changes will." prefs.current_tab = 1 - prefs.ShowChoices(usr) + prefs.ShowChoices(usr) diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index 724742ca899..b57118957f1 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -68,4 +68,4 @@ message_admins("Situation has been resolved") return 0 message_admins("Unfortunately, no candidates were available for becoming an alien. Shutting down.") - return kill() + return kill() diff --git a/code/modules/mob/interactive.dm b/code/modules/mob/interactive.dm index 62f825ea056..1bbb0e3ee55 100644 --- a/code/modules/mob/interactive.dm +++ b/code/modules/mob/interactive.dm @@ -182,7 +182,7 @@ if(TRAITS & TRAIT_THIEVING) slyness = 75 - SSbp.insertBot(src) + SSnpc.insertBot(src) /mob/living/carbon/human/interactive/attack_hand(mob/living/carbon/human/M) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 31dda91368c..4a36767eeee 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -858,4 +858,4 @@ return if(!isturf(M.loc) && M.loc != src) return - return 1 + return 1 diff --git a/code/modules/mob/living/carbon/human/whisper.dm b/code/modules/mob/living/carbon/human/whisper.dm index f42c367d4bb..ef0bbd93d1b 100644 --- a/code/modules/mob/living/carbon/human/whisper.dm +++ b/code/modules/mob/living/carbon/human/whisper.dm @@ -1,8 +1,8 @@ /mob/living/carbon/human/whisper(message as text) if(!IsVocal()) return - if(!message) - return + if(!message) + return if(say_disabled) //This is here to try to identify lag problems usr << "Speech is currently admin-disabled." diff --git a/code/modules/mob/say_readme.dm b/code/modules/mob/say_readme.dm index ddc9f2b148b..34727980393 100644 --- a/code/modules/mob/say_readme.dm +++ b/code/modules/mob/say_readme.dm @@ -155,7 +155,7 @@ eventually results in broadcast_message() being called. Broadcast_message() does NOT call say() on radios, but rather calls Hear() on everyone in range of a radio. This is because the system does not like repeating says. -Furthermore, I changed radios to not be in the radio_controller. Instead, they are in a global list called all_radios. +Furthermore, I changed radios to not be in the SSradio. Instead, they are in a global list called all_radios. This is an associative list, and the numbers as strings are the keys. The values are lists of radios that can hear said frequency. To add a radio, simply use add_radio(radio, frequency). To remove a radio, use remove_radio(radio, frequency). From 815ac7d2f96d162a553daf95293985f07f87cb59 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Fri, 4 Dec 2015 23:24:50 -0600 Subject: [PATCH 5/7] Defcon improvements, renames, etc --- code/controllers/failsafe.dm | 18 +++++++++++------- .../{subsystems.dm => subsystem.dm} | 0 code/modules/mob/mob.dm | 1 + code/modules/power/apc.dm | 2 +- tgstation.dme | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-) rename code/controllers/{subsystems.dm => subsystem.dm} (100%) diff --git a/code/controllers/failsafe.dm b/code/controllers/failsafe.dm index 61b3a2cf9b3..74f2159cbe7 100644 --- a/code/controllers/failsafe.dm +++ b/code/controllers/failsafe.dm @@ -14,6 +14,7 @@ var/datum/controller/failsafe/Failsafe var/processing_interval = 100 // The alert level. For every failed poke, we drop a DEFCON level. Once we hit DEFCON 1, restart the MC. var/defcon = 0 + var/list/defcon_pretty = list(5, 4, 3, 2, 1) // Track the MC iteration to make sure its still on track. var/master_iteration = 0 @@ -38,13 +39,13 @@ var/datum/controller/failsafe/Failsafe // Check if processing is done yet. if(Master.iteration == master_iteration) switch(defcon) - if(1 to 3) + if(1 to 2) ++defcon + if(3) + admins << "Warning: DEFCON [defcon_pretty()]. The Master Controller has not fired in the last [defcon * processing_interval] ticks. Automatic restart in [processing_interval] ticks." + defcon = 4 if(4) - admins << "Warning: DEFCON [defcon]. The Master Controller has not fired in the last [defcon * processing_interval] ticks. Automatic restart in [processing_interval] ticks." - defcon = 5 - if(5) - admins << "Warning: DEFCON [defcon]. The Master Controller has still not fired within the last [defcon * processing_interval] ticks. Killing and restarting..." + admins << "Warning: DEFCON [defcon_pretty()]. The Master Controller has still not fired within the last [defcon * processing_interval] ticks. Killing and restarting..." // Replace the old master controller by creating a new one. new/datum/controller/master() // Get it rolling again. @@ -56,10 +57,13 @@ var/datum/controller/failsafe/Failsafe sleep(processing_interval) else defcon = 0 - sleep(100) + sleep(initial(processing_interval)) + +/datum/controller/failsafe/proc/defcon_pretty() + return 5 - Failsafe.defcon /datum/controller/failsafe/proc/stat_entry() if(!statclick) statclick = new/obj/effect/statclick/debug("Initializing...", src) - stat("Failsafe Controller:", statclick.update("Defcon: [Failsafe.defcon] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])")) + stat("Failsafe Controller:", statclick.update("Defcon: [Failsafe.defcon_pretty()] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])")) diff --git a/code/controllers/subsystems.dm b/code/controllers/subsystem.dm similarity index 100% rename from code/controllers/subsystems.dm rename to code/controllers/subsystem.dm diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 1c252214669..b295faa469a 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -654,6 +654,7 @@ var/list/slot_equipment_priority = list( \ stat("CPU:", "[world.cpu]") stat("Instances:", "[world.contents.len]") config.stat_entry() + stat(null) if(Master) Master.stat_entry() else diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index d7806edcd71..92ec3c531c7 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -631,7 +631,7 @@ /obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, force_open = 0) ui = SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open) if (!ui) - ui = new(user, src, ui_key, "apc.tmpl", name, 515, 550) + ui = new(user, src, ui_key, "apc.tmpl", name, 550, 550) ui.open() /obj/machinery/power/apc/get_ui_data(mob/user) diff --git a/tgstation.dme b/tgstation.dme index 49766e6760f..62c2f117ceb 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -143,7 +143,7 @@ #include "code\controllers\controller.dm" #include "code\controllers\failsafe.dm" #include "code\controllers\master.dm" -#include "code\controllers\subsystems.dm" +#include "code\controllers\subsystem.dm" #include "code\controllers\subsystem\air.dm" #include "code\controllers\subsystem\assets.dm" #include "code\controllers\subsystem\diseases.dm" From 531e4b947f4dd9c364b428a65364743f5b0c889f Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Sat, 5 Dec 2015 10:13:59 -0600 Subject: [PATCH 6/7] Subsystem display tweaks --- code/__HELPERS/cmp.dm | 5 +++++ code/controllers/master.dm | 3 +++ code/controllers/subsystem.dm | 15 +++++++++++---- code/controllers/subsystem/air.dm | 1 + code/controllers/subsystem/assets.dm | 2 +- code/controllers/subsystem/garbage.dm | 6 ++++-- code/controllers/subsystem/lighting.dm | 3 ++- code/controllers/subsystem/machines.dm | 1 + code/controllers/subsystem/minimap.dm | 2 +- code/controllers/subsystem/mobs.dm | 1 + code/controllers/subsystem/nano.dm | 4 +++- code/controllers/subsystem/npcpool.dm | 3 ++- code/controllers/subsystem/pai.dm | 2 +- code/controllers/subsystem/ticker.dm | 3 ++- 14 files changed, 38 insertions(+), 13 deletions(-) diff --git a/code/__HELPERS/cmp.dm b/code/__HELPERS/cmp.dm index a4a8869637a..725742eaf04 100644 --- a/code/__HELPERS/cmp.dm +++ b/code/__HELPERS/cmp.dm @@ -31,3 +31,8 @@ var/cmp_field = "name" /proc/cmp_subsystem_priority(datum/subsystem/a, datum/subsystem/b) return b.priority - a.priority + +/proc/cmp_subsystem_display(datum/subsystem/a, datum/subsystem/b) + if(a.display == b.display) + return sorttext(b.name, a.name) + return a.display - b.display \ No newline at end of file diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 805092ef621..7b711c76125 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -89,6 +89,9 @@ var/global/datum/controller/master/Master = new() world << "Initializations complete!" + // Sort subsystems by display setting for easy access. + sortTim(subsystems, /proc/cmp_subsystem_display) + // Set world options. world.sleep_offline = 1 world.fps = config.fps diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index 32486ba9486..590fed5d8a4 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -5,6 +5,7 @@ var/name //name of the subsystem var/priority = 0 //priority affects order of initialization. Higher priorities are initialized first, lower priorities later. Can be decimal and negative values. var/wait = 20 //time to wait (in deciseconds) between each call to fire(). Must be a positive integer. + var/display = 100 //display affects order the subsystem is displayed in the MC tab // Dynamic Wait // A system for scaling a subsystem's fire rate based on lag. @@ -42,10 +43,11 @@ /datum/subsystem/proc/Initialize(start_timeofday, zlevel) var/time = (world.timeofday - start_timeofday) / 10 var/msg = "Initialized [name] subsystem within [time] seconds!" - if(zlevel) + if(zlevel) // If only initialized for one Z-level. testing(msg) - return + return time world << "[msg]" + return time //hook for printing stats to the "MC" statuspanel for admins to see performance and related stats etc. /datum/subsystem/proc/stat_entry(msg) @@ -53,10 +55,15 @@ statclick = new/obj/effect/statclick/debug("Initializing...", src) var/dwait = "" - if (dynamic_wait) + if(dynamic_wait) dwait = "DWait:[round(wait,0.1)]ds " - stat(name, statclick.update("[round(cost,0.001)]ds\t[dwait][msg]")) + if(can_fire) + msg = "[round(cost,0.001)]ds\t[dwait][msg]" + else + msg = "OFFLINE" + + stat(name, statclick.update(msg)) //could be used to postpone a costly subsystem for (default one) var/cycles, cycles //for instance, during cpu intensive operations like explosions diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index 6c45cc35ae7..99d2037462b 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -6,6 +6,7 @@ var/datum/subsystem/air/SSair wait = 5 dynamic_wait = 1 dwait_upper = 50 + display = 1 var/cost_turfs = 0 var/cost_groups = 0 diff --git a/code/controllers/subsystem/assets.dm b/code/controllers/subsystem/assets.dm index fc57053c338..953af709699 100644 --- a/code/controllers/subsystem/assets.dm +++ b/code/controllers/subsystem/assets.dm @@ -2,7 +2,7 @@ var/datum/subsystem/assets/SSasset /datum/subsystem/assets name = "Assets" - priority = 19 + priority = -3 var/list/cache = list() diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index 3f93766c026..524d76be193 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -2,13 +2,15 @@ var/datum/subsystem/garbage_collector/SSgarbage /datum/subsystem/garbage_collector name = "Garbage" - can_fire = 1 - wait = 5 priority = -1 + wait = 5 dynamic_wait = 1 dwait_upper = 50 dwait_delta = 10 dwait_buffer = 0 + display = 2 + + can_fire = 1 // This needs to fire before round start. var/collection_timeout = 300// deciseconds to wait to let running procs finish before we just say fuck it and force del() the object var/max_run_time = 1 // how long, in deciseconds, can we run before waiting for the next tick diff --git a/code/controllers/subsystem/lighting.dm b/code/controllers/subsystem/lighting.dm index 6fa5b6e5379..9203115b4bf 100644 --- a/code/controllers/subsystem/lighting.dm +++ b/code/controllers/subsystem/lighting.dm @@ -4,10 +4,11 @@ var/datum/subsystem/lighting/SSlighting /datum/subsystem/lighting name = "Lighting" - wait = 5 priority = 1 + wait = 5 dynamic_wait = 1 dwait_delta = 3 + display = 5 var/list/changed_lights = list() //list of all datum/light_source that need updating var/changed_lights_workload = 0 //stats on the largest number of lights (max changed_lights.len) diff --git a/code/controllers/subsystem/machines.dm b/code/controllers/subsystem/machines.dm index a5d4d432ea3..0756fc45eaa 100644 --- a/code/controllers/subsystem/machines.dm +++ b/code/controllers/subsystem/machines.dm @@ -3,6 +3,7 @@ var/datum/subsystem/machines/SSmachine /datum/subsystem/machines name = "Machines" priority = 9 + display = 3 var/list/processing = list() var/list/powernets = list() diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 55983952e63..eb087f9d63f 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -8,7 +8,7 @@ var/datum/subsystem/minimap/SSminimap /datum/subsystem/minimap name = "Minimap" - priority = 20 + priority = -2 var/const/MAX_ICON_DIMENSION = 1024 var/const/ICON_SIZE = 4 diff --git a/code/controllers/subsystem/mobs.dm b/code/controllers/subsystem/mobs.dm index 9bae03b30a4..24297bde8c9 100644 --- a/code/controllers/subsystem/mobs.dm +++ b/code/controllers/subsystem/mobs.dm @@ -3,6 +3,7 @@ var/datum/subsystem/mobs/SSmob /datum/subsystem/mobs name = "Mobs" priority = 4 + display = 4 /datum/subsystem/mobs/New() diff --git a/code/controllers/subsystem/nano.dm b/code/controllers/subsystem/nano.dm index d3abbc9f871..30434484c5f 100644 --- a/code/controllers/subsystem/nano.dm +++ b/code/controllers/subsystem/nano.dm @@ -2,9 +2,11 @@ var/datum/subsystem/nano/SSnano /datum/subsystem/nano name = "NanoUI" - can_fire = 1 wait = 10 priority = 16 + display = 6 + + can_fire = 1 // This needs to fire before round start. var/list/open_uis = list() // A list of open NanoUIs, grouped by src_object and ui_key. var/list/processing_uis = list() // A list of processing NanoUIs, not grouped. diff --git a/code/controllers/subsystem/npcpool.dm b/code/controllers/subsystem/npcpool.dm index 4032b00640c..f23a644dbfe 100644 --- a/code/controllers/subsystem/npcpool.dm +++ b/code/controllers/subsystem/npcpool.dm @@ -2,7 +2,8 @@ var/datum/subsystem/npcpool/SSnpc /datum/subsystem/npcpool name = "NPC Pool" - priority = 100 + priority = 17 + display = 6 var/list/canBeUsed = list() var/list/canBeUsed_non = list() diff --git a/code/controllers/subsystem/pai.dm b/code/controllers/subsystem/pai.dm index af09a53846a..3549b64f1e5 100644 --- a/code/controllers/subsystem/pai.dm +++ b/code/controllers/subsystem/pai.dm @@ -2,7 +2,7 @@ var/datum/subsystem/pai/SSpai /datum/subsystem/pai name = "pAI" - wait = 20 + priority = 20 var/askDelay = 600 diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index bc7e0196040..6951d554dec 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -4,9 +4,10 @@ var/datum/subsystem/ticker/ticker /datum/subsystem/ticker name = "Ticker" - can_fire = 1 priority = 0 + can_fire = 1 // This needs to fire before round start. + var/current_state = GAME_STATE_STARTUP //state of current round (used by process()) Use the defines GAME_STATE_* ! var/force_ending = 0 //Round was ended by admin intervention From dd353ff125ebae2e64547faeb4b2012238a5a887 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Sun, 6 Dec 2015 21:06:00 -0600 Subject: [PATCH 7/7] Remove unused list --- code/controllers/failsafe.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/controllers/failsafe.dm b/code/controllers/failsafe.dm index 74f2159cbe7..4ee338cc365 100644 --- a/code/controllers/failsafe.dm +++ b/code/controllers/failsafe.dm @@ -14,7 +14,6 @@ var/datum/controller/failsafe/Failsafe var/processing_interval = 100 // The alert level. For every failed poke, we drop a DEFCON level. Once we hit DEFCON 1, restart the MC. var/defcon = 0 - var/list/defcon_pretty = list(5, 4, 3, 2, 1) // Track the MC iteration to make sure its still on track. var/master_iteration = 0