Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
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
1 change: 1 addition & 0 deletions code/__DEFINES/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions code/controllers/configuration/entries/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions code/controllers/subsystem/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
4 changes: 4 additions & 0 deletions code/modules/admin/permissionedit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 7 additions & 0 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,11 @@ GLOBAL_LIST_EMPTY(preferences_datums)
else
dat += "<b>As Silicon:</b> FORCED<br>"

if(!CONFIG_GET(flag/auto_deadmin_critical))
dat += "<b>As Critical Roles:</b> <a href = '?_src_=prefs;preference=toggle_deadmin_critical'>[(toggles & DEADMIN_POSITION_CRITICAL)?"Deadmin":"Keep Admin"]</a><br>"
else
dat += "<b>As Critical Roles:</b> FORCED<br>"

dat += "</td>"
dat += "</tr></table>"
// yogs start - Donor features
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/jobs/job_types/ai.dm
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/jobs/job_types/captain.dm
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/jobs/job_types/head_of_security.dm
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions config/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down