From 88073d426fb66fb984589ea8955a46eb55553638 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 25 Jul 2024 00:47:50 +0500 Subject: [PATCH 01/34] I mean, miner, not mine --- code/controllers/subsystem/who.dm | 49 +++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 43ecbb435587..225212783682 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -23,9 +23,11 @@ SUBSYSTEM_DEF(who) var/tgui_interface_name = "Who" var/list/mobs_ckey = list() var/list/list_data = list() + var/list/list_admin_data = list() /datum/player_list/proc/update_data() var/list/new_list_data = list() + var/list/new_list_admin_data = list() var/list/new_mobs_ckey = list() var/list/additional_data = list( "lobby" = 0, @@ -38,15 +40,17 @@ SUBSYSTEM_DEF(who) "uscm" = 0, "uscm_marines" = 0, ) - new_list_data["additional_info"] = list() + new_list_admin_data["additional_info"] = list() var/list/counted_factions = list() for(var/client/client as anything in sortTim(GLOB.clients, GLOBAL_PROC_REF(cmp_ckey_asc))) CHECK_TICK new_list_data["all_clients"]++ + new_list_admin_data["all_clients"]++ var/list/client_payload = list() client_payload["ckey"] = "[client.key]" client_payload["text"] = "[client.key]" client_payload["ckey_color"] = "white" + new_list_data["total_players"] += list(client_payload.Copy()) var/mob/client_mob = client.mob new_mobs_ckey[client.key] = client_mob if(client_mob) @@ -107,57 +111,57 @@ SUBSYSTEM_DEF(who) else counted_factions[client_mob.faction]++ - new_list_data["total_players"] += list(client_payload) + new_list_admin_data["total_players"] += list(client_payload) - new_list_data["additional_info"] += list(list( + new_list_admin_data["additional_info"] += list(list( "content" = "In Lobby: [additional_data["lobby"]]", "color" = "#777", "text" = "Player in lobby", )) - new_list_data["additional_info"] += list(list( + new_list_admin_data["additional_info"] += list(list( "content" = "Spectating Players: [additional_data["observers"]]", "color" = "#777", "text" = "Spectating players", )) - new_list_data["additional_info"] += list(list( + new_list_admin_data["additional_info"] += list(list( "content" = "Spectating Admins: [additional_data["admin_observers"]]", "color" = "#777", "text" = "Spectating administrators", )) - new_list_data["additional_info"] += list(list( + new_list_admin_data["additional_info"] += list(list( "content" = "Humans: [additional_data["humans"]]", "color" = "#2C7EFF", "text" = "Players playing as Human", )) - new_list_data["additional_info"] += list(list( + new_list_admin_data["additional_info"] += list(list( "content" = "Infected Humans: [additional_data["infected_humans"]]", "color" = "#ec3535", "text" = "Players playing as Infected Human", )) - new_list_data["additional_info"] += list(list( + new_list_admin_data["additional_info"] += list(list( "content" = "[MAIN_SHIP_NAME] Personnel: [additional_data["uscm"]]", "color" = "#5442bd", "text" = "Players playing as [MAIN_SHIP_NAME] Personnel", )) - new_list_data["additional_info"] += list(list( + new_list_admin_data["additional_info"] += list(list( "content" = "Marines: [additional_data["uscm_marines"]]", "color" = "#5442bd", "text" = "Players playing as Marines", )) - new_list_data["additional_info"] += list(list( + new_list_admin_data["additional_info"] += list(list( "content" = "Yautjas: [additional_data["yautja"]]", "color" = "#7ABA19", "text" = "Players playing as Yautja", )) - new_list_data["additional_info"] += list(list( + new_list_admin_data["additional_info"] += list(list( "content" = "Infected Predators: [additional_data["infected_preds"]]", "color" = "#7ABA19", "text" = "Players playing as Infected Yautja", @@ -165,13 +169,13 @@ SUBSYSTEM_DEF(who) for(var/i in 1 to length(counted_factions)) if(counted_factions[counted_factions[i]]) - new_list_data["factions"] += list(list( + new_list_admin_data["factions"] += list(list( "content" = "[counted_factions[i]]: [counted_factions[counted_factions[i]]]", "color" = "#2C7EFF", "text" = "Other", )) if(counted_factions[FACTION_NEUTRAL]) - new_list_data["factions"] += list(list( + new_list_admin_data["factions"] += list(list( "content" = "[FACTION_NEUTRAL] Humans: [counted_factions[FACTION_NEUTRAL]]", "color" = "#688944", "text" = "Neutrals", @@ -180,13 +184,14 @@ SUBSYSTEM_DEF(who) for(var/faction_to_get in ALL_XENO_HIVES) var/datum/hive_status/hive = GLOB.hive_datum[faction_to_get] if(hive && length(hive.totalXenos)) - new_list_data["xenomorphs"] += list(list( + new_list_admin_data["xenomorphs"] += list(list( "content" = "[hive.name]: [length(hive.totalXenos)]", "color" = hive.color ? hive.color : "#8200FF", "text" = "Queen: [hive.living_xeno_queen ? "Alive" : "Dead"]", )) list_data = new_list_data + list_admin_data = new_list_admin_data mobs_ckey = new_mobs_ckey /datum/player_list/tgui_interact(mob/user, datum/tgui/ui) @@ -197,7 +202,10 @@ SUBSYSTEM_DEF(who) ui.set_autoupdate(TRUE) /datum/player_list/ui_data(mob/user) - . = list_data + if(CLIENT_IS_STAFF(user.client)) + . = list_admin_data + else + . = list_data /datum/player_list/ui_static_data(mob/user) . = list() @@ -232,6 +240,7 @@ SUBSYSTEM_DEF(who) /datum/player_list/staff/update_data() var/list/new_list_data = list() + var/list/new_list_admin_data = list() mobs_ckey = list() var/list/listings @@ -259,6 +268,7 @@ SUBSYSTEM_DEF(who) break for(var/category in listings) + var/list/minimum_admins = list() var/list/admins = list() for(var/client/entry as anything in listings[category]) var/list/admin = list() @@ -269,6 +279,7 @@ SUBSYSTEM_DEF(who) admin["content"] = "[entry.key] ([rank])" admin["text"] = "" + minimum_admins += list(admin.Copy()) if(entry.admin_holder?.fakekey) admin["text"] += " (HIDDEN)" @@ -291,6 +302,13 @@ SUBSYSTEM_DEF(who) admins += list(admin) new_list_data["administrators"] += list(list( + "category" = category, + "category_color" = category_colors[category], + "category_administrators" = length(listings[category]), + "admins" = minimum_admins, + )) + + new_list_admin_data["administrators"] += list(list( "category" = category, "category_color" = category_colors[category], "category_administrators" = length(listings[category]), @@ -298,6 +316,7 @@ SUBSYSTEM_DEF(who) )) list_data = new_list_data + list_admin_data = new_list_admin_data /mob/verb/who() set category = "OOC" From 9988feeefbd80a308a959e1713a8b5a8eba695a2 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 25 Jul 2024 00:54:33 +0500 Subject: [PATCH 02/34] hold on --- code/controllers/subsystem/who.dm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 225212783682..32b6adb53097 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -202,16 +202,12 @@ SUBSYSTEM_DEF(who) ui.set_autoupdate(TRUE) /datum/player_list/ui_data(mob/user) - if(CLIENT_IS_STAFF(user.client)) + .["admin"] = CLIENT_IS_STAFF(user.client) + if(.["admin"]) . = list_admin_data else . = list_data -/datum/player_list/ui_static_data(mob/user) - . = list() - - .["admin"] = CLIENT_IS_STAFF(user.client) - /datum/player_list/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) . = ..() if(.) From 6de3959d77405e69c16bf31dd02948fef5447d7b Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 25 Jul 2024 00:58:03 +0500 Subject: [PATCH 03/34] mmeh --- code/controllers/subsystem/who.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 32b6adb53097..710a9bc873d8 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -202,11 +202,13 @@ SUBSYSTEM_DEF(who) ui.set_autoupdate(TRUE) /datum/player_list/ui_data(mob/user) - .["admin"] = CLIENT_IS_STAFF(user.client) - if(.["admin"]) + . = list() + var/admin = CLIENT_IS_STAFF(user.client) + if(admin) . = list_admin_data else . = list_data + .["admin"] = admin /datum/player_list/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) . = ..() From 959cfc9dfdd8882152026259a1a641b7adcac428 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 25 Jul 2024 00:58:14 +0500 Subject: [PATCH 04/34] meh --- code/controllers/subsystem/who.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 710a9bc873d8..8c49a1f5959d 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -202,7 +202,6 @@ SUBSYSTEM_DEF(who) ui.set_autoupdate(TRUE) /datum/player_list/ui_data(mob/user) - . = list() var/admin = CLIENT_IS_STAFF(user.client) if(admin) . = list_admin_data From 0e0fd2e0676701324f2940f6e3e0d7a40626462a Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 25 Jul 2024 01:00:00 +0500 Subject: [PATCH 05/34] Meh, I forgot somethingg, yea, this is not going to work like I think... and creating new lists for every player... meh... messing around, NO --- code/controllers/subsystem/who.dm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 8c49a1f5959d..f6200f9432c5 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -202,12 +202,14 @@ SUBSYSTEM_DEF(who) ui.set_autoupdate(TRUE) /datum/player_list/ui_data(mob/user) - var/admin = CLIENT_IS_STAFF(user.client) - if(admin) + if(CLIENT_IS_STAFF(user.client)) . = list_admin_data else . = list_data - .["admin"] = admin + +/datum/player_list/ui_static_data(mob/user) + . = list() + .["admin"] = CLIENT_IS_STAFF(user.client) /datum/player_list/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) . = ..() From 79af612a6955102ebf43f54fe2de1f227689e3c1 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 25 Jul 2024 07:43:36 +0500 Subject: [PATCH 06/34] meh, shizoprenia midnight suggested me to do this --- code/controllers/subsystem/who.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index f6200f9432c5..7ae29e03bef6 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -190,7 +190,9 @@ SUBSYSTEM_DEF(who) "text" = "Queen: [hive.living_xeno_queen ? "Alive" : "Dead"]", )) + new_list_data["admin"] = FALSE list_data = new_list_data + new_list_admin_data["admin"] = TRUE list_admin_data = new_list_admin_data mobs_ckey = new_mobs_ckey @@ -207,10 +209,6 @@ SUBSYSTEM_DEF(who) else . = list_data -/datum/player_list/ui_static_data(mob/user) - . = list() - .["admin"] = CLIENT_IS_STAFF(user.client) - /datum/player_list/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) . = ..() if(.) @@ -314,7 +312,9 @@ SUBSYSTEM_DEF(who) "admins" = admins, )) + new_list_data["admin"] = FALSE list_data = new_list_data + new_list_admin_data["admin"] = TRUE list_admin_data = new_list_admin_data /mob/verb/who() From 7132bbc398548403bb2272b11169be534c309df3 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 03:34:47 +0500 Subject: [PATCH 07/34] fix --- code/controllers/subsystem/who.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 7ae29e03bef6..079c29afcaf6 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -217,7 +217,7 @@ SUBSYSTEM_DEF(who) switch(action) if("get_player_panel") if(mobs_ckey[params["ckey"]]) - GLOB.admin_datums[usr.client.ckey].show_player_panel(mobs_ckey[params["ckey"]]) + GLOB.admin_datums[ui.user.client.ckey].show_player_panel(mobs_ckey[params["ckey"]]) /datum/player_list/ui_status(mob/user, datum/ui_state/state) return UI_INTERACTIVE @@ -276,10 +276,11 @@ SUBSYSTEM_DEF(who) admin["content"] = "[entry.key] ([rank])" admin["text"] = "" - minimum_admins += list(admin.Copy()) if(entry.admin_holder?.fakekey) admin["text"] += " (HIDDEN)" + else + minimum_admins += list(admin.Copy()) if(istype(entry.mob, /mob/dead/observer)) admin["color"] = "#808080" From 633759d11ccd8c7baac2755e9ca2a29635fdf5e5 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 03:39:53 +0500 Subject: [PATCH 08/34] Why only I like hard refs? Okay no refs at all then. --- code/controllers/subsystem/who.dm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 079c29afcaf6..e548de1e563d 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -21,7 +21,6 @@ SUBSYSTEM_DEF(who) /datum/player_list var/tgui_name = "Who" var/tgui_interface_name = "Who" - var/list/mobs_ckey = list() var/list/list_data = list() var/list/list_admin_data = list() @@ -194,7 +193,6 @@ SUBSYSTEM_DEF(who) list_data = new_list_data new_list_admin_data["admin"] = TRUE list_admin_data = new_list_admin_data - mobs_ckey = new_mobs_ckey /datum/player_list/tgui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -216,8 +214,12 @@ SUBSYSTEM_DEF(who) switch(action) if("get_player_panel") - if(mobs_ckey[params["ckey"]]) - GLOB.admin_datums[ui.user.client.ckey].show_player_panel(mobs_ckey[params["ckey"]]) + var/chosen_ckey = params["ckey"] + for(var/client/target in GLOB.clients) + if(target.ckey != chosen_ckey) + continue + if(target.mob) + GLOB.admin_datums[ui.user.client.ckey].show_player_panel(target.mob) /datum/player_list/ui_status(mob/user, datum/ui_state/state) return UI_INTERACTIVE @@ -238,7 +240,6 @@ SUBSYSTEM_DEF(who) /datum/player_list/staff/update_data() var/list/new_list_data = list() var/list/new_list_admin_data = list() - mobs_ckey = list() var/list/listings var/list/mappings From 221afe9a8e0b9be9951bcabf19f57e4bc87c8ba1 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 03:40:18 +0500 Subject: [PATCH 09/34] BREAK BREAK, TO FAST --- code/controllers/subsystem/who.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index e548de1e563d..1d18e5b1f023 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -220,6 +220,7 @@ SUBSYSTEM_DEF(who) continue if(target.mob) GLOB.admin_datums[ui.user.client.ckey].show_player_panel(target.mob) + break /datum/player_list/ui_status(mob/user, datum/ui_state/state) return UI_INTERACTIVE From 1ab19b6bf3f6d832d30d4a8818e51cf2908b7469 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 03:40:37 +0500 Subject: [PATCH 10/34] break in case if no mob linked to client --- code/controllers/subsystem/who.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 1d18e5b1f023..5e54ebede316 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -220,7 +220,7 @@ SUBSYSTEM_DEF(who) continue if(target.mob) GLOB.admin_datums[ui.user.client.ckey].show_player_panel(target.mob) - break + break /datum/player_list/ui_status(mob/user, datum/ui_state/state) return UI_INTERACTIVE From 47d170ff20d5942ac0ceb10320c1ddd560289a87 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 03:43:31 +0500 Subject: [PATCH 11/34] f --- code/controllers/subsystem/who.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 5e54ebede316..36229700efda 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -51,7 +51,6 @@ SUBSYSTEM_DEF(who) client_payload["ckey_color"] = "white" new_list_data["total_players"] += list(client_payload.Copy()) var/mob/client_mob = client.mob - new_mobs_ckey[client.key] = client_mob if(client_mob) if(istype(client_mob, /mob/new_player)) client_payload["text"] += " - in Lobby" @@ -216,7 +215,7 @@ SUBSYSTEM_DEF(who) if("get_player_panel") var/chosen_ckey = params["ckey"] for(var/client/target in GLOB.clients) - if(target.ckey != chosen_ckey) + if(target.key != chosen_ckey) continue if(target.mob) GLOB.admin_datums[ui.user.client.ckey].show_player_panel(target.mob) From c0174c52e28c568dbcce33829899e98ba6b3776b Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 03:43:44 +0500 Subject: [PATCH 12/34] d --- code/controllers/subsystem/who.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 36229700efda..75bbe6efa340 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -27,7 +27,6 @@ SUBSYSTEM_DEF(who) /datum/player_list/proc/update_data() var/list/new_list_data = list() var/list/new_list_admin_data = list() - var/list/new_mobs_ckey = list() var/list/additional_data = list( "lobby" = 0, "admin_observers" = 0, From c0460c2cf9f2771a3cc04f565b86b108a6c141aa Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 17:05:29 +0500 Subject: [PATCH 13/34] fix --- code/controllers/subsystem/who.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 75bbe6efa340..4782b5bb1ae4 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -302,14 +302,14 @@ SUBSYSTEM_DEF(who) new_list_data["administrators"] += list(list( "category" = category, "category_color" = category_colors[category], - "category_administrators" = length(listings[category]), + "category_administrators" = length(minimum_admins), "admins" = minimum_admins, )) new_list_admin_data["administrators"] += list(list( "category" = category, "category_color" = category_colors[category], - "category_administrators" = length(listings[category]), + "category_administrators" = length(admins), "admins" = admins, )) From 17f76ce2e0b5f49866bb1bca0498a43f139906e3 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 17:06:50 +0500 Subject: [PATCH 14/34] f --- code/controllers/subsystem/who.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 4782b5bb1ae4..cf2f0e1034e3 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -277,7 +277,7 @@ SUBSYSTEM_DEF(who) admin["content"] = "[entry.key] ([rank])" admin["text"] = "" - if(entry.admin_holder?.fakekey) + if(entry.admin_holder?.fakekey || CLIENT_IS_STEALTHED(entry)) admin["text"] += " (HIDDEN)" else minimum_admins += list(admin.Copy()) From 18919246bb1104ca68f6f6a96ef669652697c967 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 17:07:48 +0500 Subject: [PATCH 15/34] s --- code/controllers/subsystem/who.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index cf2f0e1034e3..9cab72922324 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -277,7 +277,9 @@ SUBSYSTEM_DEF(who) admin["content"] = "[entry.key] ([rank])" admin["text"] = "" - if(entry.admin_holder?.fakekey || CLIENT_IS_STEALTHED(entry)) + if(CLIENT_IS_STEALTHED(entry)) + continue + else if(entry.admin_holder?.fakekey) admin["text"] += " (HIDDEN)" else minimum_admins += list(admin.Copy()) From 2921bad973e0bf0f6674bcb09d5ac697f2b79930 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 17:08:24 +0500 Subject: [PATCH 16/34] f --- code/controllers/subsystem/who.dm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 9cab72922324..478ed5261076 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -277,9 +277,7 @@ SUBSYSTEM_DEF(who) admin["content"] = "[entry.key] ([rank])" admin["text"] = "" - if(CLIENT_IS_STEALTHED(entry)) - continue - else if(entry.admin_holder?.fakekey) + if(entry.admin_holder?.fakekey || CLIENT_IS_STEALTHED(C)) admin["text"] += " (HIDDEN)" else minimum_admins += list(admin.Copy()) From b7830102e9f0f5ed4a557496daf9f44c57e1d44a Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 17:08:35 +0500 Subject: [PATCH 17/34] f --- code/controllers/subsystem/who.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 478ed5261076..cf2f0e1034e3 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -277,7 +277,7 @@ SUBSYSTEM_DEF(who) admin["content"] = "[entry.key] ([rank])" admin["text"] = "" - if(entry.admin_holder?.fakekey || CLIENT_IS_STEALTHED(C)) + if(entry.admin_holder?.fakekey || CLIENT_IS_STEALTHED(entry)) admin["text"] += " (HIDDEN)" else minimum_admins += list(admin.Copy()) From 81366d4515a347823ebda036c77073fa463eeb4a Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 18:22:02 +0500 Subject: [PATCH 18/34] f --- code/controllers/subsystem/who.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index cf2f0e1034e3..304752ee90d7 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -277,9 +277,9 @@ SUBSYSTEM_DEF(who) admin["content"] = "[entry.key] ([rank])" admin["text"] = "" - if(entry.admin_holder?.fakekey || CLIENT_IS_STEALTHED(entry)) + if(entry.admin_holder?.fakekey) admin["text"] += " (HIDDEN)" - else + else if(!CLIENT_IS_STEALTHED(entry)) minimum_admins += list(admin.Copy()) if(istype(entry.mob, /mob/dead/observer)) From 0f6e5a3717b121369b49f674a4e97f3349d4d820 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 28 Jul 2024 19:40:35 +0500 Subject: [PATCH 19/34] shizoprenia, or bidone after joover? --- code/controllers/subsystem/who.dm | 9 +++++++ tgui/packages/tgui/interfaces/StaffWho.jsx | 30 ++++++++++++++-------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 304752ee90d7..ff399364b902 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -267,6 +267,7 @@ SUBSYSTEM_DEF(who) for(var/category in listings) var/list/minimum_admins = list() var/list/admins = list() + var/stealthed = 0 for(var/client/entry as anything in listings[category]) var/list/admin = list() var/rank = entry.admin_holder.rank @@ -281,6 +282,9 @@ SUBSYSTEM_DEF(who) admin["text"] += " (HIDDEN)" else if(!CLIENT_IS_STEALTHED(entry)) minimum_admins += list(admin.Copy()) + else + stealthed++ + admin["stealthed"] = TRUE if(istype(entry.mob, /mob/dead/observer)) admin["color"] = "#808080" @@ -310,6 +314,7 @@ SUBSYSTEM_DEF(who) "category" = category, "category_color" = category_colors[category], "category_administrators" = length(admins), + "stealthed" = stealthed, "admins" = admins, )) @@ -318,6 +323,10 @@ SUBSYSTEM_DEF(who) new_list_admin_data["admin"] = TRUE list_admin_data = new_list_admin_data +/datum/player_list/staff/ui_static_data(mob/user) + . = list() + .["r_stealth"] = CLIENT_HAS_RIGHTS(user.client, R_STEALTH) + /mob/verb/who() set category = "OOC" set name = "Who" diff --git a/tgui/packages/tgui/interfaces/StaffWho.jsx b/tgui/packages/tgui/interfaces/StaffWho.jsx index 1ce71c9b5001..84568cca9032 100644 --- a/tgui/packages/tgui/interfaces/StaffWho.jsx +++ b/tgui/packages/tgui/interfaces/StaffWho.jsx @@ -4,7 +4,7 @@ import { Window } from '../layouts'; export const StaffWho = (props, context) => { const { data } = useBackend(context); - const { admin, administrators } = data; + const { admin, r_stealth, administrators } = data; return ( @@ -15,18 +15,26 @@ export const StaffWho = (props, context) => { {administrators.map((x, index) => ( - {x.admins.map((x, index) => ( - - ))} + {x.admins.map((x, index) => + (r_stealth && x.stealthed) || !x.stealthed ? ( + + ) : null, + )} ))} From 29901a68eca54b83fff551a191224b573cc469d2 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Tue, 30 Jul 2024 10:11:32 +0500 Subject: [PATCH 20/34] =?UTF-8?q?=D0=A2=D1=8F=D0=B6=D0=B5=D0=BB=D0=BE,=20?= =?UTF-8?q?=D1=82=D1=8F=D0=B6=D0=B5=D0=BB=D0=BE...=20fr...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/controllers/subsystem/who.dm | 297 +++++++++------------ tgui/packages/tgui/interfaces/StaffWho.jsx | 189 ++++++++++--- tgui/packages/tgui/interfaces/Who.jsx | 169 +++++++----- 3 files changed, 370 insertions(+), 285 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index ff399364b902..7bd08e88a45c 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -17,17 +17,29 @@ SUBSYSTEM_DEF(who) who.update_data() staff_who.update_data() -//datum + + +// WHO DATA /datum/player_list var/tgui_name = "Who" var/tgui_interface_name = "Who" - var/list/list_data = list() - var/list/list_admin_data = list() + var/list/base_data = list() + var/list/admin_sorted_additional = list() /datum/player_list/proc/update_data() - var/list/new_list_data = list() - var/list/new_list_admin_data = list() - var/list/additional_data = list( + var/list/base_data = list() + var/list/admin_sorted_additional = list() + + var/list/factions_additional = list() + admin_sorted_additional["factions_additional"] = list("flags" = R_ADMIN, "data" = factions_additional) + + var/list/player_additional = list() + admin_sorted_additional["player_additional"] = list("flags" = R_ADMIN, "data" = player_additional) + + var/list/player_stealthed_additional = list() + admin_sorted_additional["player_stealthed_additional"] = list("flags" = R_STEALTH, "data" = player_stealthed_additional) + + var/list/counted_additional = list( "lobby" = 0, "admin_observers" = 0, "observers" = 0, @@ -38,36 +50,38 @@ SUBSYSTEM_DEF(who) "uscm" = 0, "uscm_marines" = 0, ) - new_list_admin_data["additional_info"] = list() var/list/counted_factions = list() + + // Running thru all clients and doing some counts for(var/client/client as anything in sortTim(GLOB.clients, GLOBAL_PROC_REF(cmp_ckey_asc))) - CHECK_TICK - new_list_data["all_clients"]++ - new_list_admin_data["all_clients"]++ var/list/client_payload = list() - client_payload["ckey"] = "[client.key]" - client_payload["text"] = "[client.key]" + client_payload["text"] = client.key client_payload["ckey_color"] = "white" - new_list_data["total_players"] += list(client_payload.Copy()) + if(!CLIENT_IS_STEALTHED(client)) + base_data["total_players"] += list(list(client.key = list(client_payload.Copy()))) + player_additional["total_players"] += list(list(client.key = list(client_payload))) + else + player_stealthed_additional["total_players"] += list(list(client.key = list(client_payload))) + var/mob/client_mob = client.mob if(client_mob) if(istype(client_mob, /mob/new_player)) client_payload["text"] += " - in Lobby" - additional_data["lobby"]++ + counted_additional["lobby"]++ else if(isobserver(client_mob)) client_payload["text"] += " - Playing as [client_mob.real_name]" if(CLIENT_IS_STAFF(client)) - additional_data["admin_observers"]++ + counted_additional["admin_observers"]++ else - additional_data["observers"]++ + counted_additional["observers"]++ var/mob/dead/observer/observer = client_mob if(observer.started_as_observer) - client_payload["color"] += "#ce89cd" + client_payload["color"] = "#ce89cd" client_payload["text"] += " - Spectating" else - client_payload["color"] += "#A000D0" + client_payload["color"] = "#A000D0" client_payload["text"] += " - DEAD" else @@ -75,122 +89,66 @@ SUBSYSTEM_DEF(who) switch(client_mob.stat) if(UNCONSCIOUS) - client_payload["color"] += "#B0B0B0" + client_payload["color"] = "#B0B0B0" client_payload["text"] += " - Unconscious" if(DEAD) - client_payload["color"] += "#A000D0" + client_payload["color"] = "#A000D0" client_payload["text"] += " - DEAD" if(client_mob.stat != DEAD) if(isxeno(client_mob)) - client_payload["color"] += "#ec3535" + client_payload["color"] = "#ec3535" client_payload["text"] += " - Xenomorph" else if(ishuman(client_mob)) if(client_mob.faction == FACTION_ZOMBIE) counted_factions[FACTION_ZOMBIE]++ - client_payload["color"] += "#2DACB1" + client_payload["color"] = "#2DACB1" client_payload["text"] += " - Zombie" else if(client_mob.faction == FACTION_YAUTJA) - client_payload["color"] += "#7ABA19" + client_payload["color"] = "#7ABA19" client_payload["text"] += " - Yautja" - additional_data["yautja"]++ + counted_additional["yautja"]++ if(client_mob.status_flags & XENO_HOST) - additional_data["infected_preds"]++ + counted_additional["infected_preds"]++ else - additional_data["humans"]++ + counted_additional["humans"]++ if(client_mob.status_flags & XENO_HOST) - additional_data["infected_humans"]++ + counted_additional["infected_humans"]++ if(client_mob.faction == FACTION_MARINE) - additional_data["uscm"]++ + counted_additional["uscm"]++ if(client_mob.job in (GLOB.ROLES_MARINES)) - additional_data["uscm_marines"]++ + counted_additional["uscm_marines"]++ else counted_factions[client_mob.faction]++ - new_list_admin_data["total_players"] += list(client_payload) - - new_list_admin_data["additional_info"] += list(list( - "content" = "In Lobby: [additional_data["lobby"]]", - "color" = "#777", - "text" = "Player in lobby", - )) - - new_list_admin_data["additional_info"] += list(list( - "content" = "Spectating Players: [additional_data["observers"]]", - "color" = "#777", - "text" = "Spectating players", - )) - - new_list_admin_data["additional_info"] += list(list( - "content" = "Spectating Admins: [additional_data["admin_observers"]]", - "color" = "#777", - "text" = "Spectating administrators", - )) - - new_list_admin_data["additional_info"] += list(list( - "content" = "Humans: [additional_data["humans"]]", - "color" = "#2C7EFF", - "text" = "Players playing as Human", - )) - - new_list_admin_data["additional_info"] += list(list( - "content" = "Infected Humans: [additional_data["infected_humans"]]", - "color" = "#ec3535", - "text" = "Players playing as Infected Human", - )) - - new_list_admin_data["additional_info"] += list(list( - "content" = "[MAIN_SHIP_NAME] Personnel: [additional_data["uscm"]]", - "color" = "#5442bd", - "text" = "Players playing as [MAIN_SHIP_NAME] Personnel", - )) - - new_list_admin_data["additional_info"] += list(list( - "content" = "Marines: [additional_data["uscm_marines"]]", - "color" = "#5442bd", - "text" = "Players playing as Marines", - )) - - new_list_admin_data["additional_info"] += list(list( - "content" = "Yautjas: [additional_data["yautja"]]", - "color" = "#7ABA19", - "text" = "Players playing as Yautja", - )) - - new_list_admin_data["additional_info"] += list(list( - "content" = "Infected Predators: [additional_data["infected_preds"]]", - "color" = "#7ABA19", - "text" = "Players playing as Infected Yautja", - )) + //Bulky section with pre writen names and desc for counts + factions_additional += list(list("content" = "In Lobby: [counted_additional["lobby"]]", "color" = "#777", "text" = "Player in lobby")) + factions_additional += list(list("content" = "Spectating Players: [counted_additional["observers"]]", "color" = "#777", "text" = "Spectating players")) + factions_additional += list(list("content" = "Spectating Admins: [counted_additional["admin_observers"]]", "color" = "#777", "text" = "Spectating administrators")) + factions_additional += list(list("content" = "Humans: [counted_additional["humans"]]", "color" = "#2C7EFF", "text" = "Players playing as Human")) + factions_additional += list(list("content" = "Infected Humans: [counted_additional["infected_humans"]]", "color" = "#ec3535", "text" = "Players playing as Infected Human")) + factions_additional += list(list("content" = "[MAIN_SHIP_NAME] Personnel: [counted_additional["uscm"]]", "color" = "#5442bd", "text" = "Players playing as [MAIN_SHIP_NAME] Personnel")) + factions_additional += list(list("content" = "Marines: [counted_additional["uscm_marines"]]", "color" = "#5442bd", "text" = "Players playing as Marines")) + factions_additional += list(list("content" = "Yautjas: [counted_additional["yautja"]]", "color" = "#7ABA19", "text" = "Players playing as Yautja")) + factions_additional += list(list("content" = "Infected Predators: [counted_additional["infected_preds"]]", "color" = "#7ABA19", "text" = "Players playing as Infected Yautja")) for(var/i in 1 to length(counted_factions)) - if(counted_factions[counted_factions[i]]) - new_list_admin_data["factions"] += list(list( - "content" = "[counted_factions[i]]: [counted_factions[counted_factions[i]]]", - "color" = "#2C7EFF", - "text" = "Other", - )) + if(!counted_factions[counted_factions[i]]) + continue + factions_additional += list(list("content" = "[counted_factions[i]]: [counted_factions[counted_factions[i]]]", "color" = "#2C7EFF", "text" = "Other")) + if(counted_factions[FACTION_NEUTRAL]) - new_list_admin_data["factions"] += list(list( - "content" = "[FACTION_NEUTRAL] Humans: [counted_factions[FACTION_NEUTRAL]]", - "color" = "#688944", - "text" = "Neutrals", - )) + factions_additional += list(list("content" = "[FACTION_NEUTRAL] Humans: [counted_factions[FACTION_NEUTRAL]]", "color" = "#688944", "text" = "Neutrals")) for(var/faction_to_get in ALL_XENO_HIVES) var/datum/hive_status/hive = GLOB.hive_datum[faction_to_get] - if(hive && length(hive.totalXenos)) - new_list_admin_data["xenomorphs"] += list(list( - "content" = "[hive.name]: [length(hive.totalXenos)]", - "color" = hive.color ? hive.color : "#8200FF", - "text" = "Queen: [hive.living_xeno_queen ? "Alive" : "Dead"]", - )) - - new_list_data["admin"] = FALSE - list_data = new_list_data - new_list_admin_data["admin"] = TRUE - list_admin_data = new_list_admin_data + if(!hive || !length(hive.totalXenos)) + continue + factions_additional += list(list("content" = "[hive.name]: [length(hive.totalXenos)]", "color" = hive.color ? hive.color : "#8200FF", "text" = "Queen: [hive.living_xeno_queen ? "Alive" : "Dead"]")) + + src.base_data = base_data + src.admin_sorted_additional = admin_sorted_additional; var/static/list/ram_eater; for(var/list/i in base_data + admin_sorted_additional) { if(!islist(ram_eater)) {ram_eater = list();} ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy();} // Yam-Yam (https://tenor.com/view/sweaty-sweaty-speedrunner-tryhard-man-of-culture-gif-22725514) /datum/player_list/tgui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -200,10 +158,17 @@ SUBSYSTEM_DEF(who) ui.set_autoupdate(TRUE) /datum/player_list/ui_data(mob/user) - if(CLIENT_IS_STAFF(user.client)) - . = list_admin_data - else - . = list_data + . = list() + // Sending base client data, this data sended to EVERYONE + .["base_data"] = base_data + + // Admin rights based data + if(!CLIENT_IS_STAFF(user.client)) + return + for(var/data_packet_name in admin_sorted_additional) // One by one for Drulikar complains + if(!CLIENT_HAS_RIGHTS(user.client, admin_sorted_additional[data_packet_name]["flags"])) + continue + . += list("[data_packet_name]" = admin_sorted_additional[data_packet_name]["data"]) /datum/player_list/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) . = ..() @@ -212,6 +177,8 @@ SUBSYSTEM_DEF(who) switch(action) if("get_player_panel") + if(!CLIENT_IS_STAFF(ui.user.client)) + return var/chosen_ckey = params["ckey"] for(var/client/target in GLOB.clients) if(target.key != chosen_ckey) @@ -224,6 +191,7 @@ SUBSYSTEM_DEF(who) return UI_INTERACTIVE +// STAFF DATA /datum/player_list/staff tgui_name = "StaffWho" tgui_interface_name = "Staff Who" @@ -237,96 +205,77 @@ SUBSYSTEM_DEF(who) ) /datum/player_list/staff/update_data() - var/list/new_list_data = list() - var/list/new_list_admin_data = list() + var/list/base_data = list() + var/list/admin_sorted_additional = list() + + var/list/admin_additional = list() + admin_sorted_additional["admin_additional"] = list("flags" = R_ADMIN, "data" = admin_additional) + + var/list/admin_stealthed_additional = list() + admin_sorted_additional["admin_stealthed_additional"] = list("flags" = R_STEALTH, "data" = admin_stealthed_additional) - var/list/listings - var/list/mappings + var/list/listings = list() if(CONFIG_GET(flag/show_manager)) - LAZYSET(mappings, "Management", R_PERMISSIONS) + listings["Management"] = list(R_PERMISSIONS, list()) if(CONFIG_GET(flag/show_devs)) - LAZYSET(mappings, "Maintainers", R_PROFILER) - LAZYSET(mappings, "Administrators", R_ADMIN) + listings["Maintainers"] = list(R_PROFILER, list()) + listings["Administrators"] = list(R_ADMIN, list()) if(CONFIG_GET(flag/show_mods)) - LAZYSET(mappings, "Moderators", R_MOD && R_BAN) + listings["Moderators"] = list(R_MOD|R_BAN, list()) if(CONFIG_GET(flag/show_mentors)) - LAZYSET(mappings, "Mentors", R_MENTOR) - - for(var/category in mappings) - LAZYSET(listings, category, list()) + listings["Mentors"] = list(R_MENTOR, list()) for(var/client/client as anything in GLOB.admins) - if(client.admin_holder?.fakekey && !CLIENT_IS_STAFF(client)) - continue - - for(var/category in mappings) - if(CLIENT_HAS_RIGHTS(client, mappings[category])) - LAZYADD(listings[category], client) + for(var/category in listings) + if(CLIENT_HAS_RIGHTS(client, listings[category][1])) + listings[category][2] += client break for(var/category in listings) - var/list/minimum_admins = list() - var/list/admins = list() - var/stealthed = 0 - for(var/client/entry as anything in listings[category]) - var/list/admin = list() + base_data["categories"] += list(list( + "category" = category, + "category_color" = category_colors[category], + )) + + for(var/client/entry as anything in listings[category][2]) + var/list/admin_payload = list() + admin_payload["category"] = category var/rank = entry.admin_holder.rank if(entry.admin_holder.extra_titles?.len) for(var/srank in entry.admin_holder.extra_titles) rank += " & [srank]" - admin["content"] = "[entry.key] ([rank])" - admin["text"] = "" - - if(entry.admin_holder?.fakekey) - admin["text"] += " (HIDDEN)" - else if(!CLIENT_IS_STEALTHED(entry)) - minimum_admins += list(admin.Copy()) + if(CLIENT_IS_STEALTHED(entry)) + admin_payload["special_color"] = "#b60d0d" + admin_payload["special_text"] = " (STEALTHED)" + admin_stealthed_additional["total_admins"] += list(list("[entry.key] ([rank])" = list(admin_payload))) + else if(entry.admin_holder?.fakekey) + admin_payload["special_text"] += " (HIDDEN)" + admin_additional["total_admins"] += list(list("[entry.key] ([rank])" = list(admin_payload))) else - stealthed++ - admin["stealthed"] = TRUE + base_data["total_admins"] += list(list("[entry.key] ([rank])" = list(admin_payload.Copy()))) + admin_payload["text"] = "" if(istype(entry.mob, /mob/dead/observer)) - admin["color"] = "#808080" - admin["text"] += " Spectating" + admin_payload["color"] = "#808080" + admin_payload["text"] += "Spectating" else if(istype(entry.mob, /mob/new_player)) - admin["color"] = "#688944" - admin["text"] += " in Lobby" + admin_payload["color"] = "#688944" + admin_payload["text"] += "in Lobby" else - admin["color"] = "#688944" - admin["text"] += " Playing" + admin_payload["color"] = "#688944" + admin_payload["text"] += "Playing" if(entry.is_afk()) - admin["color"] = "#A040D0" - admin["text"] += " (AFK)" - - admins += list(admin) + admin_payload["color"] = "#A040D0" + admin_payload["special_text"] += " (AFK)" - new_list_data["administrators"] += list(list( - "category" = category, - "category_color" = category_colors[category], - "category_administrators" = length(minimum_admins), - "admins" = minimum_admins, - )) + src.base_data = base_data + src.admin_sorted_additional = admin_sorted_additional - new_list_admin_data["administrators"] += list(list( - "category" = category, - "category_color" = category_colors[category], - "category_administrators" = length(admins), - "stealthed" = stealthed, - "admins" = admins, - )) - - new_list_data["admin"] = FALSE - list_data = new_list_data - new_list_admin_data["admin"] = TRUE - list_admin_data = new_list_admin_data - -/datum/player_list/staff/ui_static_data(mob/user) - . = list() - .["r_stealth"] = CLIENT_HAS_RIGHTS(user.client, R_STEALTH) +// VERBS /mob/verb/who() set category = "OOC" set name = "Who" diff --git a/tgui/packages/tgui/interfaces/StaffWho.jsx b/tgui/packages/tgui/interfaces/StaffWho.jsx index 84568cca9032..2ab80f262824 100644 --- a/tgui/packages/tgui/interfaces/StaffWho.jsx +++ b/tgui/packages/tgui/interfaces/StaffWho.jsx @@ -4,39 +4,24 @@ import { Window } from '../layouts'; export const StaffWho = (props, context) => { const { data } = useBackend(context); - const { admin, r_stealth, administrators } = data; + const { base_data, admin_additional, admin_stealthed_additional } = data; + + const total_admins = mergeArrays( + base_data.total_admins, + admin_additional.total_admins, + admin_stealthed_additional.total_admins, + ); return ( - {administrators !== undefined ? ( + {base_data ? ( - {administrators.map((x, index) => ( - - {x.admins.map((x, index) => - (r_stealth && x.stealthed) || !x.stealthed ? ( - - ) : null, - )} - - ))} + ) : null} @@ -45,7 +30,26 @@ export const StaffWho = (props, context) => { ); }; +const FilterCategories = (props, context) => { + const { act } = useBackend(context); + const { categories, total_admins } = props; + + return categories.map((category) => { + const category_admins = total_admins.filter((adminObj) => + isMatch(adminObj, category.category), + ); + return ( + + ); + }); +}; + const StaffWhoCollapsible = (props, context) => { + const { act } = useBackend(context); const { title, color, children } = props; return ( @@ -54,33 +58,130 @@ const StaffWhoCollapsible = (props, context) => { ); }; +const CategoryDropDown = (props, context) => { + const { act } = useBackend(context); + const { category, category_admins } = props; + return ( + + + + ); +}; + +const FilterAdmins = (props, context) => { + const { act } = useBackend(context); + const { category_admins } = props; + + return category_admins.map((x) => { + const ckey = Object.keys(x)[0]; + const params = x[ckey]; + const extractedParams = {}; + params.forEach((param) => { + Object.keys(param).forEach((key) => { + extractedParams[key] = param[key]; + }); + }); + return ; + }); +}; + const GetAdminInfo = (props, context) => { - const { admin, content, color, text } = props; - return admin ? ( + const { act } = useBackend(context); + const { ckey, special_color, special_text, text, color } = props; + return ( - ) : ( - ); }; + +const isMatch = (adminObj, search) => { + if (!search) { + return true; + } + + let found = false; + const adminKey = Object.keys(adminObj)[0]; + const params = adminObj[adminKey]; + params.forEach((param) => { + if (found) { + return; + } + Object.keys(param).forEach((key) => { + if (param[key] === search) { + found = true; + return; + } + }); + }); + return found; +}; + +// Krill me please +const mergeArrays = (...arrays) => { + const mergedObject = {}; + + arrays.forEach((array) => { + if (!array) { + return; + } + + array.forEach((item) => { + if (!item) { + return; + } + + const key = Object.keys(item)[0]; + const value = item[key]; + + if (!mergedObject[key]) { + mergedObject[key] = []; + } + + value.forEach((subItem) => { + if (!subItem) { + return; + } + + const subKey = Object.keys(subItem)[0]; + const subValue = subItem[subKey]; + + const existingItem = mergedObject[key].find( + (funny_value) => Object.keys(funny_value)[0] === subKey, + ); + + if (existingItem) { + existingItem[subKey] = subValue; + } else { + mergedObject[key].push({ [subKey]: subValue }); + } + }); + }); + }); + + return Object.keys(mergedObject).map((key) => ({ [key]: mergedObject[key] })); +}; diff --git a/tgui/packages/tgui/interfaces/Who.jsx b/tgui/packages/tgui/interfaces/Who.jsx index dccf3d1e39f0..8f88d4db5754 100644 --- a/tgui/packages/tgui/interfaces/Who.jsx +++ b/tgui/packages/tgui/interfaces/Who.jsx @@ -13,18 +13,26 @@ import { Window } from '../layouts'; export const Who = (props, context) => { const { act, data } = useBackend(context); const { - admin, - all_clients, - total_players = [], - additional_info = [], - factions = [], - xenomorphs = [], + base_data, + player_additional, + player_stealthed_additional, + factions_additional, } = data; + const total_players = mergeArrays( + base_data.total_players, + player_additional.total_players, + player_stealthed_additional.total_players, + ); + + if (!total_players || !Array.isArray(total_players)) { + return ; + } + const [searchQuery, setSearchQuery] = useLocalState('searchQuery', ''); const searchPlayers = () => - total_players.filter((player) => isMatch(player, searchQuery)); + total_players.filter((playerObj) => isMatch(playerObj, searchQuery)); const filteredTotalPlayers = searchPlayers(); @@ -44,7 +52,7 @@ export const Who = (props, context) => { fluid onEnter={(e, value) => act('get_player_panel', { - ckey: searchPlayers()?.[0].ckey, + ckey: searchPlayers()?.[0][0], }) } onInput={(e) => setSearchQuery(e.target.value)} @@ -57,50 +65,29 @@ export const Who = (props, context) => {
- + {filteredTotalPlayers.length ? ( - {filteredTotalPlayers.map((x) => ( - - ))} + ) : null}
- {admin !== 0 ? ( + {factions_additional.length ? (
- {additional_info.length - ? additional_info.map((x, index) => ( - - )) - : null} - {factions.length - ? factions.map((x, index) => ( - - )) - : null} - {xenomorphs.length - ? xenomorphs.map((x, index) => ( - - )) - : null} + {factions_additional.map((x, index) => ( + + ))}
@@ -113,6 +100,7 @@ export const Who = (props, context) => { }; const WhoCollapsible = (props, context) => { + const { act } = useBackend(context); const { title, color, children } = props; return ( @@ -142,48 +130,95 @@ const GetAddInfo = (props, context) => { ); }; +const FilterPlayers = (props, context) => { + const { act } = useBackend(context); + const { players_to_filter } = props; + + return players_to_filter.map((x) => { + const ckey = Object.keys(x)[0]; + const params = x[ckey]; + const extractedParams = {}; + params.forEach((param) => { + Object.keys(param).forEach((key) => { + extractedParams[key] = param[key]; + }); + }); + return ; + }); +}; + const GetPlayerInfo = (props, context) => { const { act } = useBackend(context); - const { - admin, - player: { ckey, ckey_color, color, text }, - } = props; - return admin !== 0 ? ( + const { ckey, text, ckey_color, color } = props; + + return ( - ) : ( - ); }; -const isMatch = (player, searchQuery) => { +const isMatch = (playerObj, searchQuery) => { if (!searchQuery) { return true; } - return ( - player.ckey.toLowerCase().includes(searchQuery?.toLowerCase()) || false - ); + const key = Object.keys(playerObj)[0]; + return key.toLowerCase().includes(searchQuery?.toLowerCase()) || false; +}; + +// Krill me please +const mergeArrays = (...arrays) => { + const mergedObject = {}; + + arrays.forEach((array) => { + if (!array) { + return; + } + + array.forEach((item) => { + if (!item) { + return; + } + + const key = Object.keys(item)[0]; + const value = item[key]; + + if (!mergedObject[key]) { + mergedObject[key] = []; + } + + value.forEach((subItem) => { + if (!subItem) { + return; + } + + const subKey = Object.keys(subItem)[0]; + const subValue = subItem[subKey]; + + const existingItem = mergedObject[key].find( + (funny_value) => Object.keys(funny_value)[0] === subKey, + ); + + if (existingItem) { + existingItem[subKey] = subValue; + } else { + mergedObject[key].push({ [subKey]: subValue }); + } + }); + }); + }); + + return Object.keys(mergedObject).map((key) => ({ [key]: mergedObject[key] })); }; From e6ebd8701b79208753ff71fd2ce99ac1a5b5ec5e Mon Sep 17 00:00:00 2001 From: Deleted user Date: Tue, 30 Jul 2024 10:13:14 +0500 Subject: [PATCH 21/34] funny ram eater not working XD I did something wrong --- code/controllers/subsystem/who.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 7bd08e88a45c..b1b9c931044f 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -148,7 +148,7 @@ SUBSYSTEM_DEF(who) factions_additional += list(list("content" = "[hive.name]: [length(hive.totalXenos)]", "color" = hive.color ? hive.color : "#8200FF", "text" = "Queen: [hive.living_xeno_queen ? "Alive" : "Dead"]")) src.base_data = base_data - src.admin_sorted_additional = admin_sorted_additional; var/static/list/ram_eater; for(var/list/i in base_data + admin_sorted_additional) { if(!islist(ram_eater)) {ram_eater = list();} ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy(); ram_eater += i.Copy();} // Yam-Yam (https://tenor.com/view/sweaty-sweaty-speedrunner-tryhard-man-of-culture-gif-22725514) + src.admin_sorted_additional = admin_sorted_additional /datum/player_list/tgui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) From 5934378031f55512634412434f58b9b57bf99347 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Tue, 30 Jul 2024 10:14:54 +0500 Subject: [PATCH 22/34] f --- code/controllers/subsystem/who.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index b1b9c931044f..8f0221f02085 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -253,6 +253,7 @@ SUBSYSTEM_DEF(who) admin_payload["special_text"] += " (HIDDEN)" admin_additional["total_admins"] += list(list("[entry.key] ([rank])" = list(admin_payload))) else + admin_additional["total_admins"] += list(list("[entry.key] ([rank])" = list(admin_payload))) base_data["total_admins"] += list(list("[entry.key] ([rank])" = list(admin_payload.Copy()))) admin_payload["text"] = "" From 5c7b808661489a4ff5120b29a0ce3d5aacfde2d1 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Tue, 30 Jul 2024 10:25:16 +0500 Subject: [PATCH 23/34] f --- tgui/packages/tgui/interfaces/StaffWho.jsx | 4 ++-- tgui/packages/tgui/interfaces/Who.jsx | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tgui/packages/tgui/interfaces/StaffWho.jsx b/tgui/packages/tgui/interfaces/StaffWho.jsx index 2ab80f262824..219cb18f0577 100644 --- a/tgui/packages/tgui/interfaces/StaffWho.jsx +++ b/tgui/packages/tgui/interfaces/StaffWho.jsx @@ -8,8 +8,8 @@ export const StaffWho = (props, context) => { const total_admins = mergeArrays( base_data.total_admins, - admin_additional.total_admins, - admin_stealthed_additional.total_admins, + admin_additional?.total_admins, + admin_stealthed_additional?.total_admins, ); return ( diff --git a/tgui/packages/tgui/interfaces/Who.jsx b/tgui/packages/tgui/interfaces/Who.jsx index 8f88d4db5754..85ca09a6ca08 100644 --- a/tgui/packages/tgui/interfaces/Who.jsx +++ b/tgui/packages/tgui/interfaces/Who.jsx @@ -21,14 +21,10 @@ export const Who = (props, context) => { const total_players = mergeArrays( base_data.total_players, - player_additional.total_players, - player_stealthed_additional.total_players, + player_additional?.total_players, + player_stealthed_additional?.total_players, ); - if (!total_players || !Array.isArray(total_players)) { - return ; - } - const [searchQuery, setSearchQuery] = useLocalState('searchQuery', ''); const searchPlayers = () => @@ -76,7 +72,7 @@ export const Who = (props, context) => { ) : null} - {factions_additional.length ? ( + {factions_additional ? (
From 04db92a1d3f9c3171706c0491af35e57e061824f Mon Sep 17 00:00:00 2001 From: Deleted user Date: Tue, 30 Jul 2024 10:59:20 +0500 Subject: [PATCH 24/34] FRFRFRFRRFFRFRFRFR --- tgui/packages/tgui/interfaces/Who.jsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tgui/packages/tgui/interfaces/Who.jsx b/tgui/packages/tgui/interfaces/Who.jsx index 85ca09a6ca08..6c13672ac6f7 100644 --- a/tgui/packages/tgui/interfaces/Who.jsx +++ b/tgui/packages/tgui/interfaces/Who.jsx @@ -60,18 +60,18 @@ export const Who = (props, context) => {
-
- - {filteredTotalPlayers.length ? ( + {filteredTotalPlayers ? ( +
+ - ) : null} - -
+
+
+ ) : null} {factions_additional ? (
From c3cfeada4b1b4d7f94447f27efa2f618eab5e9be Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 4 Aug 2024 02:15:47 +0500 Subject: [PATCH 25/34] govnokoding at night --- tgui/packages/tgui/interfaces/StaffWho.jsx | 61 ++++++----------- tgui/packages/tgui/interfaces/Who.jsx | 80 +++++++++------------- 2 files changed, 54 insertions(+), 87 deletions(-) diff --git a/tgui/packages/tgui/interfaces/StaffWho.jsx b/tgui/packages/tgui/interfaces/StaffWho.jsx index 219cb18f0577..845707af43c0 100644 --- a/tgui/packages/tgui/interfaces/StaffWho.jsx +++ b/tgui/packages/tgui/interfaces/StaffWho.jsx @@ -31,7 +31,6 @@ export const StaffWho = (props, context) => { }; const FilterCategories = (props, context) => { - const { act } = useBackend(context); const { categories, total_admins } = props; return categories.map((category) => { @@ -49,7 +48,6 @@ const FilterCategories = (props, context) => { }; const StaffWhoCollapsible = (props, context) => { - const { act } = useBackend(context); const { title, color, children } = props; return ( @@ -59,11 +57,10 @@ const StaffWhoCollapsible = (props, context) => { }; const CategoryDropDown = (props, context) => { - const { act } = useBackend(context); const { category, category_admins } = props; return ( @@ -72,44 +69,31 @@ const CategoryDropDown = (props, context) => { }; const FilterAdmins = (props, context) => { - const { act } = useBackend(context); const { category_admins } = props; - return category_admins.map((x) => { - const ckey = Object.keys(x)[0]; - const params = x[ckey]; - const extractedParams = {}; - params.forEach((param) => { - Object.keys(param).forEach((key) => { - extractedParams[key] = param[key]; - }); - }); - return ; + return category_admins.map((adminObj) => { + const ckey = Object.keys(adminObj)[0]; + return ; }); }; const GetAdminInfo = (props, context) => { - const { act } = useBackend(context); const { ckey, special_color, special_text, text, color } = props; return (
- {filteredTotalPlayers ? ( + {filteredTotalPlayers && (
{
- ) : null} - {factions_additional ? ( + )} + {factions_additional && (
@@ -87,7 +87,7 @@ export const Who = (props, context) => {
- ) : null} + )}
@@ -96,7 +96,6 @@ export const Who = (props, context) => { }; const WhoCollapsible = (props, context) => { - const { act } = useBackend(context); const { title, color, children } = props; return ( @@ -106,16 +105,15 @@ const WhoCollapsible = (props, context) => { }; const GetAddInfo = (props, context) => { - const { act } = useBackend(context); const { content, color, text } = props; return ( ); }; @@ -179,14 +168,10 @@ const mergeArrays = (...arrays) => { const mergedObject = {}; arrays.forEach((array) => { - if (!array) { - return; - } + if (!array) return; array.forEach((item) => { - if (!item) { - return; - } + if (!item) return; const key = Object.keys(item)[0]; const value = item[key]; @@ -196,21 +181,22 @@ const mergeArrays = (...arrays) => { } value.forEach((subItem) => { - if (!subItem) { - return; - } - - const subKey = Object.keys(subItem)[0]; - const subValue = subItem[subKey]; + if (typeof subItem !== 'object' || subItem === null) return; - const existingItem = mergedObject[key].find( - (funny_value) => Object.keys(funny_value)[0] === subKey, + const existingItemIndex = mergedObject[key].findIndex( + (existingSubItem) => + Object.keys(existingSubItem).some((subKey) => + Object.prototype.hasOwnProperty.call(subItem, subKey), + ), ); - if (existingItem) { - existingItem[subKey] = subValue; + if (existingItemIndex !== -1) { + mergedObject[key][existingItemIndex] = { + ...mergedObject[key][existingItemIndex], + ...subItem, + }; } else { - mergedObject[key].push({ [subKey]: subValue }); + mergedObject[key].push(subItem); } }); }); From 13d946633bee4438525482efa187d571a59e2f4f Mon Sep 17 00:00:00 2001 From: Deleted user Date: Sun, 4 Aug 2024 14:24:23 +0500 Subject: [PATCH 26/34] fix around --- code/controllers/subsystem/who.dm | 8 ++++---- tgui/packages/tgui/interfaces/StaffWho.jsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/controllers/subsystem/who.dm b/code/controllers/subsystem/who.dm index 8f0221f02085..e243a0331033 100644 --- a/code/controllers/subsystem/who.dm +++ b/code/controllers/subsystem/who.dm @@ -31,10 +31,10 @@ SUBSYSTEM_DEF(who) var/list/admin_sorted_additional = list() var/list/factions_additional = list() - admin_sorted_additional["factions_additional"] = list("flags" = R_ADMIN, "data" = factions_additional) + admin_sorted_additional["factions_additional"] = list("flags" = R_MOD|R_ADMIN, "data" = factions_additional) var/list/player_additional = list() - admin_sorted_additional["player_additional"] = list("flags" = R_ADMIN, "data" = player_additional) + admin_sorted_additional["player_additional"] = list("flags" = R_MOD|R_ADMIN, "data" = player_additional) var/list/player_stealthed_additional = list() admin_sorted_additional["player_stealthed_additional"] = list("flags" = R_STEALTH, "data" = player_stealthed_additional) @@ -209,7 +209,7 @@ SUBSYSTEM_DEF(who) var/list/admin_sorted_additional = list() var/list/admin_additional = list() - admin_sorted_additional["admin_additional"] = list("flags" = R_ADMIN, "data" = admin_additional) + admin_sorted_additional["admin_additional"] = list("flags" = R_MOD|R_ADMIN, "data" = admin_additional) var/list/admin_stealthed_additional = list() admin_sorted_additional["admin_stealthed_additional"] = list("flags" = R_STEALTH, "data" = admin_stealthed_additional) @@ -262,7 +262,7 @@ SUBSYSTEM_DEF(who) admin_payload["text"] += "Spectating" else if(istype(entry.mob, /mob/new_player)) - admin_payload["color"] = "#688944" + admin_payload["color"] = "#FFFFFF" admin_payload["text"] += "in Lobby" else admin_payload["color"] = "#688944" diff --git a/tgui/packages/tgui/interfaces/StaffWho.jsx b/tgui/packages/tgui/interfaces/StaffWho.jsx index 845707af43c0..6788f72f3eeb 100644 --- a/tgui/packages/tgui/interfaces/StaffWho.jsx +++ b/tgui/packages/tgui/interfaces/StaffWho.jsx @@ -83,10 +83,10 @@ const GetAdminInfo = (props, context) => {