From fcf376c5e689aef066a9812f7fc4a58f85313724 Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Sat, 16 Jan 2021 00:50:01 +0100
Subject: [PATCH] [MIRROR] Allow dynamic to be configured when used as the
forced secret mode (#2721)
* Allow dynamic to be configured when used as the forced secret mode (#56122)
Allow dynamic to be configured (roundstart rulesets) when used as the forced secret mode
* Allow dynamic to be configured when used as the forced secret mode
Co-authored-by: Mothblocks <35135081+Jared-Fogle@users.noreply.github.com>
---
code/controllers/subsystem/ticker.dm | 4 +++
.../gamemodes/dynamic/dynamic_rulesets.dm | 2 +-
code/modules/admin/admin.dm | 2 +-
code/modules/admin/topic.dm | 26 +++++++++----------
4 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm
index 3fe0a7f3080..aa22504966b 100755
--- a/code/controllers/subsystem/ticker.dm
+++ b/code/controllers/subsystem/ticker.dm
@@ -625,6 +625,10 @@ SUBSYSTEM_DEF(ticker)
fdel(F)
WRITE_FILE(F, the_mode)
+/// Returns if either the master mode or the forced secret ruleset matches the mode name.
+/datum/controller/subsystem/ticker/proc/is_mode(mode_name)
+ return GLOB.master_mode == mode_name || GLOB.secret_force_mode == mode_name
+
/datum/controller/subsystem/ticker/proc/SetRoundEndSound(the_sound)
set waitfor = FALSE
round_end_sound_sent = FALSE
diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets.dm b/code/game/gamemodes/dynamic/dynamic_rulesets.dm
index df025eba7d6..665ee273a42 100644
--- a/code/game/gamemodes/dynamic/dynamic_rulesets.dm
+++ b/code/game/gamemodes/dynamic/dynamic_rulesets.dm
@@ -82,7 +82,7 @@
..()
if (istype(SSticker.mode, /datum/game_mode/dynamic))
mode = SSticker.mode
- else if (GLOB.master_mode != "dynamic") // This is here to make roundstart forced ruleset function.
+ else if (!SSticker.is_mode("dynamic")) // This is here to make roundstart forced ruleset function.
qdel(src)
/datum/dynamic_ruleset/roundstart // One or more of those drafted at roundstart
diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm
index 1b5982229d5..86e57987130 100644
--- a/code/modules/admin/admin.dm
+++ b/code/modules/admin/admin.dm
@@ -422,7 +422,7 @@
"}
if(GLOB.master_mode == "secret")
dat += "(Force Secret Mode)
"
- if(GLOB.master_mode == "dynamic")
+ if(SSticker.is_mode("dynamic"))
if(SSticker.current_state <= GAME_STATE_PREGAME)
dat += "(Force Roundstart Rulesets)
"
if (GLOB.dynamic_forced_roundstart_ruleset.len > 0)
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index c322302e8de..1323c27be83 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -631,7 +631,7 @@
return
if(SSticker?.mode)
return alert(usr, "The game has already started.", null, null, null, null)
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode.", null, null, null, null)
var/roundstart_rules = list()
for (var/rule in subtypesof(/datum/dynamic_ruleset/roundstart))
@@ -667,7 +667,7 @@
if(SSticker?.mode)
return alert(usr, "The game has already started.", null, null, null, null)
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
dynamic_mode_options(usr)
@@ -677,7 +677,7 @@
return
if(SSticker?.mode)
return alert(usr, "The game has already started.", null, null, null, null)
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
var/new_centre = input(usr,"Change the centre of the dynamic mode threat curve. A negative value will give a more peaceful round ; a positive value, a round with higher threat. Any number between -5 and +5 is allowed.", "Change curve centre", null) as num
@@ -694,7 +694,7 @@
return
if(SSticker?.mode)
return alert(usr, "The game has already started.", null, null, null, null)
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
var/new_width = input(usr,"Change the width of the dynamic mode threat curve. A higher value will favour extreme rounds ; a lower value, a round closer to the average. Any Number between 0.5 and 4 are allowed.", "Change curve width", null) as num
@@ -711,7 +711,7 @@
return
if(SSticker?.mode)
return alert(usr, "The game has already started.", null, null, null, null)
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
var/new_min = input(usr,"Change the minimum delay of latejoin injection in minutes.", "Change latejoin injection delay minimum", null) as num
if(new_min <= 0)
@@ -729,7 +729,7 @@
return
if(SSticker?.mode)
return alert(usr, "The game has already started.", null, null, null, null)
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
var/new_max = input(usr,"Change the maximum delay of latejoin injection in minutes.", "Change latejoin injection delay maximum", null) as num
if(new_max <= 0)
@@ -747,7 +747,7 @@
return
if(SSticker?.mode)
return alert(usr, "The game has already started.", null, null, null, null)
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
var/new_min = input(usr,"Change the minimum delay of midround injection in minutes.", "Change midround injection delay minimum", null) as num
if(new_min <= 0)
@@ -765,7 +765,7 @@
return
if(SSticker?.mode)
return alert(usr, "The game has already started.", null, null, null, null)
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
var/new_max = input(usr,"Change the maximum delay of midround injection in minutes.", "Change midround injection delay maximum", null) as num
if(new_max <= 0)
@@ -782,7 +782,7 @@
if(!check_rights(R_ADMIN))
return
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
GLOB.dynamic_forced_extended = !GLOB.dynamic_forced_extended
@@ -794,7 +794,7 @@
if(!check_rights(R_ADMIN))
return
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
GLOB.dynamic_no_stacking = !GLOB.dynamic_no_stacking
@@ -806,7 +806,7 @@
if(!check_rights(R_ADMIN))
return
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
GLOB.dynamic_classic_secret = !GLOB.dynamic_classic_secret
@@ -818,7 +818,7 @@
if(!check_rights(R_ADMIN))
return
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
GLOB.dynamic_stacking_limit = input(usr,"Change the threat limit at which round-endings rulesets will start to stack.", "Change stacking limit", null) as num
@@ -833,7 +833,7 @@
if(SSticker?.mode)
return alert(usr, "The game has already started.", null, null, null, null)
- if(GLOB.master_mode != "dynamic")
+ if(!SSticker.is_mode("dynamic"))
return alert(usr, "The game mode has to be dynamic mode!", null, null, null, null)
var/new_value = input(usr, "Enter the forced threat level for dynamic mode.", "Forced threat level") as num