From ccc5ea17589d5122d3a65c8830c923f155260834 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Thu, 19 May 2022 15:19:21 -0400 Subject: [PATCH] Bot refresh - Makes bot output channels configurable, makes the bot capable of pinging the reboot role --- code/__HELPERS/roundend.dm | 19 ++++++++++++++----- code/controllers/configuration/entries/bot.dm | 14 ++++++++++++++ .../configuration/entries/general.dm | 10 ---------- .../mob/living/simple_animal/parrot.dm | 4 ++-- config/config.txt | 1 + config/entries/bot.txt | 17 +++++++++++++++++ config/entries/general.txt | 9 --------- tgstation.dme | 1 + 8 files changed, 49 insertions(+), 26 deletions(-) create mode 100644 code/controllers/configuration/entries/bot.dm create mode 100644 config/entries/bot.txt diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 2f7dd7a64f..32a81297c5 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -258,15 +258,24 @@ send2adminchat("Server", "A round of [mode.name] just ended[mode_result == "undefined" ? "." : " with a [mode_result]."] Survival rate: [survival_rate]") - if(LAZYLEN(GLOB.round_end_notifiees)) - world.TgsTargetedChatBroadcast("[GLOB.round_end_notifiees.Join(", ")] the round has ended.", FALSE) - if(length(CONFIG_GET(keyed_list/cross_server))) send_news_report() //tell the nice people on discord what went on before the salt cannon happens. - world.TgsTargetedChatBroadcast("The current round has ended. Please standby for your shift interlude Nanotrasen News Network's report!", FALSE) - world.TgsTargetedChatBroadcast(send_news_report(), FALSE) + if(CONFIG_GET(string/chat_roundend_notice_tag)) + var/broadcastmessage = "" + + if(LAZYLEN(GLOB.round_end_notifiees)) + broadcastmessage += "[GLOB.round_end_notifiees.Join(", ")], " + + + broadcastmessage += "[((broadcastmessage == "") ? "the" : "The")] current round has ended. Please standby for your shift interlude Nanotrasen News Network's report!\n" + broadcastmessage += "```\n[send_news_report()]\n```" + + if(CONFIG_GET(string/chat_reboot_role)) + broadcastmessage += "\n\n<@&[CONFIG_GET(string/chat_reboot_role)]>, the server will reboot shortly!" + + send2chat(broadcastmessage, CONFIG_GET(string/chat_roundend_notice_tag)) CHECK_TICK diff --git a/code/controllers/configuration/entries/bot.dm b/code/controllers/configuration/entries/bot.dm new file mode 100644 index 0000000000..071406ad65 --- /dev/null +++ b/code/controllers/configuration/entries/bot.dm @@ -0,0 +1,14 @@ +/datum/config_entry/flag/irc_announce_new_game + deprecated_by = /datum/config_entry/string/chat_announce_new_game + +/datum/config_entry/flag/irc_announce_new_game/DeprecationUpdate(value) + return "" //default broadcast + +/datum/config_entry/string/chat_announce_new_game + config_entry_value = null + +/datum/config_entry/string/chat_reboot_role + +/datum/config_entry/string/chat_roundend_notice_tag + +/datum/config_entry/string/chat_squawk_tag diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 9966f90ce7..b7a92ee48f 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -39,16 +39,6 @@ /datum/config_entry/flag/show_irc_name -/datum/config_entry/flag/irc_announce_new_game - deprecated_by = /datum/config_entry/string/chat_announce_new_game - -/datum/config_entry/flag/irc_announce_new_game/DeprecationUpdate(value) - return "" //default broadcast - -/datum/config_entry/string/chat_announce_new_game - - config_entry_value = null - /datum/config_entry/string/default_view config_entry_value = "15x15" diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index fe479bb943..1f12195ad6 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -925,8 +925,8 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( /mob/living/simple_animal/parrot/Poly/say(message, bubble_type,var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null) . = ..() - if(. && !client && prob(1) && prob(1)) //Only the one true bird may speak across dimensions. - world.TgsTargetedChatBroadcast("A stray squawk is heard... \"[message]\"", FALSE) + if(. && !client && prob(1) && prob(1) && CONFIG_GET(string/chat_squawk_tag)) //Only the one true bird may speak across dimensions. + send2chat("A stray squawk is heard... \"[message]\"", CONFIG_GET(string/chat_squawk_tag)) /mob/living/simple_animal/parrot/Poly/BiologicalLife(seconds, times_fired) if(!(. = ..())) diff --git a/config/config.txt b/config/config.txt index c0c683373d..63adaee716 100644 --- a/config/config.txt +++ b/config/config.txt @@ -15,6 +15,7 @@ $include entries/admin.txt $include entries/alert.txt $include entries/antag_rep.txt +$include entries/bot.txt $include entries/comms.txt $include entries/connections.txt $include entries/dbconfig.txt diff --git a/config/entries/bot.txt b/config/entries/bot.txt new file mode 100644 index 0000000000..eb9e8855e7 --- /dev/null +++ b/config/entries/bot.txt @@ -0,0 +1,17 @@ +## Chat Announce Options +## Various messages to be sent to game chats +## Uncommenting these will enable them, by default they will be broadcast to Game chat channels on TGS3 or non-admin channels on TGS4 +## If using TGS4, the string option can be set as a chat channel tag to limit the message to channels of that tag type (case-sensitive) +## i.e. CHAT_ANNOUNCE_NEW_GAME chat_channel_tag + +## Announcements for when a new round begins. +#CHAT_ANNOUNCE_NEW_GAME + +## Announcements for when the round ends, pending server reboot. +#CHAT_ROUNDEND_NOTICE_TAG + +## For where should the one true bird speak? +#CHAT_SQUAWK_TAG + +## Role ID that, when present, will be pinged every round end. +#CHAT_REBOOT_ROLE diff --git a/config/entries/general.txt b/config/entries/general.txt index 7fef691006..3688b8197b 100644 --- a/config/entries/general.txt +++ b/config/entries/general.txt @@ -31,15 +31,6 @@ ALLOW_HOLIDAYS ## Uncomment to show the names of the admin sending a pm from IRC instead of showing as a stealthmin. #SHOW_IRC_NAME -## Chat Announce Options -## Various messages to be sent to game chats -## Uncommenting these will enable them, by default they will be broadcast to Game chat channels on TGS3 or non-admin channels on TGS4 -## If using TGS4, the string option can be set as a chat channel tag to limit the message to channels of that tag type (case-sensitive) -## i.e. CHAT_ANNOUNCE_NEW_GAME chat_channel_tag - -## Send a message with the station name starting a new game -#CHAT_ANNOUNCE_NEW_GAME - ##Default screen resolution, in tiles. ## By default, this is 15x15, which gets simplified to 7 by BYOND, as it is a 1:1 screen ratio. ## For reference, Goonstation uses a resolution of 21x15 for it's widescreen mode. diff --git a/tgstation.dme b/tgstation.dme index e33a3644d6..8ccd92ea1e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -320,6 +320,7 @@ #include "code\controllers\configuration\entries\admin.dm" #include "code\controllers\configuration\entries\alert.dm" #include "code\controllers\configuration\entries\antag_rep.dm" +#include "code\controllers\configuration\entries\bot.dm" #include "code\controllers\configuration\entries\comms.dm" #include "code\controllers\configuration\entries\connections.dm" #include "code\controllers\configuration\entries\dbconfig.dm"