mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-18 21:53:22 +00:00
* fix chat HARDER (#54030) * fix HARDER * Remove ping case since the hard method already does a better job. * Update code/modules/tgui_panel/external.dm Co-authored-by: Fikou <piotrbryla@ onet.pl> Co-authored-by: Aleksej Komarov <stylemistake@ gmail.com> Co-authored-by: Fikou <piotrbryla@ onet.pl> * fix chat HARDER Co-authored-by: Rob Bailey <actioninja@gmail.com> Co-authored-by: Aleksej Komarov <stylemistake@ gmail.com> Co-authored-by: Fikou <piotrbryla@ onet.pl>
68 lines
2.4 KiB
Plaintext
68 lines
2.4 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")
|
|
|
|
// Not ready
|
|
if(!tgui_panel?.is_ready())
|
|
log_tgui(src, "Panel is not ready",
|
|
context = "verb/fix_tgui_panel")
|
|
tgui_panel.window.send_message("ping", force = TRUE)
|
|
action = alert(src, "Method: Pinging the panel.\nWait a bit and tell me if it's fixed", "", "Fixed", "Nope")
|
|
if(action == "Fixed")
|
|
log_tgui(src, "Fixed by sending a ping",
|
|
context = "verb/fix_tgui_panel")
|
|
return
|
|
|
|
// Catch all solution
|
|
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, "output", "is-disabled=1&is-visible=0")
|
|
winset(src, "browseroutput", "is-disabled=0;is-visible=1")
|
|
action = alert(src, "Method: Reinitializing the panel.\nWait a bit and tell me if it's fixed", "", "Fixed", "Nope")
|
|
if(action == "Fixed")
|
|
log_tgui(src, "Fixed by calling 'initialize'",
|
|
context = "verb/fix_tgui_panel")
|
|
return
|
|
|
|
// Catch all solution (HARDER)
|
|
winset(src, "output", "on-show=&is-disabled=0&is-visible=1")
|
|
winset(src, "browseroutput", "is-disabled=1;is-visible=0")
|
|
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, "output", "is-disabled=1&is-visible=0")
|
|
winset(src, "browseroutput", "is-disabled=0;is-visible=1")
|
|
action = alert(src, "Method: Reinitializing the panel A SECOND TIME.\nWait a bit and tell me if it's fixed", "", "Fixed", "Nope")
|
|
if(action == "Fixed")
|
|
log_tgui(src, "Fixed via second kick in the pants",
|
|
context = "verb/fix_tgui_panel")
|
|
return
|
|
|
|
// Failed to fix
|
|
action = alert(src, "Did that work?", "", "No, thanks anyways", "Switch to old UI")
|
|
if (action == "Switch to old UI")
|
|
winset(src, "output", "on-show=&is-disabled=0&is-visible=1")
|
|
winset(src, "browseroutput", "is-disabled=1;is-visible=0")
|
|
log_tgui(src, "Failed to fix.",
|
|
context = "verb/fix_tgui_panel")
|