Skip to content

Commit

Permalink
Stealthy Stealth changes to Stealth (#5389)
Browse files Browse the repository at this point in the history
It's big brother! Oh my god!
  • Loading branch information
realforest2001 committed Jan 6, 2024
1 parent e7178d1 commit a1f477b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ block( \
//toggles_admin
/// Splits admin tabs in Statpanel
#define SPLIT_ADMIN_TABS (1<<0)
#define ADMIN_STEALTHMODE (1<<1)

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

Expand Down
10 changes: 8 additions & 2 deletions code/game/verbs/who.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
var/list/Lines = list()
if(admin_holder && ((R_ADMIN & admin_holder.rights) || (R_MOD & admin_holder.rights)))
for(var/client/C in GLOB.clients)
if(!CLIENT_HAS_RIGHTS(src, R_STEALTH) && (CLIENT_IS_STEALTHED(C)))
continue
var/entry = "[C.key]"
if(C.mob) //Juuuust in case
if(istype(C.mob, /mob/new_player))
Expand Down Expand Up @@ -139,7 +141,7 @@

else
for(var/client/C in GLOB.clients)
if(C.admin_holder && C.admin_holder.fakekey)
if((C.admin_holder && C.admin_holder.fakekey) || (CLIENT_IS_STEALTHED(C)))
continue

Lines += C.key
Expand Down Expand Up @@ -172,6 +174,8 @@
LAZYSET(listings, category, list())

for(var/client/C in GLOB.admins)
if(CLIENT_IS_STEALTHED(C) && !CLIENT_HAS_RIGHTS(src, R_STEALTH))
continue
if(C.admin_holder?.fakekey && !CLIENT_IS_STAFF(src))
continue
for(var/category in mappings)
Expand All @@ -187,7 +191,9 @@
for(var/srank in entry.admin_holder.extra_titles)
dat += " & [srank]"
if(CLIENT_IS_STAFF(src))
if(entry.admin_holder?.fakekey)
if(CLIENT_IS_STEALTHED(entry))
dat += " <B><font color='#b60d0d'>(STEALTHED)</font></B>"
else if(entry.admin_holder?.fakekey)
dat += " <i>(HIDDEN)</i>"
if(istype(entry.mob, /mob/dead/observer))
dat += "<B> - <font color='#808080'>Observing</font></B>"
Expand Down
1 change: 1 addition & 0 deletions code/global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define CLIENT_HAS_RIGHTS(cli, flags) ((cli?.admin_holder?.rights & flags) == flags)
#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 AHOLD_IS_MOD(ahold) (ahold && (ahold.rights & R_MOD))
#define AHOLD_IS_ADMIN(ahold) (ahold && (ahold.rights & R_ADMIN))
Expand Down
15 changes: 15 additions & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ GLOBAL_LIST_INIT(admin_verbs_color, list(
/client/proc/set_ooc_color_self
))

GLOBAL_LIST_INIT(admin_verbs_stealth, list(
/client/proc/toggle_admin_stealth
))

GLOBAL_LIST_INIT(admin_mob_event_verbs_hideable, list(
/client/proc/hide_event_mob_verbs,
/client/proc/cmd_admin_select_mob_rank,
Expand Down Expand Up @@ -341,6 +345,8 @@ GLOBAL_LIST_INIT(roundstart_mod_verbs, list(
add_verb(src, GLOB.admin_verbs_sounds)
if(CLIENT_HAS_RIGHTS(src, R_SPAWN))
add_verb(src, GLOB.admin_verbs_spawn)
if(CLIENT_HAS_RIGHTS(src, R_STEALTH))
add_verb(src, GLOB.admin_verbs_stealth)
if(GLOB.RoleAuthority && (GLOB.RoleAuthority.roles_whitelist[ckey] & WHITELIST_YAUTJA_LEADER))
add_verb(src, GLOB.clan_verbs)

Expand Down Expand Up @@ -370,6 +376,7 @@ GLOBAL_LIST_INIT(roundstart_mod_verbs, list(
GLOB.admin_mob_event_verbs_hideable,
GLOB.admin_verbs_hideable,
GLOB.debug_verbs,
GLOB.admin_verbs_stealth,
))

/client/proc/jobbans()
Expand Down Expand Up @@ -595,6 +602,14 @@ GLOBAL_LIST_INIT(roundstart_mod_verbs, list(
else
to_chat(usr, SPAN_BOLDNOTICE("You will no longer hear an audio cue for ARES and Prayer messages."))

/client/proc/toggle_admin_stealth()
set name = "Toggle Admin Stealth"
set category = "Preferences"
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."))

#undef MAX_WARNS
#undef AUTOBANTIME
2 changes: 2 additions & 0 deletions code/modules/admin/player_panel/player_panel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@
for(var/mob/M in mobs)
if(!M.ckey)
continue
if(!CLIENT_HAS_RIGHTS(usr.client, R_STEALTH) && (M.client && (CLIENT_IS_STEALTHED(M.client))))
continue

var/color = i % 2 == 0 ? "#6289b7" : "#48709d"

Expand Down
7 changes: 4 additions & 3 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
admin_holder = GLOB.admin_datums[ckey]
if(admin_holder)
admin_holder.associate(src)
notify_login()

add_pref_verbs()
//preferences datum - also holds some persistent data for the client (because we may as well keep these datums to a minimum)
Expand All @@ -343,6 +342,8 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
prefs.last_id = computer_id //these are gonna be used for banning
fps = prefs.fps

notify_login()

load_xeno_name()

human_name_ban = prefs.human_name_ban
Expand Down Expand Up @@ -476,7 +477,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
SSping.currentrun -= src

log_access("Logout: [key_name(src)]")
if(CLIENT_IS_STAFF(src))
if(CLIENT_IS_STAFF(src) && !CLIENT_IS_STEALTHED(src))
message_admins("Admin logout: [key_name(src)]")

var/list/adm = get_admin_counts(R_MOD)
Expand All @@ -493,7 +494,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
/// Handles login-related logging and associated notifications
/client/proc/notify_login()
log_access("Login: [key_name(src)] from [address ? address : "localhost"]-[computer_id] || BYOND v[byond_version].[byond_build]")
if(CLIENT_IS_STAFF(src))
if(CLIENT_IS_STAFF(src) && !CLIENT_IS_STEALTHED(src))
message_admins("Admin login: [key_name(src)]")

var/list/adm = get_admin_counts(R_MOD)
Expand Down

0 comments on commit a1f477b

Please sign in to comment.