mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-17 05:03:28 +00:00
* Clean up subsystem Initialize(), require an explicit result returned, give a formal way to fail (for SSlua) * [PR for MIRROR PR] Changes for 16248 (#16277) * Merge skyrat changes, update SR SS's, and remove lobby_eye * Apply suggestions from code review Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update modular_skyrat/modules/autotransfer/code/autotransfer.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * restore lobby_cam for now Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> Co-authored-by: Tastyfish <crazychris32@gmail.com> Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
44 lines
1.2 KiB
Plaintext
44 lines
1.2 KiB
Plaintext
/*!
|
|
* Copyright (c) 2020 Aleksej Komarov
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
SUBSYSTEM_DEF(chat)
|
|
name = "Chat"
|
|
flags = SS_TICKER
|
|
wait = 1
|
|
priority = FIRE_PRIORITY_CHAT
|
|
init_order = INIT_ORDER_CHAT
|
|
|
|
var/list/payload_by_client = list()
|
|
|
|
/datum/controller/subsystem/chat/Initialize()
|
|
// Just used by chat system to know that initialization is nearly finished.
|
|
// The to_chat checks could probably check the runlevel instead, but would require testing.
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/chat/fire()
|
|
for(var/key in payload_by_client)
|
|
var/client/client = key
|
|
var/payload = payload_by_client[key]
|
|
payload_by_client -= key
|
|
if(client)
|
|
// Send to tgchat
|
|
client.tgui_panel?.window.send_message("chat/message", payload)
|
|
// Send to old chat
|
|
for(var/message in payload)
|
|
SEND_TEXT(client, message_to_html(message))
|
|
if(MC_TICK_CHECK)
|
|
return
|
|
|
|
/datum/controller/subsystem/chat/proc/queue(target, message)
|
|
if(islist(target))
|
|
for(var/_target in target)
|
|
var/client/client = CLIENT_FROM_VAR(_target)
|
|
if(client)
|
|
LAZYADD(payload_by_client[client], list(message))
|
|
return
|
|
var/client/client = CLIENT_FROM_VAR(target)
|
|
if(client)
|
|
LAZYADD(payload_by_client[client], list(message))
|