diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm index 3691e3f1c4ba..4515f4126476 100644 --- a/code/__DEFINES/preferences.dm +++ b/code/__DEFINES/preferences.dm @@ -22,6 +22,7 @@ #define DEADMIN_POSITION_HEAD (1<<18) #define DEADMIN_POSITION_SECURITY (1<<19) #define DEADMIN_POSITION_SILICON (1<<20) +#define DEADMIN_POSITION_CRITICAL (1<<21) #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|SOUND_JUKEBOX) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 1e0b6ceadf45..6d8786398d9a 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -20,6 +20,11 @@ /datum/config_entry/flag/auto_deadmin_security protection = CONFIG_ENTRY_LOCKED +/datum/config_entry/flag/auto_deadmin_critical + protection = CONFIG_ENTRY_LOCKED + +/datum/config_entry/number/auto_deadmin_threshold + protection = CONFIG_ENTRY_LOCKED /datum/config_entry/string/servername // server name (the name of the game window) diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 2417b3cd9eed..668033bd7947 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -562,6 +562,8 @@ SUBSYSTEM_DEF(job) var/datum/job/job = GetJob(rank) if(!job) return + if((job.auto_deadmin_role_flags & DEADMIN_POSITION_CRITICAL) && (CONFIG_GET(flag/auto_deadmin_critical) || (C.prefs?.toggles & DEADMIN_POSITION_CRITICAL))) + return C.holder.auto_deadmin() if((job.auto_deadmin_role_flags & DEADMIN_POSITION_HEAD) && (CONFIG_GET(flag/auto_deadmin_heads) || (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))) diff --git a/code/modules/admin/permissionedit.dm b/code/modules/admin/permissionedit.dm index 8e4f0dfe96f7..ba96b0525f23 100644 --- a/code/modules/admin/permissionedit.dm +++ b/code/modules/admin/permissionedit.dm @@ -291,6 +291,10 @@ D.deactivate() //after logs so the deadmined admin can see the message. /datum/admins/proc/auto_deadmin() + if(GLOB.admins.len < CONFIG_GET(number/auto_deadmin_threshold)) + log_admin("[owner] auto-deadmin failed due to low admin count.") + to_chat(owner, span_userdanger("You have not be auto-deadminned due to lack of admins on the server, you can still deadmin manually.")) + return FALSE to_chat(owner, span_interface("You are now a normal player.")) var/old_owner = owner deactivate() diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 3010a682cd78..e749b2de64e0 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -801,6 +801,11 @@ GLOBAL_LIST_EMPTY(preferences_datums) else dat += "As Silicon: FORCED
" + if(!CONFIG_GET(flag/auto_deadmin_critical)) + dat += "As Critical Roles: [(toggles & DEADMIN_POSITION_CRITICAL)?"Deadmin":"Keep Admin"]
" + else + dat += "As Critical Roles: FORCED
" + dat += "" dat += "" // yogs start - Donor features @@ -1828,6 +1833,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) toggles ^= DEADMIN_POSITION_SECURITY if("toggle_deadmin_silicon") toggles ^= DEADMIN_POSITION_SILICON + if("toggle_deadmin_critical") + toggles ^= DEADMIN_POSITION_CRITICAL if("be_special") diff --git a/code/modules/jobs/job_types/ai.dm b/code/modules/jobs/job_types/ai.dm index f4d2d1a88f5a..27c3204449bd 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|DEADMIN_POSITION_CRITICAL 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 ed41d6e3f60f..b4fada77658b 100755 --- 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 + auto_deadmin_role_flags = DEADMIN_POSITION_HEAD|DEADMIN_POSITION_SECURITY|DEADMIN_POSITION_CRITICAL department_head = list("CentCom") department_flag = ENGSEC faction = "Station" diff --git a/code/modules/jobs/job_types/head_of_security.dm b/code/modules/jobs/job_types/head_of_security.dm index ce3922f03431..ae1265c89b35 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|DEADMIN_POSITION_CRITICAL department_head = list("Captain") department_flag = ENGSEC head_announce = list(RADIO_CHANNEL_SECURITY) 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 72e8f9524d99..a3f07fe3d687 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -142,13 +142,6 @@ 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?.toggles & DEADMIN_POSITION_SILICON)) - return client.holder.auto_deadmin() - return ..() - /mob/living/simple_animal/drone/death(gibbed) ..(gibbed) if(internal_storage) diff --git a/config/config.txt b/config/config.txt index 82f10f23585f..e2f736b11a2e 100644 --- a/config/config.txt +++ b/config/config.txt @@ -322,7 +322,10 @@ MAPROTATIONCHANCEDELTA 1 #AUTO_DEADMIN_HEADS #AUTO_DEADMIN_SECURITY #AUTO_DEADMIN_SILICONS +#AUTO_DEADMIN_CRITICAL +## The minimum nubmer of admins to allow for auto deadminning, includes the deadminning admin +AUTO_DEADMIN_THRESHOLD 4 ## CLIENT VERSION CONTROL ## This allows you to configure the minimum required client version, as well as a warning version, and message for both.