Files
Bubberstation/code/modules/tgui_panel/external.dm
Lucy 946a481c81 Fix tgui chat panel z-fighting on BYOND 516 (#88663)
## About The Pull Request

Port of https://github.com/ParadiseSS13/Paradise/pull/27676 and
https://github.com/VOREStation/VOREStation/pull/16734

> Instead of relying on `is-disabled` and `is-visible`, which BYOND
happily will automatically change for you whenever you send a client
text, we now use a Child element to swap between the legacy output and
browser output in separate preset panes.
> 
> TL;DR: chat would flash white under 516, now doesn't

I cleared cache before each test video below, just to be 100% sure

<details>
<summary>Testing Evidence: BYOND 515</summary>


https://github.com/user-attachments/assets/8d661cc3-585e-4f8e-9399-76df8bc0a281

</details>

<details>
<summary>Testing Evidence: BYOND 516</summary>


https://github.com/user-attachments/assets/c0d31fb4-6ef5-4d49-81a8-c767c5e24cc2

</details>

## Why It's Good For The Game

flickering chat hurts my eyes

## Changelog
🆑 Absolucy, ShadowLarkens, S34N
fix: Fixed chat rapidly flickering in BYOND 516.
/🆑
2024-12-24 11:31:00 -08:00

43 lines
1.2 KiB
Plaintext

/*!
* Copyright (c) 2020 Aleksej Komarov
* SPDX-License-Identifier: MIT
*/
/client/var/datum/tgui_panel/tgui_panel
/**
* tgui panel / chat troubleshooting verb
*/
/client/verb/fix_tgui_panel()
set name = "Fix chat"
set category = "OOC"
var/action
log_tgui(src, "Started fixing.", context = "verb/fix_tgui_panel")
nuke_chat()
// Failed to fix, using tgalert as fallback
action = tgalert(src, "Did that work?", "", "Yes", "No, switch to old ui")
if (action == "No, switch to old ui")
winset(src, "legacy_output_selector", "left=output_legacy")
log_tgui(src, "Failed to fix.", context = "verb/fix_tgui_panel")
/client/proc/nuke_chat()
// Catch all solution (kick the whole thing in the pants)
winset(src, "legacy_output_selector", "left=output_legacy")
if(!tgui_panel || !istype(tgui_panel))
log_tgui(src, "tgui_panel datum is missing",
context = "verb/fix_tgui_panel")
tgui_panel = new(src)
tgui_panel.initialize(force = TRUE)
// Force show the panel to see if there are any errors
winset(src, "legacy_output_selector", "left=output_browser")
/client/verb/refresh_tgui()
set name = "Refresh TGUI"
set category = "OOC"
for(var/window_id in tgui_windows)
var/datum/tgui_window/window = tgui_windows[window_id]
window.reinitialize()