Skip to content

Commit

Permalink
TGS Support Updates (shiptest-ss13#2552)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

Updates our TGS chat commands to use the new framework, and adds a few
more commands similar to our redbot's.

Also adds a feature where the round will automatically be delayed when a
TGS deployment is incoming.

Better access to commands for those who don't want to set up our
external redbot. Plus, it's nice to support the new features.

Also, delaying the round before a deploy certainly saves me a lot of
headaches from trying to squeeze in a deployment before round restart.

:cl:
admin: The server will now automatically delay round-end when a TGS
deployment is incoming
server: Adds more TGS chat commands as well as support for the newer
chat message system.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
MarkSuckerberg authored and MysticalFaceLesS committed Dec 30, 2023
1 parent 9fa6e4b commit 441c79d
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 42 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,7 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
#define CUSTOM_HOLODECK_ONE (1<<1)
#define CUSTOM_HOLODECK_TWO (1<<2)
#define HOLODECK_DEBUG (1<<3)//you should never see this

#define ROUND_END_NOT_DELAYED 0
#define ROUND_END_DELAYED 1
#define ROUND_END_TGS 2
11 changes: 5 additions & 6 deletions code/__HELPERS/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,17 @@ In TGS3 it will always be sent to all connected designated game chats.

var/datum/tgs_version/version = world.TgsVersion()
if(channel_tag == "" || version.suite == 3)
world.TgsTargetedChatBroadcast(message, FALSE)
world.TgsTargetedChatBroadcast(new /datum/tgs_message_content(message), FALSE)
return

var/list/channels_to_use = list()
for(var/I in world.TgsChatChannelInfo())
var/datum/tgs_chat_channel/channel = I
for(var/datum/tgs_chat_channel/channel as anything in world.TgsChatChannelInfo())
var/list/applicable_tags = splittext(channel.custom_tag, ",")
if(channel_tag in applicable_tags)
channels_to_use += channel

if(channels_to_use.len)
world.TgsChatBroadcast(message, channels_to_use)
if(length(channels_to_use))
world.TgsChatBroadcast(new /datum/tgs_message_content(message), channels_to_use)

/**
* Sends a message to TGS admin chat channels.
Expand All @@ -69,4 +68,4 @@ In TGS3 it will always be sent to all connected designated game chats.
/proc/send2adminchat(category, message)
category = replacetext(replacetext(category, "\proper", ""), "\improper", "")
message = replacetext(replacetext(message, "\proper", ""), "\improper", "")
world.TgsTargetedChatBroadcast("[category] | [message]", TRUE)
world.TgsTargetedChatBroadcast(new /datum/tgs_message_content("[category] | [message]"), TRUE)
4 changes: 2 additions & 2 deletions code/controllers/subsystem/ping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ SUBSYSTEM_DEF(ping)

var/list/currentrun = list()

/datum/controller/subsystem/ping/stat_entry()
..("P:[GLOB.clients.len]")
/datum/controller/subsystem/ping/stat_entry(msg)
return ..("P:[GLOB.clients.len]")

/datum/controller/subsystem/ping/fire(resumed = FALSE)
// Prepare the new batch of clients
Expand Down
25 changes: 21 additions & 4 deletions code/datums/tgs_event_handler.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/datum/tgs_event_handler/impl
var/datum/timedevent/reattach_timer
var/datum/timedevent/delay_end_timer

/datum/tgs_event_handler/impl/HandleEvent(event_code, ...)
switch(event_code)
Expand All @@ -14,28 +15,44 @@
message_admins("TGS: Instance renamed to from [world.TgsInstanceName()] to [args[2]]")
if(TGS_EVENT_COMPILE_START)
message_admins("TGS: Deployment started, new game version incoming...")
SSticker.delay_end = ROUND_END_TGS
SSticker.admin_delay_notice = "TGS Deployment in progress, please wait..."
delay_end_timer = addtimer(CALLBACK(src, PROC_REF(end_delay)), 5 MINUTES, TIMER_STOPPABLE)
if(TGS_EVENT_COMPILE_CANCELLED)
message_admins("TGS: Deployment cancelled!")
end_delay()
if(TGS_EVENT_COMPILE_FAILURE)
message_admins("TGS: Deployment failed!")
end_delay()
if(TGS_EVENT_DEPLOYMENT_COMPLETE)
message_admins("TGS: Deployment complete!")
to_chat(world, "<span class='boldannounce'>Server updated, changes will be applied on the next round...</span>")
to_chat(world, span_boldannounce("Server updated, changes will be applied on the next round..."))
end_delay()
if(TGS_EVENT_WATCHDOG_DETACH)
message_admins("TGS restarting...")
reattach_timer = addtimer(CALLBACK(src, PROC_REF(LateOnReattach)), 1 MINUTES)
reattach_timer = addtimer(CALLBACK(src, PROC_REF(LateOnReattach)), 1 MINUTES, TIMER_STOPPABLE)
if(TGS_EVENT_WATCHDOG_REATTACH)
var/datum/tgs_version/old_version = world.TgsVersion()
var/datum/tgs_version/new_version = args[2]
if(!old_version.Equals(new_version))
to_chat(world, "<span class='boldannounce'>TGS updated to v[new_version.deprefixed_parameter]</span>")
to_chat(world, span_boldannounce("TGS updated to v[new_version.deprefixed_parameter]"))
else
message_admins("TGS: Back online")
if(reattach_timer)
deltimer(reattach_timer)
reattach_timer = null
if(TGS_EVENT_WATCHDOG_SHUTDOWN)
to_chat_immediate(world, "<span class='boldannounce'>Server is shutting down!</span>")
to_chat_immediate(world, span_boldannounce("Server is shutting down!"))

/datum/tgs_event_handler/impl/proc/LateOnReattach()
message_admins("Warning: TGS hasn't notified us of it coming back for a full minute! Is there a problem?")

/datum/tgs_event_handler/impl/proc/end_delay()
if(SSticker.delay_end == ROUND_END_TGS)
SSticker.delay_end = ROUND_END_NOT_DELAYED
SSticker.admin_delay_notice = null
if(delay_end_timer)
deltimer(delay_end_timer)
delay_end_timer = null
if(SSticker.ready_for_reboot && !SSticker.delay_end) //we undelayed after standard reboot would occur
SSticker.standard_reboot()
Loading

0 comments on commit 441c79d

Please sign in to comment.