Skip to content

Commit

Permalink
this should work
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Sep 28, 2024
1 parent 7ce846c commit 9d756e4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
/// Splits admin tabs in Statpanel
#define SPLIT_ADMIN_TABS (1<<0)
#define ADMIN_STEALTHMODE (1<<1)
#define ADMIN_AFK_SAFE (1<<2)

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

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

0 comments on commit 9d756e4

Please sign in to comment.