Skip to content

Commit

Permalink
Merge pull request tgstation#25386 from Cyberboss/TiredOfTheInconsist…
Browse files Browse the repository at this point in the history
…ency

Normalizes subsystem naming and definition
  • Loading branch information
duncathan authored Apr 3, 2017
2 parents e8ed28f + 22fe5b1 commit 7b67f0b
Show file tree
Hide file tree
Showing 210 changed files with 892 additions and 1,109 deletions.
14 changes: 14 additions & 0 deletions code/__DEFINES/MC.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,17 @@
#define SS_PAUSED 3 //paused by mc_tick_check
#define SS_SLEEPING 4 //fire() slept.
#define SS_PAUSING 5 //in the middle of pausing

#define SUBSYSTEM_DEF(X) var/datum/controller/subsystem/##X/SS##X;\
/datum/controller/subsystem/##X/New(){\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
}\
/datum/controller/subsystem/##X

#define PROCESSING_SUBSYSTEM_DEF(X) var/datum/controller/subsystem/processing/##X/SS##X;\
/datum/controller/subsystem/processing/##X/New(){\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
}\
/datum/controller/subsystem/processing/##X
2 changes: 1 addition & 1 deletion code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
#define STAGE_FIVE 9
#define STAGE_SIX 11 //From supermatter shard

//ticker.current_state values
//SSticker.current_state values
#define GAME_STATE_STARTUP 0
#define GAME_STATE_PREGAME 1
#define GAME_STATE_SETTING_UP 2
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
winset(C, "mainwindow", "flash=5")

/proc/AnnounceArrival(var/mob/living/carbon/human/character, var/rank)
if(ticker.current_state != GAME_STATE_PLAYING || !character)
if(SSticker.current_state != GAME_STATE_PLAYING || !character)
return
var/area/A = get_area(character)
var/message = "<span class='game deadsay'><span class='name'>\
Expand Down
4 changes: 2 additions & 2 deletions code/__HELPERS/names.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ var/religion_name = null
name = ""

// Prefix
for(var/holiday_name in SSevent.holidays)
for(var/holiday_name in SSevents.holidays)
if(holiday_name == "Friday the 13th")
random = 13
var/datum/holiday/holiday = SSevent.holidays[holiday_name]
var/datum/holiday/holiday = SSevents.holidays[holiday_name]
name = holiday.getStationPrefix()
//get normal name
if(!name)
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/proc/gameTimestamp(format = "hh:mm:ss", wtime=null)
if(!wtime)
wtime = world.time
return time2text(wtime - timezoneOffset + ticker.gametime_offset - round_start_time, format)
return time2text(wtime - timezoneOffset + SSticker.gametime_offset - round_start_time, format)

/* Returns 1 if it is the selected month and day */
/proc/isDay(month, day)
Expand Down
2 changes: 1 addition & 1 deletion code/_globalvars/lists/objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var/global/list/portals = list() //list of all /obj/effect/portal
var/global/list/airlocks = list() //list of all airlocks
var/global/list/mechas_list = list() //list of all mechs. Used by hostile mobs target tracking.
var/global/list/shuttle_caller_list = list() //list of all communication consoles and AIs, for automatic shuttle calls when there are none.
var/global/list/machines = list() //NOTE: this is a list of ALL machines now. The processing machines list is SSmachine.processing !
var/global/list/machines = list() //NOTE: this is a list of ALL machines now. The processing machines list is SSmachines.processing !
var/global/list/syndicate_shuttle_boards = list() //important to keep track of for managing nukeops war declarations.
var/global/list/navbeacons = list() //list of all bot nagivation beacons, used for patrolling.
var/global/list/teleportbeacons = list() //list of all tracking beacons used by teleporters
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@

/datum/configuration/proc/get_runnable_midround_modes(crew)
var/list/datum/game_mode/runnable_modes = new
for(var/T in (gamemode_cache - ticker.mode.type))
for(var/T in (gamemode_cache - SSticker.mode.type))
var/datum/game_mode/M = new T()
if(!(M.config_tag in modes))
qdel(M)
Expand Down
10 changes: 8 additions & 2 deletions code/controllers/subsystem.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


/datum/controller/subsystem
// Metadata; you should define these.
name = "fire coderbus" //name of the subsystem
Expand Down Expand Up @@ -29,8 +28,15 @@
var/datum/controller/subsystem/queue_next
var/datum/controller/subsystem/queue_prev

// Used to initialize the subsystem BEFORE the map has loaded
//Do not override
/datum/controller/subsystem/New()
return

