Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors SSTicker checks #28469

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@
// ^ whoever left this comment is literally a grammar nazi. stalin better. in russia grammar correct you.

/datum/mind/proc/edit_memory()
if(!SSticker || !SSticker.mode)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("Not before round-start!", "Alert")
return

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/windowdoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
return
do_animate("deny")
return
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PREGAME)
return
var/mob/living/M = AM
if(!M.restrained() && M.mob_size > MOB_SIZE_TINY && (!(isrobot(M) && M.stat)))
Expand Down
2 changes: 1 addition & 1 deletion code/game/sound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ falloff_distance - Distance at which falloff begins. Sound is at peak volume (in
SEND_SOUND(src, S)

/client/proc/playtitlemusic()
if(!SSticker || !SSticker.login_music || GLOB.configuration.general.disable_lobby_music)
if(SSticker.current_state < GAME_STATE_STARTUP || !SSticker.login_music || GLOB.configuration.general.disable_lobby_music)
return
if(prefs.sound & SOUND_LOBBY)
SEND_SOUND(src, sound(SSticker.login_music, repeat = 0, wait = 0, volume = 85 * prefs.get_channel_volume(CHANNEL_LOBBYMUSIC), channel = CHANNEL_LOBBYMUSIC)) // MAD JAMS
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@
LAZYADD(blueprint_data, I)

/turf/proc/add_blueprints_preround(atom/movable/AM)
if(!SSticker || SSticker.current_state != GAME_STATE_PLAYING)
if(SSticker.current_state == GAME_STATE_STARTUP || SSticker.current_state != GAME_STATE_PLAYING)
add_blueprints(AM)

/turf/proc/empty(turf_type = /turf/space)
Expand Down
2 changes: 1 addition & 1 deletion code/game/verbs/suicide.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
to_chat(src, "You're already dead!")
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
to_chat(src, "You can't commit suicide before the game starts!")
return

Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/misc_admin_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ GLOBAL_VAR_INIT(disable_explosions, FALSE)
if(!check_rights(R_SERVER))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PREGAME)
alert("Unable to start the game as it is not set up.")
return

Expand Down Expand Up @@ -604,7 +604,7 @@ GLOBAL_VAR_INIT(disable_explosions, FALSE)
if(!check_rights(R_SERVER))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_STARTUP)
alert("Slow down a moment, let the ticker start first!")
return

Expand Down
8 changes: 4 additions & 4 deletions code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2722,7 +2722,7 @@
else if(href_list["traitor"])
if(!check_rights(R_ADMIN|R_MOD)) return

if(!SSticker || !SSticker.mode)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!")
return

Expand Down Expand Up @@ -2998,7 +2998,7 @@
SSblackbox.record_feedback("tally", "admin_secrets_fun_used", 1, "Power All SMESs")
log_and_message_admins("<span class='notice'>[key_name(usr)] made all SMESs powered</span>", 1)
if("prisonwarp")
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!", null, null, null, null, null)
return
if(alert(usr, "Are you sure you want to do this?", "Confirmation", "Yes", "No") != "Yes")
Expand Down Expand Up @@ -3039,7 +3039,7 @@
H.loc = pick(GLOB.prisonsecuritywarp)
GLOB.prisonwarped += H
if("traitor_all")
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!")
return
if(alert(usr, "Are you sure you want to do this?", "Confirmation", "Yes", "No") != "Yes")
Expand Down Expand Up @@ -3303,7 +3303,7 @@
if("showailaws")
output_ai_laws()
if("showgm")
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!")
else if(SSticker.mode)
alert("The game mode is [SSticker.mode.name]")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/cinematic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set name = "cinematic"
set desc = "Shows a cinematic." // Intended for testing but I thought it might be nice for events on the rare occasion Feel free to comment it out if it's not wanted.
set hidden = 1
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PREGAME)
return

if(!check_rights(R_MAINTAINER))
Expand Down
14 changes: 7 additions & 7 deletions code/modules/admin/verbs/debug.dm
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_SPAWN))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("Wait until the game starts")
return
if(ishuman(M))
Expand All @@ -266,7 +266,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_SPAWN))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("Wait until the game starts")
return

Expand Down Expand Up @@ -326,7 +326,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_SPAWN))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("Wait until the game starts")
return
if(ishuman(M))
Expand All @@ -346,7 +346,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_SPAWN))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("Wait until the game starts")
return
if(ishuman(M))
Expand All @@ -366,7 +366,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_SPAWN))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("Wait until the game starts")
return
if(ishuman(M))
Expand Down Expand Up @@ -419,7 +419,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_EVENT))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("Wait until the game starts")
return
if(ishuman(M))
Expand Down Expand Up @@ -859,7 +859,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_SPAWN))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("Wait until the game starts")
return
if(ishuman(M))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/gimmick_team.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
set desc = "Spawns a group of players in the specified outfit."
if(!check_rights(R_EVENT))
return
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!")
return
if(alert("Do you want to spawn a Gimmick Team at YOUR CURRENT LOCATION?", null,"Yes","No")=="No")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/infiltratorteam_syndicate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GLOBAL_VAR_INIT(sent_syndicate_infiltration_team, 0)
if(!check_rights(R_ADMIN))
to_chat(src, "Only administrators may use this command.")
return
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!")
return
if(alert("Do you want to send in the Syndicate Infiltration Team?", null,"Yes","No")=="No")
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/verbs/onlyone.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/client/proc/only_one()
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!")
return

