mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com>
36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
/**
|
|
* Sends a message to TGS chat channels.
|
|
*
|
|
* message - The message to send.
|
|
* channel_tag - Required. If "", the message with be sent to all connected (Game-type for TGS3) channels. Otherwise, it will be sent to TGS4 channels with that tag (Delimited by ','s).
|
|
*/
|
|
/proc/send2chat(message, channel_tag)
|
|
if(channel_tag == null || !world.TgsAvailable())
|
|
return
|
|
|
|
var/datum/tgs_version/version = world.TgsVersion()
|
|
if(channel_tag == "" || version.suite == 3)
|
|
world.TgsTargetedChatBroadcast(message, FALSE)
|
|
return
|
|
|
|
var/list/channels_to_use = list()
|
|
for(var/I in world.TgsChatChannelInfo())
|
|
var/datum/tgs_chat_channel/channel = I
|
|
var/list/applicable_tags = splittext(channel.tag, ",")
|
|
if(channel_tag in applicable_tags)
|
|
channels_to_use += channel
|
|
|
|
if(channels_to_use.len)
|
|
world.TgsChatBroadcast(message, channels_to_use)
|
|
|
|
/**
|
|
* Sends a message to TGS admin chat channels.
|
|
*
|
|
* category - The category of the mssage.
|
|
* message - The message to send.
|
|
*/
|
|
/proc/send2adminchat(category, message)
|
|
category = replacetext(replacetext(category, "\proper", ""), "\improper", "")
|
|
message = replacetext(replacetext(message, "\proper", ""), "\improper", "")
|
|
world.TgsTargetedChatBroadcast("[category] | [message]", TRUE)
|