-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check Players adminverb + other admin verb fixes (#4030)
* Check Players adminverb + other admin verb fixes Check Players adminverb to quickly and precisely check how many connected clients of several categories: Connected Clients, Living Players, Dead Players, Ghost Players, Living Antags. * Updates * Update readme.md * updated with comments etc * Updates after review I don't think I can check adjust_metacoins properly (or at least I can't figure out how to get it to work) so I have reverted to what it was before * lucy ur so right * changes after review tested, still works, hopefully fixes merge conflict * guh * Changes after review Requested changes are in, thanks for all your hard work looking at my code Lucy!
- Loading branch information
Showing
7 changed files
with
133 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
monkestation/code/modules/veth_misc_items/admin_fixes/check_players.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
27 changes: 27 additions & 0 deletions
27
monkestation/code/modules/veth_misc_items/admin_fixes/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Title: <!--Title of your addition--> | ||
|
||
<!-- uppercase, underscore_connected name of your module, that you use to mark files--> | ||
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 | ||
<!-- Any master file changes you've made to existing master files or if you've added a new master file. Please mark either as #NEW or #CHANGE --> | ||
|
||
### Included files that are not contained in this module: | ||
|
||
- N/A | ||
<!-- Likewise, be it a non-modular file or a modular one that's not contained within the folder belonging to this specific module, it should be mentioned here --> | ||
#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: | ||
|
||
<!-- Here go the credits to you, dear coder, and in case of collaborative work or ports, credits to the original source of the code --> | ||
<!-- Original Coders --> | ||
Made by Veth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Data>(); | ||
|
||
return ( | ||
<Window title="Player Statistics" width={400} height={180} theme="admin"> | ||
<Section title="Player Overview"> | ||
<LabeledList> | ||
<LabeledList.Item | ||
label="Total Clients" | ||
labelColor="#4287f5" | ||
color="#4287f5" | ||
> | ||
{total_clients} | ||
</LabeledList.Item> | ||
<LabeledList.Item | ||
label="Living Players" | ||
labelColor="#1d9123" | ||
color="#1d9123" | ||
> | ||
{living_players} | ||
</LabeledList.Item> | ||
<LabeledList.Item | ||
label="Dead Players" | ||
labelColor="#666e66" | ||
color="#666e66" | ||
> | ||
{dead_players} | ||
</LabeledList.Item> | ||
<LabeledList.Item | ||
label="Observers" | ||
labelColor="#34949e" | ||
color="#34949e" | ||
> | ||
{observers} | ||
</LabeledList.Item> | ||
<LabeledList.Item | ||
label="Living Antags" | ||
labelColor="#bd2924" | ||
color="#bd2924" | ||
> | ||
{living_antags} | ||
</LabeledList.Item> | ||
</LabeledList> | ||
</Section> | ||
</Window> | ||
); | ||
}; |