From 68b687b13f58afc6fc9d69afe96654de7128ae23 Mon Sep 17 00:00:00 2001
From: Kashargul <144968721+Kashargul@users.noreply.github.com>
Date: Mon, 3 Mar 2025 15:15:07 +0100
Subject: [PATCH] some more 516 compat fixes (#89766)
Ports the helpers from
https://github.com/BeeStation/BeeStation-Hornet/pull/12240
This should fix some more of the 516 issues that I've seen while giving
a quick check through the code
The remaining browse should work now.
Also fixing another sass warning while being on it.
## About The Pull Request
## Why It's Good For The Game
## Changelog
:cl:
fix: tgui say 516 will no longer change channels when the button is used
to drag it
fix: tgui say 516 will no longer leak radio messages into the wrong
channel
fix: runechat flickering when faded up messages fade out
/:cl:
---
code/__DEFINES/html_assistant.dm | 5 ++++
code/__HELPERS/stat_tracking.dm | 2 +-
code/controllers/subsystem/dynamic/dynamic.dm | 4 +--
code/datums/chatmessage.dm | 25 +++++++++++++------
code/modules/admin/known_alts.dm | 8 +-----
code/modules/admin/verbs/SDQL2/SDQL_2.dm | 2 +-
code/modules/admin/verbs/adminhelp.dm | 1 +
code/modules/admin/verbs/getlogs.dm | 2 +-
code/modules/admin/verbs/mapping.dm | 6 ++---
code/modules/client/client_procs.dm | 2 +-
code/modules/mob/dead/new_player/poll.dm | 12 ++++-----
tgstation.dme | 1 +
tgui/packages/tgui-say/516/TguiSay.tsx | 15 ++++++++++-
.../styles/interfaces/IntegratedCircuit.scss | 5 ++--
14 files changed, 57 insertions(+), 33 deletions(-)
create mode 100644 code/__DEFINES/html_assistant.dm
diff --git a/code/__DEFINES/html_assistant.dm b/code/__DEFINES/html_assistant.dm
new file mode 100644
index 00000000000..91af96a95c7
--- /dev/null
+++ b/code/__DEFINES/html_assistant.dm
@@ -0,0 +1,5 @@
+#define HTML_SKELETON_INTERNAL(head, body) \
+"
[head][body]"
+
+#define HTML_SKELETON_TITLE(title, body) HTML_SKELETON_INTERNAL("[title]", body)
+#define HTML_SKELETON(body) HTML_SKELETON_INTERNAL("", body)
diff --git a/code/__HELPERS/stat_tracking.dm b/code/__HELPERS/stat_tracking.dm
index fcd625ef6da..4deeffc09c4 100644
--- a/code/__HELPERS/stat_tracking.dm
+++ b/code/__HELPERS/stat_tracking.dm
@@ -9,7 +9,7 @@
lines += "[entry] => [num2text(data[STAT_ENTRY_TIME], 10)]ms ([data[STAT_ENTRY_COUNT]]) (avg:[num2text(data[STAT_ENTRY_TIME]/(data[STAT_ENTRY_COUNT] || 1), 99)])"
if (user)
- user << browse("- [lines.Join("
- ")]
", "window=[url_encode("stats:[REF(stats)]")]")
+ user << browse(HTML_SKELETON("- [lines.Join("
- ")]
"), "window=[url_encode("stats:[REF(stats)]")]")
. = lines.Join("\n")
diff --git a/code/controllers/subsystem/dynamic/dynamic.dm b/code/controllers/subsystem/dynamic/dynamic.dm
index 9afc4b9133f..d6d99e318d1 100644
--- a/code/controllers/subsystem/dynamic/dynamic.dm
+++ b/code/controllers/subsystem/dynamic/dynamic.dm
@@ -394,7 +394,7 @@ SUBSYSTEM_DEF(dynamic)
if(!check_rights(R_ADMIN))
return
- var/list/out = list("Threat LogThreat Log
Starting Threat: [threat_level]
")
+ var/list/out = list("Threat Log
Starting Threat: [threat_level]
")
for(var/entry in threat_log)
if(istext(entry))
@@ -402,7 +402,7 @@ SUBSYSTEM_DEF(dynamic)
out += "Remaining threat/threat_level: [mid_round_budget]/[threat_level]"
- usr << browse(out.Join(), "window=threatlog;size=700x500")
+ usr << browse(HTML_SKELETON_TITLE("Threat Log", out.Join()), "window=threatlog;size=700x500")
/// Generates the threat level using lorentz distribution and assigns peaceful_percentage.
/datum/controller/subsystem/dynamic/proc/generate_threat()
diff --git a/code/datums/chatmessage.dm b/code/datums/chatmessage.dm
index fdd5bb4c825..5930012a2af 100644
--- a/code/datums/chatmessage.dm
+++ b/code/datums/chatmessage.dm
@@ -224,13 +224,16 @@
// When choosing to update the remaining time we have to be careful not to update the
// scheduled time once the EOL has been executed.
+ var/continuing = 0
if (time_spent >= time_before_fade)
if(m.message.pixel_y < starting_height)
var/max_height = m.message.pixel_y + m.approx_lines * CHAT_MESSAGE_APPROX_LHEIGHT - starting_height
if(max_height > 0)
- animate(m.message, pixel_y = m.message.pixel_y + max_height, time = CHAT_MESSAGE_SPAWN_TIME, flags = ANIMATION_PARALLEL)
+ animate(m.message, pixel_y = m.message.pixel_y + max_height, time = CHAT_MESSAGE_SPAWN_TIME, flags = continuing | ANIMATION_PARALLEL)
+ continuing |= ANIMATION_CONTINUE
else if(mheight + starting_height >= m.message.pixel_y)
- animate(m.message, pixel_y = m.message.pixel_y + mheight, time = CHAT_MESSAGE_SPAWN_TIME, flags = ANIMATION_PARALLEL)
+ animate(m.message, pixel_y = m.message.pixel_y + mheight, time = CHAT_MESSAGE_SPAWN_TIME, flags = continuing | ANIMATION_PARALLEL)
+ continuing |= ANIMATION_CONTINUE
continue
var/remaining_time = time_before_fade * (CHAT_MESSAGE_EXP_DECAY ** idx++) * (CHAT_MESSAGE_HEIGHT_DECAY ** combined_height)
@@ -239,23 +242,29 @@
if(remaining_time > 0)
if(time_spent < CHAT_MESSAGE_SPAWN_TIME)
// We haven't even had the time to fade in yet!
- animate(m.message, alpha = 255, CHAT_MESSAGE_SPAWN_TIME - time_spent)
+ animate(m.message, alpha = 255, CHAT_MESSAGE_SPAWN_TIME - time_spent, flags=continuing)
+ continuing |= ANIMATION_CONTINUE
// Stay faded in for a while, then
- animate(m.message, alpha = 255, remaining_time, flags=ANIMATION_CONTINUE)
+ animate(m.message, alpha = 255, time = remaining_time, flags=continuing)
+ continuing |= ANIMATION_CONTINUE
// Fade out
- animate(alpha = 0, time = CHAT_MESSAGE_EOL_FADE)
+ animate(m.message, alpha = 0, time = CHAT_MESSAGE_EOL_FADE, flags=continuing)
+ continuing |= ANIMATION_CONTINUE
m.animate_lifespan = remaining_time + CHAT_MESSAGE_EOL_FADE
else
// Your time has come my son
- animate(alpha = 0, time = CHAT_MESSAGE_EOL_FADE)
+ animate(m.message, alpha = 0, time = CHAT_MESSAGE_EOL_FADE, flags=continuing)
+ continuing |= ANIMATION_CONTINUE
// We run this after the alpha animate, because we don't want to interrup it, but also don't want to block it by running first
// Sooo instead we do this. bit messy but it fuckin works
if(m.message.pixel_y < starting_height)
var/max_height = m.message.pixel_y + m.approx_lines * CHAT_MESSAGE_APPROX_LHEIGHT - starting_height
if(max_height > 0)
- animate(m.message, pixel_y = m.message.pixel_y + max_height, time = CHAT_MESSAGE_SPAWN_TIME, flags = ANIMATION_PARALLEL)
+ animate(m.message, pixel_y = m.message.pixel_y + max_height, time = CHAT_MESSAGE_SPAWN_TIME, flags = continuing | ANIMATION_PARALLEL)
+ continuing |= ANIMATION_CONTINUE
else if(mheight + starting_height >= m.message.pixel_y)
- animate(m.message, pixel_y = m.message.pixel_y + mheight, time = CHAT_MESSAGE_SPAWN_TIME, flags = ANIMATION_PARALLEL)
+ animate(m.message, pixel_y = m.message.pixel_y + mheight, time = CHAT_MESSAGE_SPAWN_TIME, flags = continuing | ANIMATION_PARALLEL)
+ continuing |= ANIMATION_CONTINUE
// Reset z index if relevant
if (current_z_idx >= CHAT_LAYER_MAX_Z)
diff --git a/code/modules/admin/known_alts.dm b/code/modules/admin/known_alts.dm
index 3c51ca68bdf..791512fc5d3 100644
--- a/code/modules/admin/known_alts.dm
+++ b/code/modules/admin/known_alts.dm
@@ -171,21 +171,15 @@ GLOBAL_DATUM_INIT(known_alts, /datum/known_alts, new)
known_alts_html += "\[-\] Delete [known_alt[1]] is an alt of [known_alt[2]] (added by [known_alt[3]])."
var/html = {"
-
- Known Alts
-
-
-
Any two ckeys in this panel will not show in "banned connection history".
Sometimes players switch account, and it's customary to perma-ban the old one.
All Known Alts:
\[+\] Add
[known_alts_html.Join("
")]
-
"}
- client << browse(html, "window=known_alts;size=700x400")
+ client << browse(HTML_SKELETON_TITLE("Known Alts", html), "window=known_alts;size=700x400")
ADMIN_VERB(known_alts_panel, R_ADMIN, "Known Alts Panel", "View a panel of known alts.", ADMIN_CATEGORY_MAIN)
GLOB.known_alts.show_panel(user)
diff --git a/code/modules/admin/verbs/SDQL2/SDQL_2.dm b/code/modules/admin/verbs/SDQL2/SDQL_2.dm
index f74df712721..5121dab2f00 100644
--- a/code/modules/admin/verbs/SDQL2/SDQL_2.dm
+++ b/code/modules/admin/verbs/SDQL2/SDQL_2.dm
@@ -533,7 +533,7 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/sdql2_vv_all, new(null
if(length(select_text))
var/text = islist(select_text)? select_text.Join() : select_text
var/static/result_offset = 0
- showmob << browse(text, "window=SDQL-result-[result_offset++]")
+ showmob << browse(HTML_SKELETON(text), "window=SDQL-result-[result_offset++]")
show_next_to_key = null
if(qdel_on_finish)
qdel(src)
diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm
index 809c9342dee..652c55dc149 100644
--- a/code/modules/admin/verbs/adminhelp.dm
+++ b/code/modules/admin/verbs/adminhelp.dm
@@ -634,6 +634,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
if (related_ticket.id == id)
continue
dat += "[related_ticket.TicketHref("#[related_ticket.id]")] ([related_ticket.ticket_status()]): [related_ticket.name]
"
+ dat += "