Expand Down Expand Up @@ -61,7 +61,7 @@
SEND_SOUND(M, music)

/client/proc/only_me()
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!")
return

Expand Down
7 changes: 4 additions & 3 deletions code/modules/admin/verbs/randomverbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,8 @@ Traitors and the like can also be revived with the previous role mostly intact.
set category = "Admin"
set name = "Toggle Deny Shuttle"

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!")
return

if(!check_rights(R_ADMIN))
Expand Down Expand Up @@ -1134,7 +1135,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(!input)
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PREGAME)
return

SSticker.selected_tip = input
Expand All @@ -1159,7 +1160,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
holder.modify_goals()

/datum/admins/proc/modify_goals()
if(!SSticker || !SSticker.mode)
if(SSticker.current_state < GAME_STATE_PLAYING)
to_chat(usr, "<span class='warning'>This verb can only be used if the round has started.</span>")
return

Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/striketeam_syndicate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GLOBAL_VAR_INIT(sent_syndicate_strike_team, 0)
if(!src.holder)
to_chat(src, "Only administrators may use this command.")
return
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
alert("The game hasn't started yet!")
return
if(GLOB.sent_syndicate_strike_team == 1)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/_common/antag_team.dm
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ GLOBAL_LIST_EMPTY(antagonist_teams)
* Opens a window which lists the teams for the round.
*/
/datum/admins/proc/check_teams()
if(!SSticker.HasRoundStarted())
if(SSticker.current_state < GAME_STATE_PLAYING)
to_chat(usr, "<span class='warning'>The game hasn't started yet!</span>")
return

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/camera/cameranet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ GLOBAL_DATUM_INIT(cameranet, /datum/cameranet, new())

/// Updates the chunks that the turf is located in. Use this when obstacles are destroyed or when doors open.
/datum/cameranet/proc/update_visibility(atom/A, opacity_check = 1)
if(!SSticker || (opacity_check && !A.opacity))
if(SSticker.current_state < GAME_STATE_PREGAME || (opacity_check && !A.opacity))
return
major_chunk_change(update = A)

Expand All @@ -110,7 +110,7 @@ GLOBAL_DATUM_INIT(cameranet, /datum/cameranet, new())
return
if(add && remove)
CRASH("Adding and removing a camera to the cameranet simultaneously is not implemented")

var/atom/c = remove
if(!c)
c = add
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@
return FALSE

/mob/living/update_gravity(has_gravity)
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PREGAME)
return
if(has_gravity)
clear_alert("weightless")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
return G

/mob/living/attack_slime(mob/living/simple_animal/slime/M)
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
to_chat(M, "You cannot attack people before the game has started.")
return

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/ai/ai_defense.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/mob/living/silicon/ai/attack_alien(mob/living/carbon/alien/humanoid/M)
if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
to_chat(M, "You cannot attack people before the game has started.")
return
..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
to_chat(usr, "<span class='warning'>You are banned from playing drones, and cannot spawn as one.</span>")
return

if(!SSticker || SSticker.current_state < GAME_STATE_PLAYING)
if(SSticker.current_state < GAME_STATE_PLAYING)
to_chat(src, "<span class='warning'>You can't join as a drone before the game starts!</span>")
return

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
to_chat(usr, "<span class='warning'>You are banned from playing as sentient animals.</span>")
return

if(!SSticker || SSticker.current_state < 3)
if(SSticker.current_state < GAME_STATE_PLAYING)
to_chat(src, "<span class='warning'>You can't respawn as an NPC before the game starts!</span>")
return

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
real_name = "Random Character Slot"
var/output = "<center><p><a href='byond://?src=[UID()];show_preferences=1'>Setup Character</A><br /><i>[real_name]</i></p>"

if(!SSticker || SSticker.current_state <= GAME_STATE_PREGAME)
if(SSticker.current_state <= GAME_STATE_PREGAME)
if(!ready)
output += "<p><a href='byond://?src=[UID()];ready=1'>Declare Ready</A></p>"
else
Expand All @@ -70,7 +70,7 @@
output += "<p><a href='byond://?src=[UID()];skip_antag=2'>Global Antag Candidacy</A>"
output += "<br /><small>You are <b>[client.skip_antag ? "ineligible" : "eligible"]</b> for all antag roles.</small></p>"

if(!SSticker || SSticker.current_state == GAME_STATE_STARTUP)
if(SSticker.current_state == GAME_STATE_STARTUP)
output += "<p>Observe (Please wait...)</p>"
else
output += "<p><a href='byond://?src=[UID()];observe=1'>Observe</A></p>"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/response_team/ert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GLOBAL_LIST_EMPTY(ert_request_messages)
if(!check_rights(R_EVENT))
return

if(!SSticker)
if(SSticker.current_state < GAME_STATE_PLAYING)
to_chat(usr, "<span class='warning'>The game hasn't started yet!</span>")
return

Expand Down