TGUI updates + statpanel
This commit is contained in:
@@ -8,46 +8,40 @@
|
||||
/**
|
||||
* tgui panel / chat troubleshooting verb
|
||||
*/
|
||||
/client/verb/fix_chat()
|
||||
/client/verb/fix_tgui_panel()
|
||||
set name = "Fix chat"
|
||||
set category = "OOC"
|
||||
var/action
|
||||
log_tgui(src, "tgui_panel: Started fix_chat.")
|
||||
// Not initialized
|
||||
if(!tgui_panel || !istype(tgui_panel))
|
||||
log_tgui(src, "tgui_panel: datum is missing")
|
||||
action = alert(src, "tgui panel was not initialized!\nSet it up again?", "", "OK", "Cancel")
|
||||
if(action != "OK")
|
||||
return
|
||||
tgui_panel = new(src)
|
||||
tgui_panel.initialize()
|
||||
action = alert(src, "Wait a bit and tell me if it's fixed", "", "Fixed", "Nope")
|
||||
if(action == "Fixed")
|
||||
log_tgui(src, "tgui_panel: Fixed by calling 'new' + 'initialize'")
|
||||
return
|
||||
log_tgui(src, "Started fixing.",
|
||||
context = "verb/fix_tgui_panel")
|
||||
// Not ready
|
||||
if(!tgui_panel?.is_ready())
|
||||
log_tgui(src, "tgui_panel: not ready")
|
||||
action = alert(src, "tgui panel looks like it's waiting for something.\nSend it a ping?", "", "OK", "Cancel")
|
||||
if(action != "OK")
|
||||
return
|
||||
log_tgui(src, "Panel is not ready",
|
||||
context = "verb/fix_tgui_panel")
|
||||
tgui_panel.window.send_message("ping", force = TRUE)
|
||||
action = alert(src, "Wait a bit and tell me if it's fixed", "", "Fixed", "Nope")
|
||||
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, "tgui_panel: Fixed by sending a ping")
|
||||
log_tgui(src, "Fixed by sending a ping",
|
||||
context = "verb/fix_tgui_panel")
|
||||
return
|
||||
// Catch all solution
|
||||
action = alert(src, "Looks like tgui panel was already setup, but we can always try again.\nSet it up again?", "", "OK", "Cancel")
|
||||
if(action != "OK")
|
||||
return
|
||||
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)
|
||||
action = alert(src, "Wait a bit and tell me if it's fixed", "", "Fixed", "Nope")
|
||||
// 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, "tgui_panel: Fixed by calling 'initialize'")
|
||||
log_tgui(src, "Fixed by calling 'initialize'",
|
||||
context = "verb/fix_tgui_panel")
|
||||
return
|
||||
// Failed to fix
|
||||
action = alert(src, "Welp, I'm all out of ideas. Try closing BYOND and reconnecting.\nWe could also disable tgui_panel and re-enable the old UI", "", "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, "tgui_panel: Failed to fix.")
|
||||
log_tgui(src, "Failed to fix.",
|
||||
context = "verb/fix_tgui_panel")
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2020 Aleksej Komarov
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* global
|
||||
*
|
||||
* Circumvents the message queue and sends the message
|
||||
* to the recipient (target) as soon as possible.
|
||||
*/
|
||||
/proc/to_chat_immediate(
|
||||
target,
|
||||
text,
|
||||
handle_whitespace = TRUE,
|
||||
trailing_newline = TRUE,
|
||||
confidential = FALSE)
|
||||
if(!target || !text)
|
||||
return
|
||||
if(target == world)
|
||||
target = GLOB.clients
|
||||
var/flags = handle_whitespace \
|
||||
| trailing_newline << 1 \
|
||||
| confidential << 2
|
||||
var/message = TGUI_CREATE_MESSAGE("chat/message", list(
|
||||
"text" = text,
|
||||
"flags" = flags,
|
||||
))
|
||||
if(islist(target))
|
||||
for(var/_target in target)
|
||||
var/client/client = CLIENT_FROM_VAR(_target)
|
||||
if(client)
|
||||
// Send to tgchat
|
||||
client.tgui_panel?.window.send_raw_message(message)
|
||||
// Send to old chat
|
||||
SEND_TEXT(client, text)
|
||||
return
|
||||
var/client/client = CLIENT_FROM_VAR(target)
|
||||
if(client)
|
||||
// Send to tgchat
|
||||
client.tgui_panel?.window.send_raw_message(message)
|
||||
// Send to old chat
|
||||
SEND_TEXT(client, text)
|
||||
|
||||
/**
|
||||
* global
|
||||
*
|
||||
* Sends the message to the recipient (target).
|
||||
*/
|
||||
/proc/to_chat(
|
||||
target,
|
||||
text,
|
||||
handle_whitespace = TRUE,
|
||||
trailing_newline = TRUE,
|
||||
confidential = FALSE)
|
||||
if(Master.current_runlevel == RUNLEVEL_INIT || !SSchat?.initialized)
|
||||
to_chat_immediate(
|
||||
target,
|
||||
text,
|
||||
handle_whitespace,
|
||||
trailing_newline,
|
||||
confidential)
|
||||
return
|
||||
if(!target || !text)
|
||||
return
|
||||
if(target == world)
|
||||
target = GLOB.clients
|
||||
var/flags = handle_whitespace \
|
||||
| trailing_newline << 1 \
|
||||
| confidential << 2
|
||||
SSchat.queue(target, text, flags)
|
||||
Reference in New Issue
Block a user