diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index f655d89511b..feb2736a111 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -162,6 +162,14 @@ /proc/show_candidate_poll_window(mob/candidate_mob, poll_time, question, list/candidates, ignore_category, time_passed, flashwindow = TRUE) set waitfor = 0 + // Universal opt-out for all players. + if ((!candidate_mob.client.prefs.read_preference(/datum/preference/toggle/ghost_roles))) + return + + // Opt-out for admins whom are currently adminned. + if ((!candidate_mob.client.prefs.read_preference(/datum/preference/toggle/ghost_roles_as_admin)) && candidate_mob.client.holder) + return + SEND_SOUND(candidate_mob, 'sound/misc/notice2.ogg') //Alerting them to their consideration if(flashwindow) window_flash(candidate_mob.client) diff --git a/code/modules/client/preferences/admin.dm b/code/modules/client/preferences/admin.dm index 5d26cff7c69..965116fdff9 100644 --- a/code/modules/client/preferences/admin.dm +++ b/code/modules/client/preferences/admin.dm @@ -50,3 +50,15 @@ return FALSE return is_admin(preferences.parent) + +/// When enabled, prevents any and all ghost role pop-ups WHILE ADMINNED. +/datum/preference/toggle/ghost_roles_as_admin + category = PREFERENCE_CATEGORY_GAME_PREFERENCES + savefile_key = "ghost_roles_as_admin" + savefile_identifier = PREFERENCE_PLAYER + +/datum/preference/toggle/ghost_roles_as_admin/is_accessible(datum/preferences/preferences) + if (!..(preferences)) + return FALSE + + return is_admin(preferences.parent) diff --git a/code/modules/client/preferences/ghost.dm b/code/modules/client/preferences/ghost.dm index ce8e05235ee..ab191873c1b 100644 --- a/code/modules/client/preferences/ghost.dm +++ b/code/modules/client/preferences/ghost.dm @@ -176,3 +176,9 @@ savefile_key = "inquisitive_ghost" savefile_identifier = PREFERENCE_PLAYER category = PREFERENCE_CATEGORY_GAME_PREFERENCES + +/// When enabled, prevents any and all ghost role pop-ups. +/datum/preference/toggle/ghost_roles + category = PREFERENCE_CATEGORY_GAME_PREFERENCES + savefile_key = "ghost_roles" + savefile_identifier = PREFERENCE_PLAYER 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 a2587849d54..f72caa6c2ac 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 @@ -1,4 +1,5 @@ import { CheckboxInput, FeatureColorInput, Feature, FeatureDropdownInput, FeatureToggle } from '../base'; +import { multiline } from 'common/string'; export const asaycolor: Feature = { name: 'Admin chat color', @@ -29,3 +30,15 @@ export const fast_mc_refresh: FeatureToggle = { 'Whether or not the MC tab of the Stat Panel refreshes fast. This is expensive so make sure you need it.', component: CheckboxInput, }; + +export const ghost_roles_as_admin: FeatureToggle = { + name: 'Get ghost roles while adminned', + category: 'ADMIN', + description: multiline` + If you de-select this, you will not get any ghost role pop-ups while + adminned! Every single pop-up WILL never show up for you in an adminned + state. However, this does not suppress notifications when you are + a regular player (deadminned). +`, + component: CheckboxInput, +}; diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/ghost.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/ghost.tsx index 344146d39f1..e92c08b6bdf 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/ghost.tsx +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/ghost.tsx @@ -130,3 +130,15 @@ export const inquisitive_ghost: FeatureToggle = { description: 'Clicking on something as a ghost will examine it.', component: CheckboxInput, }; + +export const ghost_roles: FeatureToggle = { + name: 'Get ghost roles', + category: 'GHOST', + description: multiline` + If you de-select this, you will not get any ghost role pop-ups what-so-ever! + Every single type of these pop-ups WILL be muted for you when you are + ghosted. Very useful for those who find ghost roles or the + pop-ups annoying, use at your own peril. +`, + component: CheckboxInput, +};