diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 6fd41f7ea1..6bc79fb7d5 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -513,7 +513,7 @@ winset(C, "mainwindow", "flash=5") /proc/AnnounceArrival(var/mob/living/carbon/human/character, var/rank) - if(SSticker.current_state != GAME_STATE_PLAYING || !character) + if(!SSticker.IsRoundInProgress() || !character) return var/area/A = get_area(character) var/message = "\ diff --git a/code/controllers/master.dm b/code/controllers/master.dm index ab4ff43b04..01d0ac3447 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -48,7 +48,7 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING) var/initializations_finished_with_no_players_logged_in //I wonder what this could be? // Has round started? (So we know what subsystems to run) - var/round_started = 0 + var/local_round_started = FALSE //Don't read this var, use SSticker.HasRoundStarted() instead // The type of the last subsystem to be process()'d. var/last_type_processed @@ -189,7 +189,7 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING) // Notify the MC that the round has started. /datum/controller/master/proc/RoundStart() - round_started = 1 + local_round_started = TRUE var/timer = world.time for (var/datum/controller/subsystem/SS in subsystems) if (SS.flags & SS_FIRE_IN_LOBBY || SS.flags & SS_TICKER) @@ -222,7 +222,7 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING) // local vars rock // Schedule the first run of the Subsystems. - round_started = world.has_round_started() + local_round_started = world.has_round_started() //all this shit is here so that flag edits can be refreshed by restarting the MC. (and for speed) var/list/tickersubsystems = list() var/list/normalsubsystems = list() @@ -245,7 +245,7 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING) lobbysubsystems += SS timer += world.tick_lag * rand(1, 5) SS.next_fire = timer - else if (round_started) + else if (local_round_started) timer += world.tick_lag * rand(1, 5) SS.next_fire = timer normalsubsystems += SS @@ -296,7 +296,7 @@ GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING) if (!Failsafe || (Failsafe.processing_interval > 0 && (Failsafe.lasttick+(Failsafe.processing_interval*5)) < world.time)) new/datum/controller/failsafe() // (re)Start the failsafe. if (!queue_head || !(iteration % 3)) - if (round_started) + if (local_round_started) subsystems_to_check = normalsubsystems else subsystems_to_check = lobbysubsystems diff --git a/code/controllers/subsystem/server_maint.dm b/code/controllers/subsystem/server_maint.dm index d3a0862112..08f60d23e6 100644 --- a/code/controllers/subsystem/server_maint.dm +++ b/code/controllers/subsystem/server_maint.dm @@ -17,7 +17,7 @@ SUBSYSTEM_DEF(server_maint) src.currentrun = GLOB.clients.Copy() var/list/currentrun = src.currentrun - var/round_started = Master.round_started + var/round_started = SSticker.HasRoundStarted() for(var/I in currentrun) var/client/C = I diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index f701c051da..f3ac66e001 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -243,7 +243,7 @@ SUBSYSTEM_DEF(ticker) send2irc("Server", "Round of [hide_mode ? "secret":"[mode.name]"] has started[allmins.len ? ".":" with no active admins online!"]") /datum/controller/subsystem/ticker/proc/OnRoundstart(datum/callback/cb) - if(current_state < GAME_STATE_PLAYING) + if(!HasRoundStarted()) LAZYADD(round_start_events, cb) else cb.InvokeAsync() @@ -672,15 +672,16 @@ SUBSYSTEM_DEF(ticker) return INVOKE_ASYNC(SSmapping, /datum/controller/subsystem/mapping/.proc/maprotate) +/datum/controller/subsystem/ticker/proc/HasRoundStarted() + return current_state >= GAME_STATE_PLAYING + +/datum/controller/subsystem/ticker/proc/IsRoundInProgress() + return current_state == GAME_STATE_PLAYING + /proc/send_gamemode_vote() SSticker.modevoted = TRUE SSvote.initiate_vote("roundtype","server") -/world/proc/has_round_started() - if (SSticker && SSticker.current_state >= GAME_STATE_PLAYING) - return TRUE - return FALSE - /datum/controller/subsystem/ticker/Recover() current_state = SSticker.current_state force_ending = SSticker.force_ending diff --git a/code/controllers/subsystem/ticker.dm.rej b/code/controllers/subsystem/ticker.dm.rej new file mode 100644 index 0000000000..1dbd2f038a --- /dev/null +++ b/code/controllers/subsystem/ticker.dm.rej @@ -0,0 +1,17 @@ +diff a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm (rejected hunks) +@@ -667,11 +667,11 @@ SUBSYSTEM_DEF(ticker) + return + INVOKE_ASYNC(SSmapping, /datum/controller/subsystem/mapping/.proc/maprotate) + ++/datum/controller/subsystem/ticker/proc/HasRoundStarted() ++ return current_state >= GAME_STATE_PLAYING + +-/world/proc/has_round_started() +- if (SSticker && SSticker.current_state >= GAME_STATE_PLAYING) +- return TRUE +- return FALSE ++/datum/controller/subsystem/ticker/proc/IsRoundInProgress() ++ return current_state == GAME_STATE_PLAYING + + /datum/controller/subsystem/ticker/Recover() + current_state = SSticker.current_state diff --git a/code/datums/helper_datums/getrev.dm b/code/datums/helper_datums/getrev.dm index 907e411ff3..b9358817e3 100644 --- a/code/datums/helper_datums/getrev.dm +++ b/code/datums/helper_datums/getrev.dm @@ -89,7 +89,7 @@ to_chat(src, "Enforce Continuous Rounds: [config.continuous.len] of [config.modes.len] roundtypes") to_chat(src, "Allow Midround Antagonists: [config.midround_antag.len] of [config.modes.len] roundtypes") if(config.show_game_type_odds) - if(SSticker.current_state == GAME_STATE_PLAYING) + if(SSticker.IsRoundInProgress()) var/prob_sum = 0 var/current_odds_differ = FALSE var/list/probs = list() diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index c082a48224..6ac0ab8c7c 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -654,7 +654,7 @@ GLOBAL_LIST_EMPTY(possible_items_special) for(var/mob/dead/new_player/P in GLOB.player_list) if(P.client && P.ready && P.mind!=owner) n_p ++ - else if (SSticker.current_state == GAME_STATE_PLAYING) + else if (SSticker.IsRoundInProgress()) for(var/mob/living/carbon/human/P in GLOB.player_list) if(P.client && !(P.mind in SSticker.mode.changelings) && P.mind!=owner) n_p ++ diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 1c2d65355e..4c29d87dfa 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -398,7 +398,7 @@ /turf/proc/add_blueprints_preround(atom/movable/AM) - if(!SSticker || SSticker.current_state != GAME_STATE_PLAYING) + if(!SSticker.HasRoundStarted()) add_blueprints(AM) /turf/proc/empty(turf_type=/turf/open/space) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 25ddc4d68d..0e7986ec18 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -804,7 +804,7 @@ return 1 /client/proc/adminGreet(logout) - if(SSticker && SSticker.current_state == GAME_STATE_PLAYING) + if(SSticker.HasRoundStarted()) var/string if(logout && config && config.announce_admin_logout) string = pick( diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index bfa8553d52..09aced33a8 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -310,7 +310,7 @@ usr << browse(dat, "window=players;size=600x480") /datum/admins/proc/check_antagonists() - if (SSticker && SSticker.current_state >= GAME_STATE_PLAYING) + if (SSticker.HasRoundStarted()) var/dat = "Round Status

