mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2026-08-27 14:46:57 +01:00
TGUI Playtimes Panel
This commit is contained in:
@@ -71,7 +71,7 @@ GLOBAL_PROTECT(admin_verbs_admin)
|
||||
/client/proc/cmd_admin_man_up_global, //CIT CHANGE - ditto
|
||||
/client/proc/cmd_admin_create_centcom_report,
|
||||
/client/proc/cmd_change_command_name,
|
||||
/client/proc/cmd_admin_check_player_exp, /* shows players by playtime */
|
||||
/client/proc/cmd_player_playtimes, /* shows players by playtime */
|
||||
/client/proc/toggle_combo_hud, // toggle display of the combination pizza antag and taco sci/med/eng hud
|
||||
/client/proc/toggle_AI_interact, /*toggle admin ability to interact with machines as an AI*/
|
||||
/datum/admins/proc/open_shuttlepanel, /* Opens shuttle manipulator UI */
|
||||
|
||||
@@ -1633,23 +1633,6 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
log_game("[key_name(usr)] triggered a CentCom recall, with the message of: [message]")
|
||||
SSshuttle.centcom_recall(SSshuttle.emergency.timer, message)
|
||||
|
||||
/client/proc/cmd_admin_check_player_exp() //Allows admins to determine who the newer players are.
|
||||
set category = "Admin"
|
||||
set name = "Player Playtime"
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
if(!CONFIG_GET(flag/use_exp_tracking))
|
||||
to_chat(usr, "<span class='warning'>Tracking is disabled in the server configuration file.</span>")
|
||||
return
|
||||
|
||||
var/list/msg = list()
|
||||
msg += "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Playtime Report</title></head><body>Playtime:<BR><UL>"
|
||||
for(var/client/C in GLOB.clients)
|
||||
msg += "<LI> - [key_name_admin(C)]: <A href='?_src_=holder;[HrefToken()];getplaytimewindow=[REF(C.mob)]'>" + C.get_exp_living() + "</a></LI>"
|
||||
msg += "</UL></BODY></HTML>"
|
||||
src << browse(msg.Join(), "window=Player_playtime_check")
|
||||
|
||||
/obj/effect/temp_visual/fireball
|
||||
icon = 'icons/obj/wizard.dmi'
|
||||
icon_state = "fireball"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
/proc/cmp_playtime(list/A, list/B)
|
||||
return A["playtime"] - B["playtime"]
|
||||
@@ -0,0 +1,73 @@
|
||||
/client
|
||||
var/datum/player_playtime/playtime_menu
|
||||
|
||||
/client/proc/cmd_player_playtimes()
|
||||
set category = "Admin"
|
||||
set name = "Player Playtimes"
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
if(!CONFIG_GET(flag/use_exp_tracking))
|
||||
to_chat(usr, "<span class='warning'>Tracking is disabled in the server configuration file.</span>")
|
||||
return
|
||||
|
||||
if(!playtime_menu)
|
||||
playtime_menu = new()
|
||||
playtime_menu.ui_interact(usr)
|
||||
|
||||
/datum/player_playtime/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "PlayerPlaytimes", "Player Playtimes")
|
||||
ui.open()
|
||||
|
||||
/datum/player_playtime/ui_state(mob/user)
|
||||
return GLOB.admin_state
|
||||
|
||||
/datum/player_playtime/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
var/list/clients = list()
|
||||
for(var/client/C in GLOB.clients)
|
||||
var/list/client = list()
|
||||
|
||||
client["ckey"] = C.ckey
|
||||
client["playtime"] = C.get_exp_living(TRUE)
|
||||
client["playtime_hours"] = C.get_exp_living()
|
||||
|
||||
var/name = C.ckey
|
||||
var/mob/M = C.mob
|
||||
if (istype(M))
|
||||
if (isobserver(M))
|
||||
client["observer"] = TRUE
|
||||
|
||||
if(M.real_name)
|
||||
name += (" (" + M.real_name + ")")
|
||||
client["name"] = name
|
||||
|
||||
clients += list(client)
|
||||
|
||||
clients = sortList(clients, /proc/cmp_playtime)
|
||||
data["clients"] = clients
|
||||
return data
|
||||
|
||||
/datum/player_playtime/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if ("observe")
|
||||
if(!isobserver(usr) && !check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/atom/movable/target = get_mob_by_key(params["ckey"])
|
||||
if(!target)
|
||||
to_chat(usr, "<span class='notice'>This player cannot be observed.</span>")
|
||||
return
|
||||
|
||||
var/client/C = usr.client
|
||||
if(!isobserver(usr) && !C.admin_ghost())
|
||||
return
|
||||
var/mob/dead/observer/A = C.mob
|
||||
A.ManualFollow(target)
|
||||
@@ -4157,6 +4157,7 @@
|
||||
#include "modular_sand\code\modules\vending\clothesmate.dm"
|
||||
#include "modular_sand\code\modules\vending\kinkmate.dm"
|
||||
#include "modular_splurt\code\__HELPERS\_cit_helpers.dm"
|
||||
#include "modular_splurt\code\__HELPERS\cmp.dm"
|
||||
#include "modular_splurt\code\__HELPERS\icons.dm"
|
||||
#include "modular_splurt\code\_globalvars\lists\global_lewd.dm"
|
||||
#include "modular_splurt\code\_globalvars\lists\mapping.dm"
|
||||
@@ -4207,6 +4208,7 @@
|
||||
#include "modular_splurt\code\game\object\structures\crates_lockers\crates\wooden.dm"
|
||||
#include "modular_splurt\code\game\turfs\simulated\floor\fancy_floor.dm"
|
||||
#include "modular_splurt\code\game\turfs\simulated\wall\mineral_walls.dm"
|
||||
#include "modular_splurt\code\modules\admin\playtimes.dm"
|
||||
#include "modular_splurt\code\modules\admin\verbs\one_click_antag.dm"
|
||||
#include "modular_splurt\code\modules\admin\verbs\randomverbs.dm"
|
||||
#include "modular_splurt\code\modules\antagonists\ashwalker.dm"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import { useBackend } from '../backend';
|
||||
import { Button, LabeledList, Section } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
export const PlayerPlaytimes = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
clients,
|
||||
} = data;
|
||||
return (
|
||||
<Window
|
||||
title="Player Playtimes"
|
||||
width={470}
|
||||
height={700}
|
||||
resizable>
|
||||
<Window.Content scrollable>
|
||||
|
||||
<Section>
|
||||
<LabeledList>
|
||||
{clients.map(client => (
|
||||
<LabeledList.Item
|
||||
key={client.ckey}
|
||||
label={client.playtime_hours}>
|
||||
<Button
|
||||
icon={client.observer ? "ghost" : ""}
|
||||
content={client.name}
|
||||
onClick={() => act('observe', {
|
||||
ckey: client.ckey,
|
||||
})} />
|
||||
</LabeledList.Item>
|
||||
))}
|
||||
</LabeledList>
|
||||
</Section>
|
||||
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user