Skip to content

Commit

Permalink
tgs tgs tgs
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Dec 6, 2023
1 parent 280f179 commit 477abb4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
7 changes: 4 additions & 3 deletions code/__HELPERS/chat.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/**
* Sends a message to TGS chat channels.
* Asynchronously sends a message to TGS chat channels.
*
* message - The message to send.
* 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(message, channel_tag, admin_only = FALSE)
/proc/send2chat(datum/tgs_message_content/message, channel_tag, admin_only = FALSE)
set waitfor = FALSE
if(channel_tag == null || !world.TgsAvailable())
return

Expand Down
5 changes: 5 additions & 0 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ SUBSYSTEM_DEF(mapping)
if(MC.perf_mode)
GLOB.perf_flags |= MC.perf_mode

if(configs[GROUND_MAP])
send2chat(new /datum/tgs_message_content("<@&[CONFIG_GET(string/new_round_alert_role_id)]> Round restarted! Map is [configs[GROUND_MAP].map_name]"), CONFIG_GET(string/new_round_alert_channel))
else
send2chat(new /datum/tgs_message_content("<@&[CONFIG_GET(string/new_round_alert_role_id)]> Round started!"), CONFIG_GET(string/new_round_alert_channel))

return SS_INIT_SUCCESS

/datum/controller/subsystem/mapping/proc/wipe_reservations(wipe_safety_delay = 100)
Expand Down
17 changes: 7 additions & 10 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,13 @@ GLOBAL_LIST_INIT(reboot_sfx, file2list("config/reboot_sfx.txt"))
shutdown()

/world/proc/send_tgs_restart()
if(CONFIG_GET(string/new_round_alert_channel) && CONFIG_GET(string/new_round_alert_role_id))
if(GLOB.round_statistics)
send2chat("[GLOB.round_statistics.round_name][GLOB.round_id ? " (Round [GLOB.round_id])" : ""] completed!", CONFIG_GET(string/new_round_alert_channel))
if(SSmapping.next_map_configs)
var/datum/map_config/next_map = SSmapping.next_map_configs[GROUND_MAP]
if(next_map)
send2chat("<@&[CONFIG_GET(string/new_round_alert_role_id)]> Restarting! Next map is [next_map.map_name]", CONFIG_GET(string/new_round_alert_channel))
else
send2chat("<@&[CONFIG_GET(string/new_round_alert_role_id)]> Restarting!", CONFIG_GET(string/new_round_alert_channel))
return
if(!CONFIG_GET(string/new_round_alert_channel))
return

if(!GLOB.round_statistics)
return

send2chat(new /datum/tgs_message_content("[GLOB.round_statistics.round_name][GLOB.round_id ? " (Round [GLOB.round_id])" : ""] completed!"), CONFIG_GET(string/new_round_alert_channel))

/world/proc/send_reboot_sound()
var/reboot_sound = SAFEPICK(GLOB.reboot_sfx)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/chat_commands.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/datum/tgs_chat_command/sdql/Run(datum/tgs_chat_user/sender, params)
var/list/results = HandleUserlessSDQL(sender.friendly_name, params)
if(!results)
return "Query produced no output"
return new /datum/tgs_message_content("Query produced no output")
var/list/text_res = results.Copy(1, 3)
var/list/refs = length(results) > 3 ? results.Copy(4) : null
return "[text_res.Join("\n")][refs ? "\nRefs: [refs.Join(" ")]" : ""]"
return new /datum/tgs_message_content("[text_res.Join("\n")][refs ? "\nRefs: [refs.Join(" ")]" : ""]")

0 comments on commit 477abb4

Please sign in to comment.