mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 03:26:31 +01:00
Fixes NTNRC username sorting, additionally makes subcategories sort alphabetically. (#87616)
## About The Pull Request While looking into getting the NTNRC username list sorted, I found out that it was _already_ supposed to be sorted by status, but just got broken in a pr that removes the program status variable forwarded for this reason. In this pr we simply add a `get_numerical_status()` proc that converts the new logic into a number we can sort by, then make the tgui sort account for this. Additionally, we make it sort alphabetically in its subcategories, for sanity's sake. It now sorts by operator perms first, then online>away(background)>offline, then alphabetically. While I dislike operators being at the top regardless of their status, it seems like that is how it was intended to work, and doing so sanely would requite rethinking how names are coloured entirely. On the other end, I think it's potentially good to have operators be at the top and thus easily pingable at all times. ## Why It's Good For The Game Fixes broken status sorting. Alphabetical sorting makes finding a specific user to mute or ping them less of a pain. ## Changelog 🆑 fix: NTNRC channel user list is sorted by status again. It goes operator>online>away>offline. qol: NTNRC channel user list is now alphabetically sorted under its status subcategories. /🆑
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
|
||||
#define PING_COOLDOWN_TIME (3 SECONDS)
|
||||
|
||||
#define STATUS_ONLINE 3
|
||||
#define STATUS_AWAY 2
|
||||
#define STATUS_OFFLINE 1
|
||||
|
||||
/datum/computer_file/program/chatclient
|
||||
filename = "ntnrc_client"
|
||||
filedesc = "Chat Client"
|
||||
@@ -208,6 +212,14 @@
|
||||
active_channel = null
|
||||
return ..()
|
||||
|
||||
/// Converts active/idle/closed to a numerical status for sorting clients by.
|
||||
/datum/computer_file/program/chatclient/proc/get_numerical_status()
|
||||
if(src == computer.active_program)
|
||||
return STATUS_ONLINE
|
||||
if(src in computer.idle_threads)
|
||||
return STATUS_AWAY
|
||||
return STATUS_OFFLINE
|
||||
|
||||
/datum/computer_file/program/chatclient/ui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["selfref"] = REF(src) //used to verify who is you, as usernames can be copied.
|
||||
@@ -244,6 +256,7 @@
|
||||
"away" = (channel_client in channel_client.computer.idle_threads),
|
||||
"muted" = (channel_client in channel.muted_clients),
|
||||
"operator" = (channel.channel_operator == channel_client),
|
||||
"status" = channel_client.get_numerical_status(),
|
||||
"ref" = REF(channel_client),
|
||||
)))
|
||||
//no fishing for ui data allowed
|
||||
@@ -269,3 +282,7 @@
|
||||
#undef MESSAGE_SIZE
|
||||
|
||||
#undef PING_COOLDOWN_TIME
|
||||
|
||||
#undef STATUS_ONLINE
|
||||
#undef STATUS_AWAY
|
||||
#undef STATUS_OFFLINE
|
||||
|
||||
Reference in New Issue
Block a user