diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm
index cd13510366..f3a8543e52 100644
--- a/code/__DEFINES/preferences.dm
+++ b/code/__DEFINES/preferences.dm
@@ -16,6 +16,12 @@
#define DISABLE_ARRIVALRATTLE (1<<13)
#define COMBOHUD_LIGHTING (1<<14)
+#define DEADMIN_ALWAYS (1<<0)
+#define DEADMIN_ANTAGONIST (1<<1)
+#define DEADMIN_POSITION_HEAD (1<<2)
+#define DEADMIN_POSITION_SECURITY (1<<3)
+#define DEADMIN_POSITION_SILICON (1<<4)
+
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|MEMBER_PUBLIC|INTENT_STYLE|MIDROUND_ANTAG|SOUND_INSTRUMENTS|SOUND_SHIP_AMBIENCE|SOUND_PRAYERS|SOUND_ANNOUNCEMENTS)
//Chat toggles
diff --git a/code/controllers/configuration/entries/admin.dm b/code/controllers/configuration/entries/admin.dm
index 1f9b5d460f..60919e10a9 100644
--- a/code/controllers/configuration/entries/admin.dm
+++ b/code/controllers/configuration/entries/admin.dm
@@ -64,3 +64,18 @@
/datum/config_entry/flag/automute_on //enables automuting/spam prevention
/datum/config_entry/flag/debug_admin_hrefs
+
+/datum/config_entry/flag/auto_deadmin_players
+ protection = CONFIG_ENTRY_LOCKED
+
+/datum/config_entry/flag/auto_deadmin_antagonists
+ protection = CONFIG_ENTRY_LOCKED
+
+/datum/config_entry/flag/auto_deadmin_heads
+ protection = CONFIG_ENTRY_LOCKED
+
+/datum/config_entry/flag/auto_deadmin_silicons
+ protection = CONFIG_ENTRY_LOCKED
+
+/datum/config_entry/flag/auto_deadmin_security
+ protection = CONFIG_ENTRY_LOCKED
diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm
index 797ad92dd1..f8094553fa 100644
--- a/code/controllers/subsystem/job.dm
+++ b/code/controllers/subsystem/job.dm
@@ -466,11 +466,11 @@ SUBSYSTEM_DEF(job)
SSpersistence.antag_rep_change[M.client.ckey] += job.GetAntagRep()
-/* if(M.client.holder)
+ if(M.client.holder)
if(CONFIG_GET(flag/auto_deadmin_players) || (M.client.prefs?.toggles & DEADMIN_ALWAYS))
M.client.holder.auto_deadmin()
else
- handle_auto_deadmin_roles(M.client, rank) */
+ handle_auto_deadmin_roles(M.client, rank)
to_chat(M, "You are the [rank].")
if(job)
@@ -517,19 +517,19 @@ SUBSYSTEM_DEF(job)
binder.decks = N.client.prefs.tcg_decks
return H
-/*
+
/datum/controller/subsystem/job/proc/handle_auto_deadmin_roles(client/C, rank)
if(!C?.holder)
return TRUE
var/datum/job/job = GetJob(rank)
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) || (C.prefs?.deadmin & 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) || (C.prefs?.deadmin & 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?.deadmin & DEADMIN_POSITION_SILICON))) //in the event there's ever psuedo-silicon roles added, ie synths.
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.
- return C.holder.auto_deadmin()*/
/datum/controller/subsystem/job/proc/setup_officer_positions()
var/datum/job/J = SSjob.GetJob("Security Officer")
diff --git a/code/modules/antagonists/_common/antag_datum.dm b/code/modules/antagonists/_common/antag_datum.dm
index f232142902..b2f983ecd2 100644
--- a/code/modules/antagonists/_common/antag_datum.dm
+++ b/code/modules/antagonists/_common/antag_datum.dm
@@ -113,6 +113,8 @@ GLOBAL_LIST_EMPTY(antagonists)
remove_blacklisted_quirks()
if(is_banned(owner.current) && replace_banned)
replace_banned_player()
+ else if(owner.current.client?.holder && (CONFIG_GET(flag/auto_deadmin_antagonists) || owner.current.client.prefs?.deadmin & DEADMIN_ANTAGONIST))
+ owner.current.client.holder.auto_deadmin()
if(skill_modifiers)
for(var/A in skill_modifiers)
ADD_SINGLETON_SKILL_MODIFIER(owner, A, type)
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index cb262e57f3..46cf3f0e48 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -83,6 +83,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/tgui_lock = TRUE
var/windowflashing = TRUE
var/toggles = TOGGLES_DEFAULT
+ /// A separate variable for deadmin toggles, only deals with those.
+ var/deadmin = NONE
var/db_flags
var/chat_toggles = TOGGLES_DEFAULT_CHAT
var/ghost_form = "ghost"
@@ -824,6 +826,35 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "Announce Login: [(toggles & ANNOUNCE_LOGIN)?"Enabled":"Disabled"]
"
dat += "
"
dat += "Combo HUD Lighting: [(toggles & COMBOHUD_LIGHTING)?"Full-bright":"No Change"]
"
+ dat += "
"
+
+ //deadmin
+ dat += "
Deadmin While Playing
"
+ if(CONFIG_GET(flag/auto_deadmin_players))
+ dat += "Always Deadmin: FORCED
"
+ else
+ dat += "Always Deadmin: [(deadmin & DEADMIN_ALWAYS)?"Enabled":"Disabled"]
"
+ if(!(deadmin & DEADMIN_ALWAYS))
+ dat += "
"
+ if(!CONFIG_GET(flag/auto_deadmin_antagonists))
+ dat += "As Antag: [(deadmin & DEADMIN_ANTAGONIST)?"Deadmin":"Keep Admin"]
"
+ else
+ dat += "As Antag: FORCED
"
+
+ if(!CONFIG_GET(flag/auto_deadmin_heads))
+ dat += "As Command: [(deadmin & DEADMIN_POSITION_HEAD)?"Deadmin":"Keep Admin"]
"
+ else
+ dat += "As Command: FORCED
"
+
+ if(!CONFIG_GET(flag/auto_deadmin_security))
+ dat += "As Security: [(deadmin & DEADMIN_POSITION_SECURITY)?"Deadmin":"Keep Admin"]
"
+ else
+ dat += "As Security: FORCED
"
+
+ if(!CONFIG_GET(flag/auto_deadmin_silicons))
+ dat += "As Silicon: [(deadmin & DEADMIN_POSITION_SILICON)?"Deadmin":"Keep Admin"]
"
+ else
+ dat += "As Silicon: FORCED
"
dat += ""
dat +=""
@@ -2752,6 +2783,19 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if("combohud_lighting")
toggles ^= COMBOHUD_LIGHTING
+ // Deadmin preferences
+ if("toggle_deadmin_always")
+ deadmin ^= DEADMIN_ALWAYS
+ if("toggle_deadmin_antag")
+ deadmin ^= DEADMIN_ANTAGONIST
+ if("toggle_deadmin_head")
+ deadmin ^= DEADMIN_POSITION_HEAD
+ if("toggle_deadmin_security")
+ deadmin ^= DEADMIN_POSITION_SECURITY
+ if("toggle_deadmin_silicon")
+ deadmin ^= DEADMIN_POSITION_SILICON
+ //
+
if("be_special")
var/be_special_type = href_list["be_special_type"]
if(be_special_type in be_special)
diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm
index 510ac9ff28..70a5fe0f1c 100644
--- a/code/modules/client/preferences_savefile.dm
+++ b/code/modules/client/preferences_savefile.dm
@@ -396,6 +396,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["default_slot"] >> default_slot
S["chat_toggles"] >> chat_toggles
S["toggles"] >> toggles
+ S["deadmin"] >> deadmin
S["ghost_form"] >> ghost_form
S["ghost_orbit"] >> ghost_orbit
S["ghost_accs"] >> ghost_accs
@@ -467,6 +468,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
windowflashing = sanitize_integer(windowflashing, 0, 1, initial(windowflashing))
default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot))
toggles = sanitize_integer(toggles, 0, 16777215, initial(toggles))
+ deadmin = sanitize_integer(deadmin, 0, 16777215, initial(deadmin))
clientfps = sanitize_integer(clientfps, 0, 1000, 0)
parallax = sanitize_integer(parallax, PARALLAX_INSANE, PARALLAX_DISABLE, null)
ambientocclusion = sanitize_integer(ambientocclusion, 0, 1, initial(ambientocclusion))
@@ -573,6 +575,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["be_special"], be_special)
WRITE_FILE(S["default_slot"], default_slot)
WRITE_FILE(S["toggles"], toggles)
+ WRITE_FILE(S["deadmin"], deadmin)
WRITE_FILE(S["chat_toggles"], chat_toggles)
WRITE_FILE(S["ghost_form"], ghost_form)
WRITE_FILE(S["ghost_orbit"], ghost_orbit)
diff --git a/code/modules/jobs/job_types/_job.dm b/code/modules/jobs/job_types/_job.dm
index 1f5becace8..dd90128b1a 100644
--- a/code/modules/jobs/job_types/_job.dm
+++ b/code/modules/jobs/job_types/_job.dm
@@ -15,7 +15,7 @@
//Bitflags for the job
var/flag = NONE //Deprecated
var/department_flag = NONE //Deprecated
-// var/auto_deadmin_role_flags = NONE
+ var/auto_deadmin_role_flags = NONE
//Players will be allowed to spawn in as jobs that are set to "Station"
var/faction = "None"
diff --git a/code/modules/jobs/job_types/ai.dm b/code/modules/jobs/job_types/ai.dm
index 38625cfd9c..171ea047e6 100644
--- a/code/modules/jobs/job_types/ai.dm
+++ b/code/modules/jobs/job_types/ai.dm
@@ -1,7 +1,7 @@
/datum/job/ai
title = "AI"
flag = AI_JF
-// auto_deadmin_role_flags = DEADMIN_POSITION_SILICON
+ auto_deadmin_role_flags = DEADMIN_POSITION_SILICON
department_flag = ENGSEC
faction = "Station"
total_positions = 1
diff --git a/code/modules/jobs/job_types/captain.dm b/code/modules/jobs/job_types/captain.dm
index 4806bf5546..c3765260cc 100644
--- a/code/modules/jobs/job_types/captain.dm
+++ b/code/modules/jobs/job_types/captain.dm
@@ -1,7 +1,7 @@
/datum/job/captain
title = "Captain"
flag = CAPTAIN
-// auto_deadmin_role_flags = DEADMIN_POSITION_HEAD|DEADMIN_POSITION_SECURITY //:eyes:
+ auto_deadmin_role_flags = DEADMIN_POSITION_HEAD|DEADMIN_POSITION_SECURITY //:eyes:
department_head = list("CentCom")
department_flag = ENGSEC
faction = "Station"
diff --git a/code/modules/jobs/job_types/chief_engineer.dm b/code/modules/jobs/job_types/chief_engineer.dm
index 804952dbb2..a08360b286 100644
--- a/code/modules/jobs/job_types/chief_engineer.dm
+++ b/code/modules/jobs/job_types/chief_engineer.dm
@@ -1,7 +1,7 @@
/datum/job/chief_engineer
title = "Chief Engineer"
flag = CHIEF
-// auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
+ auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
department_head = list("Captain")
department_flag = ENGSEC
head_announce = list(RADIO_CHANNEL_ENGINEERING)
diff --git a/code/modules/jobs/job_types/chief_medical_officer.dm b/code/modules/jobs/job_types/chief_medical_officer.dm
index bb5fc68809..89b06f6802 100644
--- a/code/modules/jobs/job_types/chief_medical_officer.dm
+++ b/code/modules/jobs/job_types/chief_medical_officer.dm
@@ -3,7 +3,7 @@
flag = CMO_JF
department_head = list("Captain")
department_flag = MEDSCI
-// auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
+ auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
head_announce = list(RADIO_CHANNEL_MEDICAL)
faction = "Station"
total_positions = 1
diff --git a/code/modules/jobs/job_types/cyborg.dm b/code/modules/jobs/job_types/cyborg.dm
index 761882894f..17a7cfad74 100644
--- a/code/modules/jobs/job_types/cyborg.dm
+++ b/code/modules/jobs/job_types/cyborg.dm
@@ -1,7 +1,7 @@
/datum/job/cyborg
title = "Cyborg"
flag = CYBORG
-// auto_deadmin_role_flags = DEADMIN_POSITION_SILICON
+ auto_deadmin_role_flags = DEADMIN_POSITION_SILICON
department_flag = ENGSEC
faction = "Station"
total_positions = 0
diff --git a/code/modules/jobs/job_types/detective.dm b/code/modules/jobs/job_types/detective.dm
index c704326879..b56ebed191 100644
--- a/code/modules/jobs/job_types/detective.dm
+++ b/code/modules/jobs/job_types/detective.dm
@@ -1,7 +1,7 @@
/datum/job/detective
title = "Detective"
flag = DETECTIVE
-// auto_deadmin_role_flags = DEADMIN_POSITION_SECURITY
+ auto_deadmin_role_flags = DEADMIN_POSITION_SECURITY
department_head = list("Head of Security")
department_flag = ENGSEC
faction = "Station"
diff --git a/code/modules/jobs/job_types/head_of_personnel.dm b/code/modules/jobs/job_types/head_of_personnel.dm
index 07c1a12ced..ce05f199a2 100644
--- a/code/modules/jobs/job_types/head_of_personnel.dm
+++ b/code/modules/jobs/job_types/head_of_personnel.dm
@@ -1,7 +1,7 @@
/datum/job/hop
title = "Head of Personnel"
flag = HOP
-// auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
+ auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
department_head = list("Captain")
department_flag = CIVILIAN
head_announce = list(RADIO_CHANNEL_SERVICE)
diff --git a/code/modules/jobs/job_types/head_of_security.dm b/code/modules/jobs/job_types/head_of_security.dm
index d612b6a56d..57f248b760 100644
--- a/code/modules/jobs/job_types/head_of_security.dm
+++ b/code/modules/jobs/job_types/head_of_security.dm
@@ -1,7 +1,7 @@
/datum/job/hos
title = "Head of Security"
flag = HOS
-// auto_deadmin_role_flags = DEADMIN_POSITION_HEAD|DEADMIN_POSITION_SECURITY
+ auto_deadmin_role_flags = DEADMIN_POSITION_HEAD|DEADMIN_POSITION_SECURITY
department_head = list("Captain")
department_flag = ENGSEC
head_announce = list(RADIO_CHANNEL_SECURITY)
diff --git a/code/modules/jobs/job_types/quartermaster.dm b/code/modules/jobs/job_types/quartermaster.dm
index ff811d30d1..98343417c8 100644
--- a/code/modules/jobs/job_types/quartermaster.dm
+++ b/code/modules/jobs/job_types/quartermaster.dm
@@ -4,7 +4,7 @@
department_head = list("Captain")
department_flag = CIVILIAN
head_announce = list(RADIO_CHANNEL_SUPPLY)
-// auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
+ auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
faction = "Station"
total_positions = 1
spawn_positions = 1
diff --git a/code/modules/jobs/job_types/research_director.dm b/code/modules/jobs/job_types/research_director.dm
index 6c2cb94d13..f0a2a8e014 100644
--- a/code/modules/jobs/job_types/research_director.dm
+++ b/code/modules/jobs/job_types/research_director.dm
@@ -1,7 +1,7 @@
/datum/job/rd
title = "Research Director"
flag = RD_JF
-// auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
+ auto_deadmin_role_flags = DEADMIN_POSITION_HEAD
department_head = list("Captain")
department_flag = MEDSCI
head_announce = list(RADIO_CHANNEL_SCIENCE)
diff --git a/code/modules/jobs/job_types/security_officer.dm b/code/modules/jobs/job_types/security_officer.dm
index 3462fb96c9..0d118c9967 100644
--- a/code/modules/jobs/job_types/security_officer.dm
+++ b/code/modules/jobs/job_types/security_officer.dm
@@ -1,7 +1,7 @@
/datum/job/officer
title = "Security Officer"
flag = OFFICER
-// auto_deadmin_role_flags = DEADMIN_POSITION_SECURITY
+ auto_deadmin_role_flags = DEADMIN_POSITION_SECURITY
department_head = list("Head of Security")
department_flag = ENGSEC
faction = "Station"
diff --git a/code/modules/jobs/job_types/warden.dm b/code/modules/jobs/job_types/warden.dm
index 074ccac09f..26decc294f 100644
--- a/code/modules/jobs/job_types/warden.dm
+++ b/code/modules/jobs/job_types/warden.dm
@@ -1,7 +1,7 @@
/datum/job/warden
title = "Warden"
flag = WARDEN
-// auto_deadmin_role_flags = DEADMIN_POSITION_SECURITY
+ auto_deadmin_role_flags = DEADMIN_POSITION_SECURITY
department_head = list("Head of Security")
department_flag = ENGSEC
faction = "Station"
diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm
index ce767ae00d..a05b3483e8 100644
--- a/code/modules/mob/dead/dead.dm
+++ b/code/modules/mob/dead/dead.dm
@@ -121,6 +121,9 @@ INITIALIZE_IMMEDIATE(/mob/dead)
if (isturf(T))
update_z(T.z)
+/mob/dead/auto_deadmin_on_login()
+ return
+
/mob/dead/Logout()
update_z(null)
return ..()
diff --git a/code/modules/mob/living/silicon/login.dm b/code/modules/mob/living/silicon/login.dm
index 7b1854b940..ddc47465a4 100644
--- a/code/modules/mob/living/silicon/login.dm
+++ b/code/modules/mob/living/silicon/login.dm
@@ -11,3 +11,10 @@
if(G)
mind.remove_antag_datum(G)
..()
+
+/mob/living/silicon/auto_deadmin_on_login()
+ if(!client?.holder)
+ return TRUE
+ if(CONFIG_GET(flag/auto_deadmin_silicons) || (client.prefs?.deadmin & DEADMIN_POSITION_SILICON))
+ return client.holder.auto_deadmin()
+ return ..()
diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
index ecd5db3ccf..3bc0c965fd 100644
--- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
+++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
@@ -140,6 +140,12 @@
if(!picked)
pickVisualAppearence()
+/mob/living/simple_animal/drone/auto_deadmin_on_login()
+ if(!client?.holder)
+ return TRUE
+ if(CONFIG_GET(flag/auto_deadmin_silicons) || (client.prefs?.deadmin & DEADMIN_POSITION_SILICON))
+ return client.holder.auto_deadmin()
+ return ..()
/mob/living/simple_animal/drone/death(gibbed)
..(gibbed)
diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm
index 8f74d3b45f..391bd8b10e 100644
--- a/code/modules/mob/login.dm
+++ b/code/modules/mob/login.dm
@@ -48,6 +48,7 @@
for(var/foo in client.player_details.post_login_callbacks)
var/datum/callback/CB = foo
CB.Invoke()
+ auto_deadmin_on_login()
mind?.hide_ckey = client?.prefs?.hide_ckey
@@ -56,3 +57,13 @@
if(has_field_of_vision && CONFIG_GET(flag/use_field_of_vision))
LoadComponent(/datum/component/field_of_vision, field_of_vision_type)
+
+/mob/proc/auto_deadmin_on_login() //return true if they're not an admin at the end.
+ if(!client?.holder)
+ return TRUE
+ if(CONFIG_GET(flag/auto_deadmin_players) || (client.prefs?.deadmin & DEADMIN_ALWAYS))
+ return client.holder.auto_deadmin()
+ if(mind.has_antag_datum(/datum/antagonist) && (CONFIG_GET(flag/auto_deadmin_antagonists) || client.prefs?.deadmin & DEADMIN_ANTAGONIST))
+ return client.holder.auto_deadmin()
+ if(job)
+ return SSjob.handle_auto_deadmin_roles(client, job)
diff --git a/config/entries/admin.txt b/config/entries/admin.txt
index e583790b82..d7932bbe13 100644
--- a/config/entries/admin.txt
+++ b/config/entries/admin.txt
@@ -81,3 +81,17 @@ GUEST_BAN
## Allow admin hrefs that don't use the new token system, will eventually be removed
DEBUG_ADMIN_HREFS
+
+##
+## Those deadmin configs will lock admins this way, so it's not really recommended unless really needed
+##
+## Uncomment to automatically deadmin players when the game starts.
+#AUTO_DEADMIN_PLAYERS
+
+## Uncomment to automatically deadmin antagonists when they gain the role.
+#AUTO_DEADMIN_ANTAGONISTS
+
+## Uncomment to automatically deadmin specific role sets when a player joins the game.
+#AUTO_DEADMIN_HEADS
+#AUTO_DEADMIN_SECURITY
+#AUTO_DEADMIN_SILICONS
|