diff --git a/code/_onclick/hud/new_player.dm b/code/_onclick/hud/new_player.dm index 986abbb146e..34185a2542d 100644 --- a/code/_onclick/hud/new_player.dm +++ b/code/_onclick/hud/new_player.dm @@ -254,6 +254,7 @@ var/mob/dead/new_player/new_player = hud.mymob ready = !ready if(ready) + new_player.auto_deadmin_on_ready_or_latejoin() new_player.ready = PLAYER_READY_TO_PLAY base_icon_state = "ready" else @@ -316,6 +317,8 @@ to_chat(new_player, span_notice("You have been added to the queue to join the game. Your position in queue is [SSticker.queued_players.len].")) return + new_player.auto_deadmin_on_ready_or_latejoin() + if(!LAZYACCESS(params2list(params), CTRL_CLICK)) GLOB.latejoin_menu.ui_interact(new_player) else diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index e70b8e6962f..425fa39cd08 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -7,7 +7,7 @@ default = "Game Master" protection = CONFIG_ENTRY_LOCKED -/datum/config_entry/flag/auto_deadmin_players +/datum/config_entry/flag/auto_deadmin_always protection = CONFIG_ENTRY_LOCKED /datum/config_entry/number/auto_deadmin_timegate @@ -20,6 +20,9 @@ /datum/config_entry/flag/auto_deadmin_heads protection = CONFIG_ENTRY_LOCKED +/datum/config_entry/flag/auto_deadmin_on_ready_or_latejoin + protection = CONFIG_ENTRY_LOCKED + /datum/config_entry/flag/auto_deadmin_silicons protection = CONFIG_ENTRY_LOCKED diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 5b9b1b9f8b4..96659ee029e 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -600,7 +600,7 @@ SUBSYSTEM_DEF(job) job.announce_job(equipping, alt_title) // SKYRAT EDIT CHANGE - ALTERNATIVE_JOB_TITLES - ORIGINAL: job.announce_job(equipping) if(player_client?.holder) - if(CONFIG_GET(flag/auto_deadmin_players) || (player_client.prefs?.toggles & DEADMIN_ALWAYS)) + if(CONFIG_GET(flag/auto_deadmin_always) || (player_client.prefs?.toggles & DEADMIN_ALWAYS)) player_client.holder.auto_deadmin() else handle_auto_deadmin_roles(player_client, job.title) diff --git a/code/modules/admin/permissionedit.dm b/code/modules/admin/permissionedit.dm index e474fcff095..a4a4c525167 100644 --- a/code/modules/admin/permissionedit.dm +++ b/code/modules/admin/permissionedit.dm @@ -302,7 +302,7 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm /datum/admins/proc/auto_deadmin() if(owner.is_localhost()) return FALSE - if(owner.prefs.read_preference(/datum/preference/toggle/bypass_deadmin_in_centcom) && is_centcom_level(owner.mob.z)) + if(owner.prefs.read_preference(/datum/preference/toggle/bypass_deadmin_in_centcom) && is_centcom_level(owner.mob.z) && !istype(owner.mob, /mob/dead/new_player)) return FALSE to_chat(owner, span_interface("You are now a normal player."), confidential = TRUE) diff --git a/code/modules/client/preferences/admin.dm b/code/modules/client/preferences/admin.dm index 47b96abca41..5694bb36fda 100644 --- a/code/modules/client/preferences/admin.dm +++ b/code/modules/client/preferences/admin.dm @@ -73,3 +73,16 @@ return FALSE return is_admin(preferences.parent) + +/datum/preference/toggle/auto_deadmin_on_ready_or_latejoin + category = PREFERENCE_CATEGORY_GAME_PREFERENCES + savefile_key = "auto_deadmin_on_ready_or_latejoin" + savefile_identifier = PREFERENCE_PLAYER + +/datum/preference/toggle/auto_deadmin_on_ready_or_latejoin/is_accessible(datum/preferences/preferences) + if (!..(preferences)) + return FALSE + if (preferences.toggles & DEADMIN_ALWAYS) //No reason to show if they're deadminning always, because deadmin always also deadmins on ready / latejoin + return FALSE + + return is_admin(preferences.parent) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index fabdce5bc32..1c6ed58ae24 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -410,4 +410,11 @@ to_chat(new_player, span_info("Lobby Menu HUD reset. You may reset the HUD again in [DisplayTimeText(RESET_HUD_INTERVAL)].")) hud_used.show_hud(hud_used.hud_version) +///Auto deadmins an admin when they click to toggle the ready button or join game button in the menu +/mob/dead/new_player/proc/auto_deadmin_on_ready_or_latejoin() + if(!client?.holder) //If they aren't an admin we dont care + return TRUE + if(CONFIG_GET(flag/auto_deadmin_on_ready_or_latejoin) || (client.prefs.read_preference(/datum/preference/toggle/auto_deadmin_on_ready_or_latejoin)) || (client.prefs?.toggles & DEADMIN_ALWAYS)) + return client.holder.auto_deadmin() + #undef RESET_HUD_INTERVAL diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 3308fd4aa45..7d2e111083f 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -142,7 +142,7 @@ * Checks if the attached client is an admin and may deadmin them * * Configs: - * * flag/auto_deadmin_players + * * flag/auto_deadmin_always * * client.prefs?.toggles & DEADMIN_ALWAYS * * User is antag and flag/auto_deadmin_antagonists or client.prefs?.toggles & DEADMIN_ANTAGONIST * * or if their job demands a deadminning SSjob.handle_auto_deadmin_roles() @@ -152,7 +152,7 @@ /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?.toggles & DEADMIN_ALWAYS)) + if(CONFIG_GET(flag/auto_deadmin_always) || (client.prefs?.toggles & DEADMIN_ALWAYS)) return client.holder.auto_deadmin() if(mind.has_antag_datum(/datum/antagonist) && (CONFIG_GET(flag/auto_deadmin_antagonists) || client.prefs?.toggles & DEADMIN_ANTAGONIST)) return client.holder.auto_deadmin() diff --git a/config/config.txt b/config/config.txt index 3d3f628423f..17c3750efc6 100644 --- a/config/config.txt +++ b/config/config.txt @@ -380,8 +380,11 @@ AUTOADMIN_RANK Game Master #AUTOADMIN -## Uncomment to automatically deadmin players when the game starts. -#AUTO_DEADMIN_PLAYERS +## Uncomment to automatically deadmin players whenever they are controlling a mob. +#AUTO_DEADMIN_ALWAYS + +## Uncomment to automatically deadmin players when they click to ready up or join game. For latejoining, does it before they pick a role because it's best done early to limit metainfo. +#AUTO_DEADMIN_ON_READY_OR_LATEJOIN ## Number of game ticks before player-admins will be automatically deadminned. #AUTO_DEADMIN_TIMEGATE 600 diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/admin.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/admin.tsx index 7888a53e003..7224b78da7d 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/admin.tsx +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/admin.tsx @@ -53,3 +53,12 @@ export const comms_notification: FeatureToggle = { category: 'ADMIN', component: CheckboxInput, }; + +export const auto_deadmin_on_ready_or_latejoin: FeatureToggle = { + name: 'Auto deadmin - Ready or Latejoin', + category: 'ADMIN', + description: ` + When enabled, you will automatically deadmin when you click to ready up or latejoin a round. +`, + component: CheckboxInput, +};