Files
Paradise/code/modules/tgui/tgui_panel/tgui_panel_external.dm
Sean 98912fcea9 More 516 fixes and TGUI improvements (#26617)
* more 516 fixes and tweaks

* cleaned build output

---------

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
2024-09-16 14:37:09 +00:00

60 lines
2.0 KiB
Plaintext

/**
* Copyright (c) 2020 Aleksej Komarov
* SPDX-License-Identifier: MIT
*/
/* check_grep:ignore */ /client/var/datum/tgui_panel/tgui_panel
/**
* tgui panel / chat troubleshooting verb
*/
/client/verb/fix_tgui_panel()
set name = "Fix chat"
set category = "Special Verbs"
var/action
log_tgui(src, "Started fixing.")
nuke_chat()
// Failed to fix
action = alert(src, "Did that work?", "", "Yes", "No, switch to old ui")
if(action == "No, switch to old ui")
winset(src, "output", "on-show=&is-disabled=0&is-visible=1")
winset(src, "chat_panel", "is-disabled=1;is-visible=0")
log_tgui(src, "Failed to fix.")
/client/proc/nuke_chat()
// Catch all solution (kick the whole thing in the pants)
winset(src, "output", "on-show=&is-disabled=0&is-visible=1")
winset(src, "chat_panel", "is-disabled=1;is-visible=0")
if(!tgui_panel || !istype(tgui_panel))
log_tgui(src, "tgui_panel datum is missing")
tgui_panel = new(src, "chat_panel")
tgui_panel.initialize(force = TRUE)
// Force show the panel to see if there are any errors
winset(src, "output", "is-disabled=1&is-visible=0")
winset(src, "chat_panel", "is-disabled=0;is-visible=1")
if(byond_version >= 516)
winset(src, null, "browser-options=byondstorage,find")
/client/verb/refresh_tgui()
set name = "Refresh TGUI"
set category = "Special Verbs"
var/choice = alert(usr,
"Use it ONLY if you have trouble with TGUI window.\
That's UI's with EYE on top-left corner.\
Otherwise, you can get a white window that will only close when you restart the game!", "Refresh TGUI", "Refresh", "Cancel")
if(choice != "Refresh")
return
var/refreshed_count = 0
for(var/window_id in tgui_windows)
var/datum/tgui_window/window = tgui_windows[window_id]
if(!window.locked)
window.acquire_lock()
continue
window.reinitialize()
refreshed_count++
to_chat(usr, "<span class='notice'>TGUI windows refreshed - [refreshed_count].<br>If you have blank window - restart the game, or open previous TGUI window.</span>")