Makes all global variables handled by the GLOB controller (#13152)

* Handlers converted, now to fix 3532 compile errors

* 3532 compile fixes later, got runtimes on startup

* Well the server loads now atleast

* Take 2

* Oops
This commit is contained in:
AffectedArc07
2020-03-21 03:56:37 +00:00
committed by GitHub
parent c8dbd0190e
commit 210f8badf4
667 changed files with 4243 additions and 4240 deletions
+15 -15
View File
@@ -275,7 +275,7 @@ SUBSYSTEM_DEF(air)
if(blockchanges && T.excited_group)
T.excited_group.garbage_collect()
else
for(var/direction in cardinal)
for(var/direction in GLOB.cardinal)
if(!(T.atmos_adjacent_turfs & direction))
continue
var/turf/simulated/S = get_step(T, direction)
@@ -360,21 +360,21 @@ SUBSYSTEM_DEF(air)
return count
/datum/controller/subsystem/air/proc/setup_overlays()
plmaster = new /obj/effect/overlay()
plmaster.icon = 'icons/effects/tile_effects.dmi'
plmaster.icon_state = "plasma"
plmaster.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
plmaster.anchored = TRUE // should only appear in vis_contents, but to be safe
plmaster.layer = FLY_LAYER
plmaster.appearance_flags = TILE_BOUND
GLOB.plmaster = new /obj/effect/overlay()
GLOB.plmaster.icon = 'icons/effects/tile_effects.dmi'
GLOB.plmaster.icon_state = "plasma"
GLOB.plmaster.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
GLOB.plmaster.anchored = TRUE // should only appear in vis_contents, but to be safe
GLOB.plmaster.layer = FLY_LAYER
GLOB.plmaster.appearance_flags = TILE_BOUND
slmaster = new /obj/effect/overlay()
slmaster.icon = 'icons/effects/tile_effects.dmi'
slmaster.icon_state = "sleeping_agent"
slmaster.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
slmaster.anchored = TRUE // should only appear in vis_contents, but to be safe
slmaster.layer = FLY_LAYER
slmaster.appearance_flags = TILE_BOUND
GLOB.slmaster = new /obj/effect/overlay()
GLOB.slmaster.icon = 'icons/effects/tile_effects.dmi'
GLOB.slmaster.icon_state = "sleeping_agent"
GLOB.slmaster.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
GLOB.slmaster.anchored = TRUE // should only appear in vis_contents, but to be safe
GLOB.slmaster.layer = FLY_LAYER
GLOB.slmaster.appearance_flags = TILE_BOUND
#undef SSAIR_PIPENETS
#undef SSAIR_ATMOSMACHINERY
+16 -16
View File
@@ -104,7 +104,7 @@ SUBSYSTEM_DEF(events)
html += "<A align='right' href='?src=[UID()];back=1'>Back</A><br>"
html += "Time till start: [round(event_time / 600, 0.1)]<br>"
html += "<div class='block'>"
html += "<h2>Available [severity_to_string[selected_event_container.severity]] Events (queued & running events will not be displayed)</h2>"
html += "<h2>Available [GLOB.severity_to_string[selected_event_container.severity]] Events (queued & running events will not be displayed)</h2>"
html += "<table[table_options]>"
html += "<tr[head_options]><td[row_options2]>Name </td><td>Weight </td><td>MinWeight </td><td>MaxWeight </td><td>OneShot </td><td>Enabled </td><td><span class='alert'>CurrWeight </span></td><td>Remove</td></tr>"
for(var/datum/event_meta/EM in selected_event_container.available_events)
@@ -145,7 +145,7 @@ SUBSYSTEM_DEF(events)
var/datum/event_container/EC = event_containers[severity]
var/next_event_at = max(0, EC.next_event_time - world.time)
html += "<tr>"
html += "<td>[severity_to_string[severity]]</td>"
html += "<td>[GLOB.severity_to_string[severity]]</td>"
html += "<td>[station_time_timestamp("hh:mm:ss", max(EC.next_event_time, world.time))]</td>"
html += "<td>[round(next_event_at / 600, 0.1)]</td>"
html += "<td>"
@@ -172,7 +172,7 @@ SUBSYSTEM_DEF(events)
var/datum/event_container/EC = event_containers[severity]
var/datum/event_meta/EM = EC.next_event
html += "<tr>"
html += "<td>[severity_to_string[severity]]</td>"
html += "<td>[GLOB.severity_to_string[severity]]</td>"
html += "<td><A align='right' href='?src=[UID()];select_event=\ref[EC]'>[EM ? EM.name : "Random"]</A></td>"
html += "<td><A align='right' href='?src=[UID()];view_events=\ref[EC]'>View</A></td>"
html += "<td><A align='right' href='?src=[UID()];clear=\ref[EC]'>Clear</A></td>"
@@ -193,7 +193,7 @@ SUBSYSTEM_DEF(events)
var/ends_in = max(0, round((ends_at - world.time) / 600, 0.1))
var/no_end = E.noAutoEnd
html += "<tr>"
html += "<td>[severity_to_string[EM.severity]]</td>"
html += "<td>[GLOB.severity_to_string[EM.severity]]</td>"
html += "<td>[EM.name]</td>"
html += "<td>[no_end ? "N/A" : station_time_timestamp("hh:mm:ss", ends_at)]</td>"
html += "<td>[no_end ? "N/A" : ends_in]</td>"
@@ -216,33 +216,33 @@ SUBSYSTEM_DEF(events)
var/datum/event_container/EC = locate(href_list["event"])
var/decrease = (60 * RaiseToPower(10, text2num(href_list["dec_timer"])))
EC.next_event_time -= decrease
admin_log_and_message_admins("decreased timer for [severity_to_string[EC.severity]] events by [decrease/600] minute(s).")
admin_log_and_message_admins("decreased timer for [GLOB.severity_to_string[EC.severity]] events by [decrease/600] minute(s).")
else if(href_list["inc_timer"])
var/datum/event_container/EC = locate(href_list["event"])
var/increase = (60 * RaiseToPower(10, text2num(href_list["inc_timer"])))
EC.next_event_time += increase
admin_log_and_message_admins("increased timer for [severity_to_string[EC.severity]] events by [increase/600] minute(s).")
admin_log_and_message_admins("increased timer for [GLOB.severity_to_string[EC.severity]] events by [increase/600] minute(s).")
else if(href_list["select_event"])
var/datum/event_container/EC = locate(href_list["select_event"])
var/datum/event_meta/EM = EC.SelectEvent()
if(EM)
admin_log_and_message_admins("has queued the [severity_to_string[EC.severity]] event '[EM.name]'.")
admin_log_and_message_admins("has queued the [GLOB.severity_to_string[EC.severity]] event '[EM.name]'.")
else if(href_list["pause"])
var/datum/event_container/EC = locate(href_list["pause"])
EC.delayed = !EC.delayed
admin_log_and_message_admins("has [EC.delayed ? "paused" : "resumed"] countdown for [severity_to_string[EC.severity]] events.")
admin_log_and_message_admins("has [EC.delayed ? "paused" : "resumed"] countdown for [GLOB.severity_to_string[EC.severity]] events.")
else if(href_list["interval"])
var/delay = input("Enter delay modifier. A value less than one means events fire more often, higher than one less often.", "Set Interval Modifier") as num|null
if(delay && delay > 0)
var/datum/event_container/EC = locate(href_list["interval"])
EC.delay_modifier = delay
admin_log_and_message_admins("has set the interval modifier for [severity_to_string[EC.severity]] events to [EC.delay_modifier].")
admin_log_and_message_admins("has set the interval modifier for [GLOB.severity_to_string[EC.severity]] events to [EC.delay_modifier].")
else if(href_list["stop"])
if(alert("Stopping an event may have unintended side-effects. Continue?","Stopping Event!","Yes","No") != "Yes")
return
var/datum/event/E = locate(href_list["stop"])
var/datum/event_meta/EM = E.event_meta
admin_log_and_message_admins("has stopped the [severity_to_string[EM.severity]] event '[EM.name]'.")
admin_log_and_message_admins("has stopped the [GLOB.severity_to_string[EM.severity]] event '[EM.name]'.")
E.kill()
else if(href_list["view_events"])
selected_event_container = locate(href_list["view_events"])
@@ -264,23 +264,23 @@ SUBSYSTEM_DEF(events)
var/datum/event_meta/EM = locate(href_list["set_weight"])
EM.weight = weight
if(EM != new_event)
admin_log_and_message_admins("has changed the weight of the [severity_to_string[EM.severity]] event '[EM.name]' to [EM.weight].")
admin_log_and_message_admins("has changed the weight of the [GLOB.severity_to_string[EM.severity]] event '[EM.name]' to [EM.weight].")
else if(href_list["toggle_oneshot"])
var/datum/event_meta/EM = locate(href_list["toggle_oneshot"])
EM.one_shot = !EM.one_shot
if(EM != new_event)
admin_log_and_message_admins("has [EM.one_shot ? "set" : "unset"] the oneshot flag for the [severity_to_string[EM.severity]] event '[EM.name]'.")
admin_log_and_message_admins("has [EM.one_shot ? "set" : "unset"] the oneshot flag for the [GLOB.severity_to_string[EM.severity]] event '[EM.name]'.")
else if(href_list["toggle_enabled"])
var/datum/event_meta/EM = locate(href_list["toggle_enabled"])
EM.enabled = !EM.enabled
admin_log_and_message_admins("has [EM.enabled ? "enabled" : "disabled"] the [severity_to_string[EM.severity]] event '[EM.name]'.")
admin_log_and_message_admins("has [EM.enabled ? "enabled" : "disabled"] the [GLOB.severity_to_string[EM.severity]] event '[EM.name]'.")
else if(href_list["remove"])
if(alert("This will remove the event from rotation. Continue?","Removing Event!","Yes","No") != "Yes")
return
var/datum/event_meta/EM = locate(href_list["remove"])
var/datum/event_container/EC = locate(href_list["EC"])
EC.available_events -= EM
admin_log_and_message_admins("has removed the [severity_to_string[EM.severity]] event '[EM.name]'.")
admin_log_and_message_admins("has removed the [GLOB.severity_to_string[EM.severity]] event '[EM.name]'.")
else if(href_list["add"])
if(!new_event.name || !new_event.event_type)
return
@@ -288,12 +288,12 @@ SUBSYSTEM_DEF(events)
return
new_event.severity = selected_event_container.severity
selected_event_container.available_events += new_event
admin_log_and_message_admins("has added \a [severity_to_string[new_event.severity]] event '[new_event.name]' of type [new_event.event_type] with weight [new_event.weight].")
admin_log_and_message_admins("has added \a [GLOB.severity_to_string[new_event.severity]] event '[new_event.name]' of type [new_event.event_type] with weight [new_event.weight].")
new_event = new
else if(href_list["clear"])
var/datum/event_container/EC = locate(href_list["clear"])
if(EC.next_event)
admin_log_and_message_admins("has dequeued the [severity_to_string[EC.severity]] event '[EC.next_event.name]'.")
admin_log_and_message_admins("has dequeued the [GLOB.severity_to_string[EC.severity]] event '[EC.next_event.name]'.")
EC.next_event = null
Interact(usr)
+7 -7
View File
@@ -49,7 +49,7 @@ SUBSYSTEM_DEF(jobs)
/datum/controller/subsystem/jobs/proc/Debug(var/text)
if(!Debug2)
if(!GLOB.debug2)
return 0
job_debug.Add(text)
return 1
@@ -155,10 +155,10 @@ SUBSYSTEM_DEF(jobs)
if(istype(job, GetJob("Civilian"))) // We don't want to give him assistant, that's boring!
continue
if(job.title in command_positions) //If you want a command position, select it!
if(job.title in GLOB.command_positions) //If you want a command position, select it!
continue
if(job.title in whitelisted_positions) // No random whitelisted job, sorry!
if(job.title in GLOB.whitelisted_positions) // No random whitelisted job, sorry!
continue
if(job.admin_only) // No admin positions either.
@@ -203,7 +203,7 @@ SUBSYSTEM_DEF(jobs)
///This proc is called before the level loop of DivideOccupations() and will try to select a head, ignoring ALL non-head preferences for every level until it locates a head or runs out of levels to check
/datum/controller/subsystem/jobs/proc/FillHeadPosition()
for(var/level = 1 to 3)
for(var/command_position in command_positions)
for(var/command_position in GLOB.command_positions)
var/datum/job/job = GetJob(command_position)
if(!job)
continue
@@ -231,7 +231,7 @@ SUBSYSTEM_DEF(jobs)
///This proc is called at the start of the level loop of DivideOccupations() and will cause head jobs to be checked before any other jobs of the same level
/datum/controller/subsystem/jobs/proc/CheckHeadPositions(var/level)
for(var/command_position in command_positions)
for(var/command_position in GLOB.command_positions)
var/datum/job/job = GetJob(command_position)
if(!job)
continue
@@ -600,7 +600,7 @@ SUBSYSTEM_DEF(jobs)
// If they're head, give them the account info for their department
if(job && job.head_position)
remembered_info = ""
var/datum/money_account/department_account = department_accounts[job.department]
var/datum/money_account/department_account = GLOB.department_accounts[job.department]
if(department_account)
remembered_info += "<b>Your department's account number is:</b> #[department_account.account_number]<br>"
@@ -638,7 +638,7 @@ SUBSYSTEM_DEF(jobs)
var/datum/job/oldjobdatum = SSjobs.GetJob(oldtitle)
var/datum/job/newjobdatum = SSjobs.GetJob(newtitle)
if(istype(oldjobdatum) && oldjobdatum.current_positions > 0 && istype(newjobdatum))
if(!(oldjobdatum.title in command_positions) && !(newjobdatum.title in command_positions))
if(!(oldjobdatum.title in GLOB.command_positions) && !(newjobdatum.title in GLOB.command_positions))
oldjobdatum.current_positions--
newjobdatum.current_positions++
+5 -5
View File
@@ -13,21 +13,21 @@ SUBSYSTEM_DEF(mapping)
if(!config.disable_space_ruins)
var/timer = start_watch()
log_startup_progress("Creating random space levels...")
seedRuins(list(level_name_to_num(EMPTY_AREA)), rand(0, 3), /area/space, space_ruins_templates)
seedRuins(list(level_name_to_num(EMPTY_AREA)), rand(0, 3), /area/space, GLOB.space_ruins_templates)
log_startup_progress("Loaded random space levels in [stop_watch(timer)]s.")
// load in extra levels of space ruins
var/num_extra_space = rand(config.extra_space_ruin_levels_min, config.extra_space_ruin_levels_max)
for(var/i = 1, i <= num_extra_space, i++)
var/zlev = space_manager.add_new_zlevel("[EMPTY_AREA] #[i]", linkage = CROSSLINKED, traits = list(REACHABLE))
seedRuins(list(zlev), rand(0, 3), /area/space, space_ruins_templates)
var/zlev = GLOB.space_manager.add_new_zlevel("[EMPTY_AREA] #[i]", linkage = CROSSLINKED, traits = list(REACHABLE))
seedRuins(list(zlev), rand(0, 3), /area/space, GLOB.space_ruins_templates)
// Setup the Z-level linkage
space_manager.do_transition_setup()
GLOB.space_manager.do_transition_setup()
// Spawn Lavaland ruins and rivers.
seedRuins(list(level_name_to_num(MINING)), config.lavaland_budget, /area/lavaland/surface/outdoors/unexplored, lava_ruins_templates)
seedRuins(list(level_name_to_num(MINING)), config.lavaland_budget, /area/lavaland/surface/outdoors/unexplored, GLOB.lava_ruins_templates)
spawn_rivers(list(level_name_to_num(MINING)))
return ..()
+3 -3
View File
@@ -25,12 +25,12 @@ SUBSYSTEM_DEF(nightshift)
check_nightshift()
/datum/controller/subsystem/nightshift/proc/announce(message)
priority_announcement.Announce(message, new_sound = 'sound/misc/notice2.ogg', new_title = "Automated Lighting System Announcement")
GLOB.priority_announcement.Announce(message, new_sound = 'sound/misc/notice2.ogg', new_title = "Automated Lighting System Announcement")
/datum/controller/subsystem/nightshift/proc/check_nightshift(check_canfire=FALSE)
if(check_canfire && !can_fire)
return
var/emergency = security_level >= SEC_LEVEL_RED
var/emergency = GLOB.security_level >= SEC_LEVEL_RED
var/announcing = TRUE
var/time = station_time()
var/night_time = (time < nightshift_end_time) || (time > nightshift_start_time)
@@ -41,7 +41,7 @@ SUBSYSTEM_DEF(nightshift)
if(!emergency)
announce("Restoring night lighting configuration to normal operation.")
else
announce("Disabling night lighting: Station is in a state of emergency.")
announce("Disabling night lighting: Station is in a state of emergency.")
if(emergency)
night_time = FALSE
if(nightshift_active != night_time)
+17 -17
View File
@@ -33,7 +33,8 @@ SUBSYSTEM_DEF(ticker)
var/triai = 0//Global holder for Triumvirate
var/initialtpass = 0 //holder for inital autotransfer vote timer
var/obj/screen/cinematic = null //used for station explosion cinematic
var/round_end_announced = 0 // Spam Prevention. Announce round end only once.\
var/round_end_announced = 0 // Spam Prevention. Announce round end only once.
var/ticker_going = TRUE // This used to be in the unused globals, but it turns out its actually used in a load of places. Its now a ticker var because its related to round stuff, -aa
/datum/controller/subsystem/ticker/Initialize()
login_music = pick(\
@@ -42,10 +43,9 @@ SUBSYSTEM_DEF(ticker)
'sound/music/title1.ogg',\
'sound/music/title2.ogg',\
'sound/music/title3.ogg',)
// Map name
if(using_map && using_map.name)
GLOB.map_name = "[using_map.name]"
if(GLOB.using_map && GLOB.using_map.name)
GLOB.map_name = "[GLOB.using_map.name]"
else
GLOB.map_name = "Unknown"
@@ -68,12 +68,12 @@ SUBSYSTEM_DEF(ticker)
current_state = GAME_STATE_PREGAME
fire() // TG says this is a good idea
if(GAME_STATE_PREGAME)
if(!going)
if(!SSticker.ticker_going) // This has to be referenced like this, and I dont know why. If you dont put SSticker. it will break
return
// This is so we dont have sleeps in controllers, because that is a bad, bad thing
if(!delay_end)
pregame_timeleft = max(0,round_start_time - world.time) // Normal lobby countdown when roundstart was not delayed
pregame_timeleft = max(0,round_start_time - world.time) // Normal lobby countdown when roundstart was not delayed
else
pregame_timeleft = max(0,pregame_timeleft - 20) // If roundstart was delayed, we should resume the countdown where it left off
@@ -129,20 +129,20 @@ SUBSYSTEM_DEF(ticker)
/datum/controller/subsystem/ticker/proc/setup()
cultdat = setupcult()
//Create and announce mode
if(master_mode=="secret")
if(GLOB.master_mode=="secret")
src.hide_mode = 1
var/list/datum/game_mode/runnable_modes
if((master_mode=="random") || (master_mode=="secret"))
if((GLOB.master_mode=="random") || (GLOB.master_mode=="secret"))
runnable_modes = config.get_runnable_modes()
if(runnable_modes.len==0)
current_state = GAME_STATE_PREGAME
Master.SetRunLevel(RUNLEVEL_LOBBY)
to_chat(world, "<B>Unable to choose playable game mode.</B> Reverting to pre-game lobby.")
return 0
if(secret_force_mode != "secret")
var/datum/game_mode/M = config.pick_mode(secret_force_mode)
if(GLOB.secret_force_mode != "secret")
var/datum/game_mode/M = config.pick_mode(GLOB.secret_force_mode)
if(M.can_start())
src.mode = config.pick_mode(secret_force_mode)
src.mode = config.pick_mode(GLOB.secret_force_mode)
SSjobs.ResetOccupations()
if(!src.mode)
src.mode = pickweight(runnable_modes)
@@ -150,7 +150,7 @@ SUBSYSTEM_DEF(ticker)
var/mtype = src.mode.type
src.mode = new mtype
else
src.mode = config.pick_mode(master_mode)
src.mode = config.pick_mode(GLOB.master_mode)
if(!src.mode.can_start())
to_chat(world, "<B>Unable to start [mode.name].</B> Not enough players, [mode.required_players] players needed. Reverting to pre-game lobby.")
mode = null
@@ -167,7 +167,7 @@ SUBSYSTEM_DEF(ticker)
if(!can_continue)
qdel(mode)
current_state = GAME_STATE_PREGAME
to_chat(world, "<B>Error setting up [master_mode].</B> Reverting to pre-game lobby.")
to_chat(world, "<B>Error setting up [GLOB.master_mode].</B> Reverting to pre-game lobby.")
SSjobs.ResetOccupations()
Master.SetRunLevel(RUNLEVEL_LOBBY)
return 0
@@ -186,7 +186,7 @@ SUBSYSTEM_DEF(ticker)
populate_spawn_points()
collect_minds()
equip_characters()
data_core.manifest()
GLOB.data_core.manifest()
current_state = GAME_STATE_PLAYING
Master.SetRunLevel(RUNLEVEL_GAME)
@@ -449,11 +449,11 @@ SUBSYSTEM_DEF(ticker)
/datum/controller/subsystem/ticker/proc/declare_completion()
nologevent = 1 //end of round murder and shenanigans are legal; there's no need to jam up attack logs past this point.
GLOB.nologevent = 1 //end of round murder and shenanigans are legal; there's no need to jam up attack logs past this point.
//Round statistics report
var/datum/station_state/end_state = new /datum/station_state()
end_state.count()
var/station_integrity = min(round( 100.0 * start_state.score(end_state), 0.1), 100.0)
var/station_integrity = min(round( 100.0 * GLOB.start_state.score(end_state), 0.1), 100.0)
to_chat(world, "<BR>[TAB]Shift Duration: <B>[round(ROUND_TIME / 36000)]:[add_zero("[ROUND_TIME / 600 % 60]", 2)]:[ROUND_TIME / 100 % 6][ROUND_TIME / 100 % 10]</B>")
to_chat(world, "<BR>[TAB]Station Integrity: <B>[mode.station_was_nuked ? "<font color='red'>Destroyed</font>" : "[station_integrity]%"]</B>")
@@ -519,7 +519,7 @@ SUBSYSTEM_DEF(ticker)
SSevents.RoundEnd()
// Add AntagHUD to everyone, see who was really evil the whole time!
for(var/datum/atom_hud/antag/H in huds)
for(var/datum/atom_hud/antag/H in GLOB.huds)
for(var/m in GLOB.player_list)
var/mob/M = m
H.add_hud_to(M)
+10 -10
View File
@@ -90,10 +90,10 @@ SUBSYSTEM_DEF(vote)
if(choices["Continue Playing"] >= greatest_votes)
greatest_votes = choices["Continue Playing"]
else if(mode == "gamemode")
if(master_mode in choices)
choices[master_mode] += non_voters
if(choices[master_mode] >= greatest_votes)
greatest_votes = choices[master_mode]
if(GLOB.master_mode in choices)
choices[GLOB.master_mode] += non_voters
if(choices[GLOB.master_mode] >= greatest_votes)
greatest_votes = choices[GLOB.master_mode]
else if(mode == "crew_transfer")
var/factor = 0.5
switch(world.time / (10 * 60)) // minutes
@@ -164,14 +164,14 @@ SUBSYSTEM_DEF(vote)
if(. == "Restart Round")
restart = 1
if("gamemode")
if(master_mode != .)
if(GLOB.master_mode != .)
world.save_mode(.)
if(SSticker && SSticker.mode)
restart = 1
else
master_mode = .
if(!going)
going = 1
GLOB.master_mode = .
if(!SSticker.ticker_going)
SSticker.ticker_going = TRUE
to_chat(world, "<font color='red'><b>The round will start soon.</b></font>")
if("crew_transfer")
if(. == "Initiate Crew Transfer")
@@ -253,8 +253,8 @@ SUBSYSTEM_DEF(vote)
world << sound('sound/ambience/alarm4.ogg')
if("custom")
world << sound('sound/ambience/alarm4.ogg')
if(mode == "gamemode" && going)
going = 0
if(mode == "gamemode" && SSticker.ticker_going)
SSticker.ticker_going = FALSE
to_chat(world, "<font color='red'><b>Round start has been delayed.</b></font>")
if(mode == "crew_transfer" && config.ooc_allowed)
auto_muted = 1