From 966478a3ff0695a7088dc9437ee2d8f926717294 Mon Sep 17 00:00:00 2001 From: CHOMPStation2StaffMirrorBot <94713762+CHOMPStation2StaffMirrorBot@users.noreply.github.com> Date: Wed, 29 Oct 2025 20:23:26 -0700 Subject: [PATCH] [MIRROR] Round start/end delay fixes (#11888) Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com> Co-authored-by: Cameron Lennox --- code/controllers/subsystems/ticker.dm | 40 ++++++++++++++++++++++----- code/modules/admin/admin.dm | 4 ++- tools/build/build.ts | 4 ++- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index 5f94f93234..55030637cb 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -67,6 +67,8 @@ SUBSYSTEM_DEF(ticker) /// ID of round reboot timer, if it exists var/reboot_timer = null + /// ID of round countdown timer, if it exists + var/countdown_timer = null /// ### LEGACY VARS ### /// Default time to wait before rebooting in desiseconds. @@ -108,7 +110,7 @@ SUBSYSTEM_DEF(ticker) //lobby stats for statpanels if(isnull(timeLeft)) timeLeft = max(0,start_at - world.time) - to_chat(world, span_notice("Round starting in [round(timeLeft / 10)] Seonds!")) + to_chat(world, span_notice("Round starting in [round(timeLeft / 10)] Seconds!")) totalPlayers = LAZYLEN(GLOB.new_player_list) totalPlayersReady = 0 total_admins_ready = 0 @@ -124,7 +126,10 @@ SUBSYSTEM_DEF(ticker) //countdown if(timeLeft < 0) return - timeLeft -= wait + + // Do not count down the time, if the game start is delayed + if (GLOB.round_progressing) + timeLeft -= wait //if(timeLeft <= 300 && !tipped) // send_tip_of_the_round(world, selected_tip) @@ -457,7 +462,7 @@ SUBSYSTEM_DEF(ticker) if(!delay) delay = CONFIG_GET(number/round_end_countdown) SECONDS if(delay >= 60 SECONDS) - addtimer(CALLBACK(src, PROC_REF(announce_countodwn), delay), 60 SECONDS) + countdown_timer = addtimer(CALLBACK(src, PROC_REF(announce_countdown), delay), 60 SECONDS) var/skip_delay = check_rights() if(delay_end && !skip_delay) @@ -478,16 +483,17 @@ SUBSYSTEM_DEF(ticker) UNTIL(round_end_sound_sent || (world.time - start_wait) > (delay * 2)) //don't wait forever reboot_timer = addtimer(CALLBACK(src, PROC_REF(reboot_callback), reason, end_string), delay - (world.time - start_wait), TIMER_STOPPABLE) -/datum/controller/subsystem/ticker/proc/announce_countodwn(remaining_time) +/datum/controller/subsystem/ticker/proc/announce_countdown(remaining_time) remaining_time -= 60 SECONDS if(remaining_time >= 60 SECONDS) to_chat(world, span_boldannounce("Rebooting World in [DisplayTimeText(remaining_time)].")) - addtimer(CALLBACK(src, PROC_REF(announce_countodwn), remaining_time), 60 SECONDS) + countdown_timer = addtimer(CALLBACK(src, PROC_REF(announce_countdown), remaining_time), 60 SECONDS) return if(remaining_time > 0) - addtimer(CALLBACK(src, PROC_REF(announce_countodwn), 0), remaining_time) + countdown_timer = addtimer(CALLBACK(src, PROC_REF(announce_countdown), 0), remaining_time) return - to_chat(world, span_boldannounce("Rebooting World.")) + if(!delay_end) + to_chat(world, span_boldannounce("Rebooting World.")) /datum/controller/subsystem/ticker/proc/reboot_callback(reason, end_string) if(end_string) @@ -510,4 +516,24 @@ SUBSYSTEM_DEF(ticker) to_chat(world, span_boldannounce("An admin has delayed the round end.")) deltimer(reboot_timer) reboot_timer = null + if(countdown_timer) + deltimer(countdown_timer) + countdown_timer = null return TRUE + +/** + * Helper proc that delays the roundend for us. + * This proc will trigger a reboot if the delay is 'toggled off'. + * Use with care. + */ +/datum/controller/subsystem/ticker/proc/toggle_delay() + delay_end = !delay_end + + if(countdown_timer) + deltimer(countdown_timer) + countdown_timer = null + if(reboot_timer) + deltimer(reboot_timer) + reboot_timer = null + else + Reboot("World reboot after administrative delay.") diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index c0aa2cde1d..e59216e7a9 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -1018,7 +1018,9 @@ var/datum/announcement/minor/admin_min_announcer = new if(!check_rights(R_SERVER|R_EVENT)) return if (SSticker.current_state >= GAME_STATE_PLAYING) - SSticker.delay_end = !SSticker.delay_end + // Tell the ticker to delay/resume + SSticker.toggle_delay() + log_admin("[key_name(usr)] [SSticker.delay_end ? "delayed the round end" : "has made the round end normally"].") message_admins(span_blue("[key_name(usr)] [SSticker.delay_end ? "delayed the round end" : "has made the round end normally"]."), 1) return diff --git a/tools/build/build.ts b/tools/build/build.ts index 3719699da9..772f861d7d 100644 --- a/tools/build/build.ts +++ b/tools/build/build.ts @@ -314,7 +314,9 @@ export const TgFontTarget = new Juke.Target({ 'tgui/packages/tgfont/dist/tgfont.woff2', ], executes: async () => { - await bun('tgfont:build'); + await Juke.exec('bun', ['run', 'tgfont:build'], { + cwd: 'tgui/packages/tgfont', + }); fs.mkdirSync('tgui/packages/tgfont/static', { recursive: true }); fs.copyFileSync( 'tgui/packages/tgfont/dist/tgfont.css',