mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-12 15:45:25 +01:00
Makes the admin logout tracking system actually work
This commit is contained in:
@@ -1001,3 +1001,22 @@ var/gamma_ship_location = 1 // 0 = station , 1 = space
|
||||
qdel(frommob)
|
||||
|
||||
return 1
|
||||
|
||||
// Returns a list of the number of admins in various categories
|
||||
// result[1] is the number of staff that match the rank mask and are active
|
||||
// result[2] is the number of staff that do not match the rank mask
|
||||
// result[3] is the number of staff that match the rank mask and are inactive
|
||||
/proc/staff_countup(rank_mask = R_BAN)
|
||||
var/list/result = list(0, 0, 0)
|
||||
for(var/client/X in admins)
|
||||
if(rank_mask && !check_rights_for(X, rank_mask))
|
||||
result[2]++
|
||||
continue
|
||||
if(X.holder.fakekey)
|
||||
result[2]++
|
||||
continue
|
||||
if(X.is_afk())
|
||||
result[3]++
|
||||
continue
|
||||
result[1]++
|
||||
return result
|
||||
|
||||
+14
-10
@@ -3,15 +3,19 @@
|
||||
unset_machine()
|
||||
player_list -= src
|
||||
log_access("Logout: [key_name(src)]")
|
||||
if(admin_datums[src.ckey])
|
||||
if(ticker && ticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing.
|
||||
var/admins_number = admins.len
|
||||
|
||||
// `holder` is nil'd out by now, so we check the `admin_datums` array directly
|
||||
//Only report this stuff if we are currently playing.
|
||||
if(admin_datums[ckey] && ticker && ticker.current_state == GAME_STATE_PLAYING)
|
||||
var/datum/admins/temp_admin = admin_datums[ckey]
|
||||
// Triggers on people with banhammer power only - no mentors tripping the alarm
|
||||
if(temp_admin.rights & R_BAN)
|
||||
message_admins("Admin logout: [key_name_admin(src)]")
|
||||
if(admins_number == 0) //Apparently the admin logging out is no longer an admin at this point, so we have to check this towards 0 and not towards 1. Awell.
|
||||
send2adminirc("[key_name(src)] logged out - no more admins online.")
|
||||
var/list/admincounter = staff_countup(R_BAN)
|
||||
if(admincounter[1] == 0) // No active admins
|
||||
send2irc(config.admin_notify_irc, "[key_name(src)] logged out - No active admins, [admincounter[2]] non-admin staff, [admincounter[3]] inactive staff.")
|
||||
|
||||
..()
|
||||
|
||||
callHook("mob_logout", list("client" = client, "mob" = src))
|
||||
|
||||
return 1
|
||||
|
||||
callHook("mob_logout", list("client" = client, "mob" = src))
|
||||
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user