From ad3a5bc6a5d5a0e9e295a4dfdd472fc5c3da3df0 Mon Sep 17 00:00:00 2001
From: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com>
Date: Sun, 19 Apr 2020 05:42:41 -0400
Subject: [PATCH] Add auto-deadmin timegate option + pref for admins to ignore
cult ghost summon (#50460)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
About The Pull Request
1 config change and 1 preference change:
Adds a config option AUTO_DEADMIN_TIMEGATE that, when defined, only enforces config force-deadmins for all roles/sec/command/silicon/antag for the first X seconds in the round. After this time expires, the game will defer to the individual's deadmin settings.
Adds a preference for admins to ignore being summoned by cult ghosts, starts disabled by default. Nice for when you're sitting around observing a cultist and don't want to be bugged by them suddenly summoning you!
I'm not 100% with dealing with prefs and configs but stock settings preserve previous functionality and must be manually enabled to have effect. Please look it over and offer advice if changes are needed!
Why It's Good For The Game
I don't like the auto-deadmin config option being on in the first place since it's annoying to get deadmin'd when I'm testing antag stuff, but I spoke to @Twaticus who indicated they like having it for roundstart, but agreed it was annoying when trying to test stuff later in the round. This is a simple compromise that lets config-controllers still force people to deadmin at the starts of shifts where most of the proscribed roles are assigned, while not bothering other admins who make themselves a blob at the thunderdome an hour in to test something.
As for the cult ghosts, I hate suddenly getting summoned as a cult ghost while I'm adminning, but other people like being able to be summoned while currently admin'd, so pref time.
Changelog
🆑 Ryll/Shaps
config: Added AUTO_DEADMIN_TIMEGATE which allows config force deadmin settings to only apply for the first X seconds in a round. Starts disabled
admin: New preference to ignore being summoned as a cult ghost while admin'd, starts disabled
/🆑
---
code/__DEFINES/preferences.dm | 1 +
.../configuration/entries/general.dm | 4 +++
code/controllers/subsystem/job.dm | 13 ++++++---
code/modules/antagonists/cult/runes.dm | 2 +-
code/modules/client/preferences.dm | 27 ++++++++++++-------
5 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm
index 2ecafc1b41a..91b849bd50e 100644
--- a/code/__DEFINES/preferences.dm
+++ b/code/__DEFINES/preferences.dm
@@ -21,6 +21,7 @@
#define DEADMIN_POSITION_SECURITY (1<<18)
#define DEADMIN_POSITION_SILICON (1<<19)
#define SOUND_ENDOFROUND (1<<20)
+#define ADMIN_IGNORE_CULT_GHOST (1<<21)
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_ENDOFROUND|MEMBER_PUBLIC|INTENT_STYLE|MIDROUND_ANTAG|SOUND_INSTRUMENTS|SOUND_SHIP_AMBIENCE|SOUND_PRAYERS|SOUND_ANNOUNCEMENTS)
diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm
index 6eb1171e7d1..fca4f28d12f 100644
--- a/code/controllers/configuration/entries/general.dm
+++ b/code/controllers/configuration/entries/general.dm
@@ -8,6 +8,10 @@
/datum/config_entry/flag/auto_deadmin_players
protection = CONFIG_ENTRY_LOCKED
+/datum/config_entry/number/auto_deadmin_timegate
+ config_entry_value = null
+ protection = CONFIG_ENTRY_LOCKED
+
/datum/config_entry/flag/auto_deadmin_antagonists
protection = CONFIG_ENTRY_LOCKED
diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm
index a52a33ad353..e92968f42ac 100644
--- a/code/controllers/subsystem/job.dm
+++ b/code/controllers/subsystem/job.dm
@@ -484,13 +484,20 @@ SUBSYSTEM_DEF(job)
if(!C?.holder)
return TRUE
var/datum/job/job = GetJob(rank)
+
+ var/timegate_expired = FALSE
+ // allow only forcing deadminning in the first X seconds of the round if auto_deadmin_timegate is set in config
+ var/timegate = CONFIG_GET(number/auto_deadmin_timegate)
+ if(timegate && (world.time - SSticker.round_start_time > timegate))
+ timegate_expired = TRUE
+
if(!job)
return
- if((job.auto_deadmin_role_flags & DEADMIN_POSITION_HEAD) && (CONFIG_GET(flag/auto_deadmin_heads) || (C.prefs?.toggles & DEADMIN_POSITION_HEAD)))
+ if((job.auto_deadmin_role_flags & DEADMIN_POSITION_HEAD) && ((CONFIG_GET(flag/auto_deadmin_heads) && !timegate_expired) || (C.prefs?.toggles & DEADMIN_POSITION_HEAD)))
return C.holder.auto_deadmin()
- else if((job.auto_deadmin_role_flags & DEADMIN_POSITION_SECURITY) && (CONFIG_GET(flag/auto_deadmin_security) || (C.prefs?.toggles & DEADMIN_POSITION_SECURITY)))
+ else if((job.auto_deadmin_role_flags & DEADMIN_POSITION_SECURITY) && ((CONFIG_GET(flag/auto_deadmin_security) && !timegate_expired) || (C.prefs?.toggles & DEADMIN_POSITION_SECURITY)))
return C.holder.auto_deadmin()
- else if((job.auto_deadmin_role_flags & DEADMIN_POSITION_SILICON) && (CONFIG_GET(flag/auto_deadmin_silicons) || (C.prefs?.toggles & DEADMIN_POSITION_SILICON))) //in the event there's ever psuedo-silicon roles added, ie synths.
+ else if((job.auto_deadmin_role_flags & DEADMIN_POSITION_SILICON) && ((CONFIG_GET(flag/auto_deadmin_silicons) && !timegate_expired) || (C.prefs?.toggles & DEADMIN_POSITION_SILICON))) //in the event there's ever psuedo-silicon roles added, ie synths.
return C.holder.auto_deadmin()
/datum/controller/subsystem/job/proc/setup_officer_positions()
diff --git a/code/modules/antagonists/cult/runes.dm b/code/modules/antagonists/cult/runes.dm
index eee48826e86..2e0f3412e70 100644
--- a/code/modules/antagonists/cult/runes.dm
+++ b/code/modules/antagonists/cult/runes.dm
@@ -843,7 +843,7 @@ structure_check() searches for nearby cultist structures required for the invoca
notify_ghosts("Manifest rune invoked in [get_area(src)].", 'sound/effects/ghost2.ogg', source = src, header = "Manifest rune")
var/list/ghosts_on_rune = list()
for(var/mob/dead/observer/O in T)
- if(O.client && !is_banned_from(O.ckey, ROLE_CULTIST) && !QDELETED(src) && !QDELETED(O))
+ if(O.client && !is_banned_from(O.ckey, ROLE_CULTIST) && !QDELETED(src) && !(IsAdminGhost(O) && (O.client.prefs.toggles & ADMIN_IGNORE_CULT_GHOST)) && !QDELETED(O))
ghosts_on_rune += O
if(!ghosts_on_rune.len)
to_chat(user, "There are no spirits near [src]!")
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 62f42ecf1fa..18768d1135c 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -659,35 +659,40 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "Hide Dead Chat: [(chat_toggles & CHAT_DEAD)?"Shown":"Hidden"]
"
dat += "Hide Radio Messages: [(chat_toggles & CHAT_RADIO)?"Shown":"Hidden"]
"
dat += "Hide Prayers: [(chat_toggles & CHAT_PRAYER)?"Shown":"Hidden"]
"
+ dat += "Ignore Being Summoned as Cult Ghost: [(toggles & ADMIN_IGNORE_CULT_GHOST)?"Don't Allow Being Summoned":"Allow Being Summoned"]
"
if(CONFIG_GET(flag/allow_admin_asaycolor))
dat += "
"
dat += "ASAY Color: Change
"
//deadmin
dat += "