mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge pull request #6354 from CHOMPStation2/upstream-merge-14987
[MIRROR] Alternate to https://github.com/VOREStation/VOREStation/pull/14959 New Admin verb: Report Player Status
This commit is contained in:
@@ -171,7 +171,9 @@ var/list/admin_verbs_fun = list(
|
||||
/client/proc/add_mob_for_narration, //VOREStation Add
|
||||
/client/proc/remove_mob_for_narration, //VOREStation Add
|
||||
/client/proc/narrate_mob, //VOREStation Add
|
||||
/client/proc/narrate_mob_args //VOREStation Add
|
||||
/client/proc/narrate_mob_args, //VOREStation Add
|
||||
/client/proc/getPlayerStatus //VORESTation Add
|
||||
|
||||
)
|
||||
|
||||
var/list/admin_verbs_spawn = list(
|
||||
|
||||
44
code/modules/admin/verbs/get_player_status.dm
Normal file
44
code/modules/admin/verbs/get_player_status.dm
Normal file
@@ -0,0 +1,44 @@
|
||||
#define INACTIVITY_CAP 15 MINUTES //Creating a define for this for more straight forward finagling.
|
||||
|
||||
|
||||
//TGUI functionality planned for easier readability, so creating a new file for this
|
||||
//TGUI functionality will call a datum to handle things separately
|
||||
/client/proc/getPlayerStatus()
|
||||
set name = "Report Player Status"
|
||||
set desc = "Get information on all active players in-game."
|
||||
set category = "EventKit"
|
||||
|
||||
if(!check_rights(R_FUN)) return
|
||||
|
||||
var/player_list_local = player_list //Copying player list so we don't touch a global var all the time
|
||||
var/list/area_list = list() //An associative list, where key is area name, value is a list of mob references
|
||||
var/inactives = 0
|
||||
var/players = 0
|
||||
|
||||
//Initializing our working list
|
||||
for(var/player in player_list_local)
|
||||
|
||||
if(!istype(player, /mob/living)) continue //We only care for living players
|
||||
var/mob/living/L = player
|
||||
players += 1
|
||||
if(L.client.inactivity > INACTIVITY_CAP)
|
||||
inactives += 1
|
||||
continue //Anyone who hasn't done anything in 15 minutes is likely too busy
|
||||
var/area_name = get_area_name(L)
|
||||
if(area_name in area_list)
|
||||
area_list[area_name] += L // area_name:list(A,B,C); we add L to (A,B,C)
|
||||
else
|
||||
area_list[area_name] = list(L)
|
||||
|
||||
var/message = "#### The Following Players Are Likely Available #### \n"
|
||||
for(var/cur_area in area_list)
|
||||
var/area_players = area_list[cur_area]
|
||||
message += "**** There are currently [LAZYLEN(area_players)] in [cur_area] **** \n"
|
||||
|
||||
|
||||
for(var/mob/living/L in area_players)
|
||||
message += "[L.name] ([L.key]) at ([L.x];[L.y]) has been inactive for [round(L.client.inactivity / (60 SECONDS))] minutes. \n"
|
||||
|
||||
|
||||
message += "#### Over all, there are [players] eligible players, of which [inactives] were hidden due to inactivity. ####"
|
||||
to_chat(usr, SPAN_NOTICE(message))
|
||||
@@ -1864,6 +1864,7 @@
|
||||
#include "code\modules\admin\verbs\dice.dm"
|
||||
#include "code\modules\admin\verbs\entity_narrate.dm"
|
||||
#include "code\modules\admin\verbs\fps.dm"
|
||||
#include "code\modules\admin\verbs\get_player_status.dm"
|
||||
#include "code\modules\admin\verbs\getlogs.dm"
|
||||
#include "code\modules\admin\verbs\grief_fixers.dm"
|
||||
#include "code\modules\admin\verbs\lightning_strike.dm"
|
||||
|
||||
Reference in New Issue
Block a user