// Used to initialize the subsystem BEFORE the map has loaded
// Called AFTER Recover if that is called
// Prefer to use Initialize if possible
/datum/controller/subsystem/proc/PreInit()
return

//This is used so the mc knows when the subsystem sleeps. do not override.
/datum/controller/subsystem/proc/ignite(resumed = 0)
Expand Down
8 changes: 1 addition & 7 deletions code/controllers/subsystem/acid.dm
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
var/datum/controller/subsystem/acid/SSacid

/datum/controller/subsystem/acid
SUBSYSTEM_DEF(acid)
name = "Acid"
priority = 40
flags = SS_NO_INIT|SS_BACKGROUND

var/list/currentrun = list()
var/list/processing = list()

/datum/controller/subsystem/acid/New()
NEW_SS_GLOBAL(SSacid)


/datum/controller/subsystem/acid/stat_entry()
..("P:[processing.len]")

Expand Down
6 changes: 1 addition & 5 deletions code/controllers/subsystem/air.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
#define SSAIR_HIGHPRESSURE 5
#define SSAIR_HOTSPOTS 6
#define SSAIR_SUPERCONDUCTIVITY 7
var/datum/controller/subsystem/air/SSair

/datum/controller/subsystem/air
SUBSYSTEM_DEF(air)
name = "Air"
init_order = -1
priority = 20
Expand Down Expand Up @@ -41,9 +40,6 @@ var/datum/controller/subsystem/air/SSair
var/map_loading = TRUE
var/list/queued_for_activation

/datum/controller/subsystem/air/New()
NEW_SS_GLOBAL(SSair)

/datum/controller/subsystem/air/stat_entry(msg)
msg += "C:{"
msg += "AT:[round(cost_turfs,1)]|"
Expand Down
7 changes: 1 addition & 6 deletions code/controllers/subsystem/assets.dm
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
var/datum/controller/subsystem/assets/SSasset

/datum/controller/subsystem/assets
SUBSYSTEM_DEF(assets)
name = "Assets"
init_order = -3
flags = SS_NO_FIRE
var/list/cache = list()

/datum/controller/subsystem/assets/New()
NEW_SS_GLOBAL(SSasset)

/datum/controller/subsystem/assets/Initialize(timeofday)
for(var/type in typesof(/datum/asset) - list(/datum/asset, /datum/asset/simple))
var/datum/asset/A = new type()
Expand Down
7 changes: 1 addition & 6 deletions code/controllers/subsystem/atoms.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
var/datum/controller/subsystem/atoms/SSatoms

#define INITIALIZATION_INSSATOMS 0 //New should not call Initialize
#define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE)
#define INITIALIZATION_INNEW_REGULAR 2 //New should call Initialize(FALSE)

/datum/controller/subsystem/atoms
SUBSYSTEM_DEF(atoms)
name = "Atoms"
init_order = 11
flags = SS_NO_FIRE
Expand All @@ -14,9 +12,6 @@ var/datum/controller/subsystem/atoms/SSatoms

var/list/late_loaders

/datum/controller/subsystem/atoms/New()
NEW_SS_GLOBAL(SSatoms)

/datum/controller/subsystem/atoms/Initialize(timeofday)
fire_overlay.appearance_flags = RESET_COLOR
setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation.
Expand Down
7 changes: 1 addition & 6 deletions code/controllers/subsystem/augury.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var/datum/controller/subsystem/augury/SSaugury

/datum/controller/subsystem/augury
SUBSYSTEM_DEF(augury)
name = "Augury"
flags = SS_NO_INIT

Expand All @@ -9,9 +7,6 @@ var/datum/controller/subsystem/augury/SSaugury

var/list/observers_given_action = list()

/datum/controller/subsystem/augury/New()
NEW_SS_GLOBAL(SSaugury)

/datum/controller/subsystem/augury/stat_entry(msg)
..("W:[watchers.len]|D:[doombringers.len]")

Expand Down
7 changes: 1 addition & 6 deletions code/controllers/subsystem/communications.dm
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#define COMMUNICATION_COOLDOWN 600
#define COMMUNICATION_COOLDOWN_AI 600

var/datum/controller/subsystem/communications/SScommunications

/datum/controller/subsystem/communications
SUBSYSTEM_DEF(communications)
name = "Communications"
flags = SS_NO_INIT | SS_NO_FIRE

var/silicon_message_cooldown
var/nonsilicon_message_cooldown

/datum/controller/subsystem/communications/New()
NEW_SS_GLOBAL(SScommunications)

