diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 155acb3487ea..0427de674555 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -102,6 +102,7 @@ GLOBAL_PROTECT(admin_verbs_admin) /client/proc/log_viewer_new, /client/proc/request_more_opfor, /client/proc/view_opfors, + /client/proc/check_players, /client/proc/AdminVOX, ) GLOBAL_LIST_INIT(admin_verbs_ban, list(/client/proc/unban_panel, /client/proc/ban_panel, /client/proc/stickybanpanel, /client/proc/library_control)) diff --git a/monkestation/code/modules/admin/antag_tokens.dm b/monkestation/code/modules/admin/antag_tokens.dm index 67754d61f5a4..79122178194f 100644 --- a/monkestation/code/modules/admin/antag_tokens.dm +++ b/monkestation/code/modules/admin/antag_tokens.dm @@ -4,11 +4,10 @@ set name = "Adjust Antag Tokens" set desc = "You can modifiy a targets metacoin balance by adding or subtracting." - var/mob/chosen_player = tgui_input_list(src, "Choose a Player", "Player List", GLOB.player_list) - if(!chosen_player) + var/client/chosen_client = tgui_input_list(src, "Choose a Player", "Player List", GLOB.clients) + if(!chosen_client) return - var/client/chosen_client = chosen_player.client var/adjustment_amount = tgui_input_number(src, "How much should we adjust this users antag tokens by?", "Input Value", TRUE, 10, -10) if(!adjustment_amount || !chosen_client) return diff --git a/monkestation/code/modules/admin/event_tokens.dm b/monkestation/code/modules/admin/event_tokens.dm index 8e89c4960cbd..f61f7b559dc2 100644 --- a/monkestation/code/modules/admin/event_tokens.dm +++ b/monkestation/code/modules/admin/event_tokens.dm @@ -4,11 +4,10 @@ set name = "Adjust Event Tokens" set desc = "Adjust how many event tokens someone has." - var/mob/chosen_player = tgui_input_list(src, "Choose a Player", "Player List", GLOB.player_list) - if(!chosen_player) + var/client/chosen_client = tgui_input_list(src, "Choose a Player", "Player List", GLOB.clients) + if(!chosen_client) return - var/client/chosen_client = chosen_player.client var/adjustment_amount = tgui_input_number(src, "How much should we adjust this users tokens by?", "Input Value", TRUE) if(!adjustment_amount || !chosen_client) return diff --git a/monkestation/code/modules/veth_misc_items/admin_fixes/check_players.dm b/monkestation/code/modules/veth_misc_items/admin_fixes/check_players.dm new file mode 100644 index 000000000000..049d319453bb --- /dev/null +++ b/monkestation/code/modules/veth_misc_items/admin_fixes/check_players.dm @@ -0,0 +1,34 @@ +/client/proc/check_players() + set name = "Check Players" + set category = "Admin.Game" + if(!check_rights(NONE)) // Rights check for admin access + message_admins("[key_name(src)] attempted to use CheckPlayers without sufficient rights.") //messages admins if rights check fails + return + var/datum/check_players/tgui = new + tgui.ui_interact(mob) + to_chat(src, span_interface("Player statistics displayed."), confidential = TRUE) + SSblackbox.record_feedback("tally", "admin_verb", 1, "Check Players") //Logging + message_admins("[key_name(src)] checked players.") //Logging + +/datum/check_players/ui_data(mob/user) //Data required for the frontend + return list( + "total_clients" = length(GLOB.player_list), + "living_players" = length(GLOB.alive_player_list), + "dead_players" = length(GLOB.dead_player_list), + "observers" = length(GLOB.current_observers_list), + "living_antags" = length(GLOB.current_living_antags), + ) + +/datum/check_players //datum required for the tgui window + +/datum/check_players/ui_close() + qdel(src) + +/datum/check_players/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "PlayerStatistics") + ui.open() + +/datum/check_players/ui_state(mob/user) + return GLOB.admin_state diff --git a/monkestation/code/modules/veth_misc_items/admin_fixes/readme.md b/monkestation/code/modules/veth_misc_items/admin_fixes/readme.md new file mode 100644 index 000000000000..89fed5f892b0 --- /dev/null +++ b/monkestation/code/modules/veth_misc_items/admin_fixes/readme.md @@ -0,0 +1,27 @@ +## Title: + + +MODULE ID: CHECKPLAYERS + +### Description: +Changes admin verbs - Adjust Event/Antag/Monkecoin tokens from character name to ckey. +Adds Adminverb - Check Players for a quick and easy method to check currently connected clients of several categories - All clients, alive, dead, ghosts, living antags. + +### Master file additions + +- N/A + + +### Included files that are not contained in this module: + +- N/A + +#NEW tgui/packages/tgui/interfaces/PlayerStatisticsUI.tsx +#CHANGE monkestation/code/modules/admin/antag_tokens.dm +#CHANGE monkestation/code/modules/admin/event_tokens.dm +#CHANGE monkestation/code/modules/store/admin/admin_coin_modification.dm +### Credits: + + + +Made by Veth diff --git a/tgstation.dme b/tgstation.dme index f45d0e74f107..1b0fa98ac70c 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -8216,6 +8216,7 @@ #include "monkestation\code\modules\vehicles\mecha\mecha_actions.dm" #include "monkestation\code\modules\vehicles\mecha\equipment\tools\other_tools.dm" #include "monkestation\code\modules\vending\megaseed.dm" +#include "monkestation\code\modules\veth_misc_items\admin_fixes\check_players.dm" #include "monkestation\code\modules\veth_misc_items\admin_vox\admin_vox.dm" #include "monkestation\code\modules\veth_misc_items\canopics\canopics.dm" #include "monkestation\code\modules\viking\viking_armour.dm" diff --git a/tgui/packages/tgui/interfaces/PlayerStatistics.tsx b/tgui/packages/tgui/interfaces/PlayerStatistics.tsx new file mode 100644 index 000000000000..cb9f3538aff3 --- /dev/null +++ b/tgui/packages/tgui/interfaces/PlayerStatistics.tsx @@ -0,0 +1,66 @@ +import { Section, LabeledList } from '../components'; +import { Window } from '../layouts'; +import { useBackend } from '../backend'; +type Data = { + total_clients: number; + living_players: number; + dead_players: number; + observers: number; + living_antags: number; +}; + +export const PlayerStatistics = () => { + const { + data: { + total_clients, + living_players, + dead_players, + observers, + living_antags, + }, + } = useBackend(); + + return ( + +
+ + + {total_clients} + + + {living_players} + + + {dead_players} + + + {observers} + + + {living_antags} + + +
+
+ ); +};