Round Status

" if(SSticker.mode.replacementmode) dat += "Former Game Mode: [SSticker.mode.name]
" diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index e1bc663a0c..1796c89c96 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2161,7 +2161,7 @@ else if(href_list["kick_all_from_lobby"]) if(!check_rights(R_ADMIN)) return - if(SSticker && SSticker.current_state == GAME_STATE_PLAYING) + if(SSticker.IsRoundInProgress()) var/afkonly = text2num(href_list["afkonly"]) if(alert("Are you sure you want to kick all [afkonly ? "AFK" : ""] clients from the lobby??","Message","Yes","Cancel") != "Yes") to_chat(usr, "Kick clients from lobby aborted") diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 996b4a700b..93b9b6b3f9 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -206,7 +206,7 @@ toggle_all_ctf(user) return - if(SSticker.current_state < GAME_STATE_PLAYING) + if(!SSticker.HasRoundStarted()) return if(user.ckey in team_members) if(user.ckey in recently_dead_ckeys) diff --git a/code/modules/awaymissions/corpse.dm b/code/modules/awaymissions/corpse.dm index d9663f97c9..96c0bc35de 100644 --- a/code/modules/awaymissions/corpse.dm +++ b/code/modules/awaymissions/corpse.dm @@ -22,7 +22,7 @@ anchored = 1 /obj/effect/mob_spawn/attack_ghost(mob/user) - if(SSticker.current_state != GAME_STATE_PLAYING || !loc) + if(!SSticker.HasRoundStarted() || !loc) return if(!uses) to_chat(user, "This spawner is out of charges!") diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index e6adb53ff6..bc00dc395a 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -149,7 +149,7 @@ return 1 if(href_list["late_join"]) - if(!SSticker || SSticker.current_state != GAME_STATE_PLAYING) + if(!SSticker || !SSticker.IsRoundInProgress()) to_chat(usr, "The round is either not ready, or has already finished...") return diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 043ddbb4fb..8db43623dc 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -340,7 +340,7 @@ . = 1 /mob/living/simple_animal/proc/make_babies() // <3 <3 <3 - if(gender != FEMALE || stat || next_scan_time > world.time || !childtype || !animal_species || SSticker.current_state != GAME_STATE_PLAYING) + if(gender != FEMALE || stat || next_scan_time > world.time || !childtype || !animal_species || !SSticker.IsRoundInProgress()) return next_scan_time = world.time + 400 var/alone = 1 diff --git a/code/modules/mob/logout.dm.rej b/code/modules/mob/logout.dm.rej new file mode 100644 index 0000000000..809131d9f4 --- /dev/null +++ b/code/modules/mob/logout.dm.rej @@ -0,0 +1,10 @@ +diff a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm (rejected hunks) +@@ -3,7 +3,7 @@ + unset_machine() + GLOB.player_list -= src + if(GLOB.admin_datums[src.ckey]) +- if (SSticker && SSticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing. ++ if (SSticker && SSticker.IsRoundInProgress()) //Only report this stuff if we are currently playing. + var/admins_number = GLOB.admins.len + if(admins_number == 0) //Apparently the admin logging out is no longer an admin at this point, so we have to check this towards 0 and not towards 1. Awell. + var/cheesy_message = pick( list( \ diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index 7a5abbbba4..6ca3c8f620 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -304,7 +304,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne // Sound the alert if gravity was just enabled or disabled. var/alert = 0 var/area/area = get_area(src) - if(on && SSticker && SSticker.current_state == GAME_STATE_PLAYING) // If we turned on and the game is live. + if(on && SSticker.IsRoundInProgress()) // If we turned on and the game is live. if(gravity_in_level() == 0) alert = 1 investigate_log("was brought online and is now producing gravity for this level.", "gravity") diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index ff7a79bc69..cfe57d0607 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -7,7 +7,7 @@ anchored = 0 density = 1 req_access = list(GLOB.access_engine_equip) - + // The following 3 vars are mostly for the prototype var/manual = FALSE var/charge = 0 @@ -88,7 +88,7 @@ rotate() /obj/machinery/power/emitter/Initialize() - . = ..() + . = ..() if(state == 2 && anchored) connect_to_network() @@ -97,7 +97,7 @@ sparks.set_up(5, TRUE, src) /obj/machinery/power/emitter/Destroy() - if(SSticker && SSticker.current_state == GAME_STATE_PLAYING) + if(SSticker && SSticker.IsRoundInProgress()) message_admins("Emitter deleted at ([x],[y],[z] - JMP)",0,1) log_game("Emitter deleted at ([x],[y],[z])") investigate_log("deleted at ([x],[y],[z]) at [get_area(src)]","singulo") @@ -200,8 +200,8 @@ /obj/machinery/power/emitter/proc/fire_beam(atom/targeted_atom, mob/user) var/turf/targets_from = get_turf(src) - if(targeted_atom && (targeted_atom == user || targeted_atom == targets_from || targeted_atom == src)) - return + if(targeted_atom && (targeted_atom == user || targeted_atom == targets_from || targeted_atom == src)) + return var/obj/item/projectile/P = new projectile_type(targets_from) playsound(src.loc, projectile_sound, 50, 1) if(prob(35)) diff --git a/code/modules/power/singularity/emitter.dm.rej b/code/modules/power/singularity/emitter.dm.rej new file mode 100644 index 0000000000..ea82e4cb0c --- /dev/null +++ b/code/modules/power/singularity/emitter.dm.rej @@ -0,0 +1,10 @@ +diff a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm (rejected hunks) +@@ -88,7 +88,7 @@ + connect_to_network() + + /obj/machinery/power/emitter/Destroy() +- if(SSticker && SSticker.current_state == GAME_STATE_PLAYING) ++ if(SSticker && SSticker.IsRoundInProgress()) + message_admins("Emitter deleted at ([x],[y],[z] - JMP)",0,1) + log_game("Emitter deleted at ([x],[y],[z])") + investigate_log("deleted at ([x],[y],[z]) at [get_area(src)]","singulo") diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index fdb4699ae5..1e1737661e 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -191,7 +191,7 @@ cell.charge = (charge / capacity) * cell.maxcharge /obj/machinery/power/smes/Destroy() - if(SSticker && SSticker.current_state == GAME_STATE_PLAYING) + if(SSticker && SSticker.IsRoundInProgress()) var/area/area = get_area(src) message_admins("SMES deleted at ([area.name])") log_game("SMES deleted at ([area.name])") diff --git a/code/world.dm b/code/world.dm index 4e00c32f60..2a0c37fa64 100644 --- a/code/world.dm +++ b/code/world.dm @@ -316,3 +316,6 @@ s += ": [jointext(features, ", ")]" status = s + +/world/proc/has_round_started() + return SSticker.HasRoundStarted() \ No newline at end of file