Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staff default toggles #7235

Merged
merged 2 commits into from
Oct 5, 2024
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
5 changes: 3 additions & 2 deletions code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@
/// Splits admin tabs in Statpanel
#define SPLIT_ADMIN_TABS (1<<0)
#define ADMIN_STEALTHMODE (1<<1)
#define ADMIN_AFK_SAFE (1<<2)

//=================================================

#define TOGGLES_CHAT_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_LOOC|CHAT_GHOSTHIVEMIND)
#define TOGGLES_CHAT_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_LOOC|CHAT_GHOSTHIVEMIND|CHAT_FFATTACKLOGS)

#define TOGGLES_GHOST_DEFAULT (GHOST_HEALTH_SCAN)

Expand All @@ -166,7 +167,7 @@

#define TOGGLES_ERT_DEFAULT (PLAY_LEADER|PLAY_MEDIC|PLAY_ENGINEER|PLAY_HEAVY|PLAY_SMARTGUNNER|PLAY_SYNTH|PLAY_MISC)

#define TOGGLES_ADMIN_DEFAULT (NONE)
#define TOGGLES_ADMIN_DEFAULT (ADMIN_AFK_SAFE)

// Game Intents
#define INTENT_HELP 1
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/inactivity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SUBSYSTEM_DEF(inactivity)
return

for(var/client/current as anything in GLOB.clients)
if(current.admin_holder && current.admin_holder.rights & R_MOD) //Skip admins.
if(CLIENT_IS_AFK_SAFE(current)) //Skip admins.
continue
if(current.is_afk(INACTIVITY_KICK))
if(!istype(current.mob, /mob/dead))
Expand Down
1 change: 1 addition & 0 deletions code/global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define CLIENT_IS_STAFF(cli) (cli?.admin_holder?.rights & (R_MOD|R_ADMIN))
#define CLIENT_IS_MENTOR(cli) CLIENT_HAS_RIGHTS(cli, R_MENTOR)
#define CLIENT_IS_STEALTHED(cli) (CLIENT_HAS_RIGHTS(cli, R_STEALTH) && cli.prefs?.toggles_admin & ADMIN_STEALTHMODE)
#define CLIENT_IS_AFK_SAFE(cli) (CLIENT_IS_STAFF(cli) && cli.prefs?.toggles_admin & ADMIN_AFK_SAFE)

#define AHOLD_IS_MOD(ahold) (ahold && (ahold.rights & R_MOD))
#define AHOLD_IS_ADMIN(ahold) (ahold && (ahold.rights & R_ADMIN))
Expand Down
12 changes: 11 additions & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ GLOBAL_LIST_INIT(admin_verbs_default, list(
/client/proc/cmd_mod_say, /* alternate way of typing asay, no different than cmd_admin_say */
/client/proc/cmd_admin_tacmaps_panel,
/client/proc/other_records,
/client/proc/toggle_admin_afk_safety,
))

GLOBAL_LIST_INIT(admin_verbs_admin, list(
Expand Down Expand Up @@ -604,12 +605,21 @@ GLOBAL_LIST_INIT(roundstart_mod_verbs, list(

/client/proc/toggle_admin_stealth()
set name = "Toggle Admin Stealth"
set category = "Preferences"
set category = "Preferences.Admin"
prefs.toggles_admin ^= ADMIN_STEALTHMODE
if(prefs.toggles_admin & ADMIN_STEALTHMODE)
to_chat(usr, SPAN_BOLDNOTICE("You enabled admin stealth mode."))
else
to_chat(usr, SPAN_BOLDNOTICE("You disabled admin stealth mode."))

/client/proc/toggle_admin_afk_safety()
set name = "Toggle AFK Safety"
set category = "Preferences.Admin"
prefs.toggles_admin ^= ADMIN_AFK_SAFE
if(prefs.toggles_admin & ADMIN_AFK_SAFE)
to_chat(usr, SPAN_BOLDNOTICE("You enabled afk safety. You will no longer be kicked by afk timer."))
else
to_chat(usr, SPAN_BOLDNOTICE("You disabled afk safety. You will now be auto kicked by the afk timer."))

#undef MAX_WARNS
#undef AUTOBANTIME
12 changes: 11 additions & 1 deletion code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define SAVEFILE_VERSION_MIN 8
#define SAVEFILE_VERSION_MAX 26
#define SAVEFILE_VERSION_MAX 27

//handles converting savefiles to new formats
//MAKE SURE YOU KEEP THIS UP TO DATE!
Expand Down Expand Up @@ -161,6 +161,16 @@
else
S["xeno_ability_click_mode"] << XENO_ABILITY_CLICK_SHIFT

if(savefile_version < 27)
// Gives staff afk protection by default.
S["toggles_admin"] << TOGGLES_ADMIN_DEFAULT
// Updates default chat settings to enable FF logs for new staff.
var/chat_settings = 0
S["toggles_chat"] >> chat_settings
chat_settings &= ~CHAT_ATTACKLOGS
chat_settings |= CHAT_FFATTACKLOGS
S["toggles_chat"] << chat_settings

savefile_version = SAVEFILE_VERSION_MAX
return 1

Expand Down
Loading