/datum/controller/subsystem/communications/proc/can_announce(mob/living/user, is_silicon)
if(is_silicon && silicon_message_cooldown > world.time)
. = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
var/datum/controller/subsystem/diseases/SSdisease

/datum/controller/subsystem/diseases
name = "Diseases"
SUBSYSTEM_DEF(disease)
name = "Disease"
flags = SS_KEEP_TIMING|SS_NO_INIT

var/list/currentrun = list()
var/list/processing = list()

/datum/controller/subsystem/diseases/New()
NEW_SS_GLOBAL(SSdisease)

/datum/controller/subsystem/diseases/stat_entry(msg)
/datum/controller/subsystem/disease/stat_entry(msg)
..("P:[processing.len]")

/datum/controller/subsystem/diseases/fire(resumed = 0)
/datum/controller/subsystem/disease/fire(resumed = 0)
if(!resumed)
src.currentrun = processing.Copy()
//cache for sanic speed (lists are references anyways)
Expand Down
17 changes: 5 additions & 12 deletions code/controllers/subsystem/events.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var/datum/controller/subsystem/events/SSevent

/datum/controller/subsystem/events
SUBSYSTEM_DEF(events)
name = "Events"
init_order = 6

Expand All @@ -15,11 +13,6 @@ var/datum/controller/subsystem/events/SSevent
var/list/holidays //List of all holidays occuring today or null if no holidays
var/wizardmode = 0


/datum/controller/subsystem/events/New()
NEW_SS_GLOBAL(SSevent)


/datum/controller/subsystem/events/Initialize(time, zlevel)
for(var/type in typesof(/datum/round_event_control))
var/datum/round_event_control/E = new type()
Expand Down Expand Up @@ -67,7 +60,7 @@ var/datum/controller/subsystem/events/SSevent
// if(E) E.runEvent()
return

var/gamemode = ticker.mode.config_tag
var/gamemode = SSticker.mode.config_tag
var/players_amt = get_active_player_count(alive_check = 1, afk_check = 1, human_check = 1)
// Only alive, non-AFK human players count towards this.

Expand Down Expand Up @@ -133,7 +126,7 @@ var/datum/controller/subsystem/events/SSevent
var/normal = ""
var/magic = ""
var/holiday = ""
for(var/datum/round_event_control/E in SSevent.control)
for(var/datum/round_event_control/E in SSevents.control)
dat = "<BR><A href='?src=\ref[src];forceevent=\ref[E]'>[E]</A>"
if(E.holidayID)
holiday += dat
Expand All @@ -156,7 +149,7 @@ var/datum/controller/subsystem/events/SSevent
//Uncommenting ALLOW_HOLIDAYS in config.txt will enable holidays
//It's easy to add stuff. Just add a holiday datum in code/modules/holiday/holidays.dm
//You can then check if it's a special day in any code in the game by doing if(SSevent.holidays["Groundhog Day"])
//You can then check if it's a special day in any code in the game by doing if(SSevents.holidays["Groundhog Day"])
//You can also make holiday random events easily thanks to Pete/Gia's system.
//simply make a random event normally, then assign it a holidayID string which matches the holiday's name.
Expand Down Expand Up @@ -193,7 +186,7 @@ var/datum/controller/subsystem/events/SSevent

/datum/controller/subsystem/events/proc/toggleWizardmode()
wizardmode = !wizardmode
message_admins("Summon Events has been [wizardmode ? "enabled, events will occur every [SSevent.frequency_lower / 600] to [SSevent.frequency_upper / 600] minutes" : "disabled"]!")
message_admins("Summon Events has been [wizardmode ? "enabled, events will occur every [SSevents.frequency_lower / 600] to [SSevents.frequency_upper / 600] minutes" : "disabled"]!")
log_game("Summon Events was [wizardmode ? "enabled" : "disabled"]!")


Expand Down
8 changes: 1 addition & 7 deletions code/controllers/subsystem/fire_burning.dm
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
var/datum/controller/subsystem/fire_burning/SSfire_burning

/datum/controller/subsystem/fire_burning
SUBSYSTEM_DEF(fire_burning)
name = "Fire Burning"
priority = 40
flags = SS_NO_INIT|SS_BACKGROUND

var/list/currentrun = list()
var/list/processing = list()

/datum/controller/subsystem/fire_burning/New()
NEW_SS_GLOBAL(SSfire_burning)


/datum/controller/subsystem/fire_burning/stat_entry()
..("P:[processing.len]")

Expand Down
Loading

0 comments on commit 7b67f0b

Please sign in to comment.