New functionality for round announcements (#18843)

* New functionality for round announcements

* Added missing send2chat

* Update game start announcement message format
This commit is contained in:
Selis
2026-01-05 10:18:10 +01:00
committed by GitHub
parent 9135e2253b
commit 201daed90a
5 changed files with 105 additions and 4 deletions
+66
View File
@@ -1,3 +1,69 @@
/*
Here's how to use the TGS chat system with configs
send2adminchat is a simple function that broadcasts to all admin channels that are designated in TGS
send2chat is a bit verbose but can be very specific
In TGS3 it will always be sent to all connected designated game chats.
In TGS4+ they use the new tagging system
The second parameter is a string, this string should be read from a config.
What this does is dictate which TGS channels can be sent to.
For example if you have the following channels in tgs4 set up
- Channel 1, Tag: asdf
- Channel 2, Tag: bombay,asdf
- Channel 3, Tag: Hello my name is asdf
- Channel 4, No Tag
- Channel 5, Tag: butts
and you make the call:
send2chat(new /datum/tgs_message_content("I sniff butts"), CONFIG_GET(string/where_to_send_sniff_butts))
and the config option is set like:
WHERE_TO_SEND_SNIFF_BUTTS asdf
It will be sent to channels 1 and 2
Alternatively if you set the config option to just:
WHERE_TO_SEND_SNIFF_BUTTS
it will be sent to all connected chats.
*/
/**
* Asynchronously sends a message to TGS chat channels.
*
* message - The [/datum/tgs_message_content] 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).
* admin_only - Determines if this communication can only be sent to admin only channels.
*/
/proc/send2chat(datum/tgs_message_content/message, channel_tag, admin_only = FALSE)
set waitfor = FALSE
if(channel_tag == null || !world.TgsAvailable())
return
var/datum/tgs_version/version = world.TgsVersion()
if(channel_tag == "" || version.suite == 3)
world.TgsTargetedChatBroadcast(message, admin_only)
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.custom_tag, ",")
if((!admin_only || channel.is_admin_channel) && (channel_tag in applicable_tags))
channels_to_use += channel
if(channels_to_use.len)
world.TgsChatBroadcast(message, channels_to_use)
/**
* Asynchronously sends a message to TGS admin chat channels.
*
+6 -1
View File
@@ -5,7 +5,12 @@
roundend_callbacks.InvokeAsync()
LAZYCLEARLIST(round_end_events)
to_chat(world, span_filter_system("<br><br><br><H1>A round of [mode.name] has ended!</H1>"))
to_chat(world, span_filter_system("<BR><BR><BR><H1>The round has ended.</H1>"))
log_game("The round has ended.")
for(var/channel_tag in CONFIG_GET(str_list/channel_announce_end_game))
send2chat(new /datum/tgs_message_content("[GLOB.round_id ? "Round [GLOB.round_id]" : "The round has"] just ended."), channel_tag)
send2adminchat("Server", "Round just ended.")
for(var/mob/Player in GLOB.player_list)
if(Player.mind && !isnewplayer(Player))
if(Player.stat != DEAD)
@@ -824,6 +824,16 @@
/datum/config_entry/flag/discord_ahelps_all
default = FALSE
/datum/config_entry/str_list/channel_announce_new_game
/datum/config_entry/str_list/channel_announce_end_game
/datum/config_entry/str_list/chat_new_game_notifications
/// validate ownership of admin flags for chat commands
/datum/config_entry/flag/secure_chat_commands
default = FALSE
/datum/config_entry/number/mc_tick_rate/base_mc_tick_rate
integer = FALSE
default = 1
+2 -2
View File
@@ -100,8 +100,8 @@ SUBSYSTEM_DEF(ticker)
for(var/client/C in GLOB.clients)
window_flash(C, ignorepref = TRUE) //let them know lobby has opened up.
to_chat(world, span_boldnotice("Welcome to [station_name()]!"))
//for(var/channel_tag in CONFIG_GET(str_list/channel_announce_new_game))
// send2chat(new /datum/tgs_message_content("New round starting on [SSmapping.current_map.map_name]!"), channel_tag)
for(var/channel_tag in CONFIG_GET(str_list/channel_announce_new_game))
send2chat(new /datum/tgs_message_content("New round starting on [using_map.full_name] ([using_map.name])!"), channel_tag)
current_state = GAME_STATE_PREGAME
SEND_SIGNAL(src, COMSIG_TICKER_ENTER_PREGAME)
+21 -1
View File
@@ -613,6 +613,26 @@ JUKEBOX_TRACK_FILES config/jukebox.json
#Turn this on if you want all admin-PMs to go to be sent to discord, and not only the first message of a ticket.
#DISCORD_AHELPS_ALL
## Game Chat Message Options
## Various messages to be sent to connected chat channels.
## Uncommenting these will enable them, by default they will be broadcast to Game chat channels on TGS3 or non-admin channels on TGS>=4.
## If using TGS>=4, the string option can be set as one of more chat channel tags (separated by ','s) to limit the message to channels with that tag name (case-sensitive). This will have no effect on TGS3.
## You can also specify multiple channel tags by using the config option multiple times,
## i.e. CHANNEL_ANNOUNCE_NEW_GAME chat_channel_tag_1
## i.e. CHANNEL_ANNOUNCE_NEW_GAME chat_channel_tag_2
## Which channels will have a message about a new game starting, message includes the station name.
#CHANNEL_ANNOUNCE_NEW_GAME
## Which channels will have a message about a new game starting, message includes the round ID of the game that has just ended.
#CHANNEL_ANNOUNCE_END_GAME
## Ping users who use the `notify` command when a new game starts.
#CHAT_NEW_GAME_NOTIFICATIONS
## Uncomment this flag to validate admin commands from discord by requiring they come from linked discord accounts and that those discord accounts link to a ckey with the right admin permissions.
# SECURE_CHAT_COMMANDS
###Master Controller High Pop Mode###
##The Master Controller(MC) is the primary system controlling timed tasks and events in SS13 (lobby timer, game checks, lighting updates, atmos, etc)
@@ -665,4 +685,4 @@ TOAST_NOTIFICATION_ON_INIT
#ALLOW_TRACY_START
## Uncomment to allow admins with +DEBUG to queue the next round to run the byond-tracy profiler.
#ALLOW_TRACY_QUEUE
#ALLOW_TRACY_QUEUE