mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-01 04:21:42 +00:00
* The Failsafe can now recover from an deleted MC Its also more reliable and can handle a situation where its main Loop runtimes and the MC is stuck * Reset defcon level correctly Oops left that in from debugging the levels * Correctly recover SSasset * Only decrease defcon if MC creation failed Also add some sort sleep between emergency loops * Makes the last two emergency actions manual procs Since they are kinda unstantable its probalby best if only admins call these manually Its also more reliable and can handle a situation where its main Loop runtimes and the MC is stuck You can also now debug Master/New() While there will most likely never be any situation where the MC is just gone its still good to know that the game can recover from such a situation For example maybe someone messed up a SDQL query or maybe someone wanted to delete the MC to create a new one hoping the Failsafe would do so for him Co-authored-by: Gamer025 <33846895+Gamer025@users.noreply.github.com>
99 lines
2.6 KiB
Plaintext
99 lines
2.6 KiB
Plaintext
/*!
|
|
* Copyright (c) 2020 Aleksej Komarov
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
/**
|
|
* Circumvents the message queue and sends the message
|
|
* to the recipient (target) as soon as possible.
|
|
*/
|
|
/proc/to_chat_immediate(
|
|
target,
|
|
html,
|
|
type = null,
|
|
text = null,
|
|
avoid_highlighting = FALSE,
|
|
// FIXME: These flags are now pointless and have no effect
|
|
handle_whitespace = TRUE,
|
|
trailing_newline = TRUE,
|
|
confidential = FALSE
|
|
)
|
|
// Useful where the integer 0 is the entire message. Use case is enabling to_chat(target, some_boolean) while preventing to_chat(target, "")
|
|
html = "[html]"
|
|
text = "[text]"
|
|
|
|
if(!target)
|
|
return
|
|
if(!html && !text)
|
|
CRASH("Empty or null string in to_chat proc call.")
|
|
if(target == world)
|
|
target = GLOB.clients
|
|
|
|
// Build a message
|
|
var/message = list()
|
|
if(type) message["type"] = type
|
|
if(text) message["text"] = text
|
|
if(html) message["html"] = html
|
|
if(avoid_highlighting) message["avoidHighlighting"] = avoid_highlighting
|
|
var/message_blob = TGUI_CREATE_MESSAGE("chat/message", message)
|
|
var/message_html = message_to_html(message)
|
|
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_blob)
|
|
// Send to old chat
|
|
SEND_TEXT(client, message_html)
|
|
return
|
|
var/client/client = CLIENT_FROM_VAR(target)
|
|
if(client)
|
|
// Send to tgchat
|
|
client.tgui_panel?.window.send_raw_message(message_blob)
|
|
// Send to old chat
|
|
SEND_TEXT(client, message_html)
|
|
|
|
/**
|
|
* Sends the message to the recipient (target).
|
|
*
|
|
* Recommended way to write to_chat calls:
|
|
* ```
|
|
* to_chat(client,
|
|
* type = MESSAGE_TYPE_INFO,
|
|
* html = "You have found <strong>[object]</strong>")
|
|
* ```
|
|
*/
|
|
/proc/to_chat(
|
|
target,
|
|
html,
|
|
type = null,
|
|
text = null,
|
|
avoid_highlighting = FALSE,
|
|
// FIXME: These flags are now pointless and have no effect
|
|
handle_whitespace = TRUE,
|
|
trailing_newline = TRUE,
|
|
confidential = FALSE
|
|
)
|
|
if(isnull(Master) || Master.current_runlevel == RUNLEVEL_INIT || !SSchat?.initialized)
|
|
to_chat_immediate(target, html, type, text, avoid_highlighting)
|
|
return
|
|
|
|
// Useful where the integer 0 is the entire message. Use case is enabling to_chat(target, some_boolean) while preventing to_chat(target, "")
|
|
html = "[html]"
|
|
text = "[text]"
|
|
|
|
if(!target)
|
|
return
|
|
if(!html && !text)
|
|
CRASH("Empty or null string in to_chat proc call.")
|
|
if(target == world)
|
|
target = GLOB.clients
|
|
|
|
// Build a message
|
|
var/message = list()
|
|
if(type) message["type"] = type
|
|
if(text) message["text"] = text
|
|
if(html) message["html"] = html
|
|
if(avoid_highlighting) message["avoidHighlighting"] = avoid_highlighting
|
|
SSchat.queue(target, message)
|