mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Refactors roundstart checks slightly (#26131)
* Refactors roundstart checks slightly * Fix
This commit is contained in:
@@ -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 = "<span class='game deadsay'><span class='name'>\
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -238,7 +238,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()
|
||||
@@ -651,11 +651,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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 ++
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 = "<html><head><title>Round Status</title></head><body><h1><B>Round Status</B></h1>"
|
||||
if(SSticker.mode.replacementmode)
|
||||
dat += "Former Game Mode: <B>[SSticker.mode.name]</B><BR>"
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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, "<span class='warning'>This spawner is out of charges!</span>")
|
||||
|
||||
@@ -341,7 +341,7 @@ GLOBAL_LIST(external_rsc_urls)
|
||||
holder.owner = null
|
||||
GLOB.admins -= src
|
||||
|
||||
if (!GLOB.admins.len && SSticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing.
|
||||
if (!GLOB.admins.len && SSticker.IsRoundInProgress()) //Only report this stuff if we are currently playing.
|
||||
if(!GLOB.admins.len) //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(
|
||||
"I have no admins online!",\
|
||||
|
||||
@@ -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, "<span class='danger'>The round is either not ready, or has already finished...</span>")
|
||||
return
|
||||
|
||||
|
||||
@@ -337,7 +337,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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -96,7 +96,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] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("Emitter deleted at ([x],[y],[z])")
|
||||
investigate_log("<font color='red'>deleted</font> at ([x],[y],[z]) at [get_area(src)]","singulo")
|
||||
|
||||
@@ -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 (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>[area.name]</a>)")
|
||||
log_game("SMES deleted at ([area.name])")
|
||||
|
||||
@@ -313,3 +313,6 @@
|
||||
s += ": [jointext(features, ", ")]"
|
||||
|
||||
status = s
|
||||
|
||||
/world/proc/has_round_started()
|
||||
return SSticker.HasRoundStarted()
|
||||
Reference in New Issue
Block a user