From df0cfc16ffa14e5a9ea99a3df89db5f46fd397a8 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Mon, 6 Apr 2026 06:03:56 +0300 Subject: [PATCH] Fix Game Over Text resetting at the end of round When the last player dies and should have their custom Game Over text overridden, the mod previously would Clear() the override and destroy the coroutine together with custom behaviour object. --- CHANGELOG.md | 1 + MuzikaGromche/DeathScreenManager.cs | 8 ++++++-- MuzikaGromche/Plugin.cs | 4 +--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd3824f..8e77ae5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Added lyrics to the existing track HighLow. - New random track will be selected every time instead of having the same track all day. - Groupped tracks (verses of the same song) are still played together in a sequence. +- Don't reset overridden Game Over text prematurely at the end of round. ## MuzikaGromche 1337.9001.68 - LocalHost hotfix diff --git a/MuzikaGromche/DeathScreenManager.cs b/MuzikaGromche/DeathScreenManager.cs index cb5291c..1dbfa40 100644 --- a/MuzikaGromche/DeathScreenManager.cs +++ b/MuzikaGromche/DeathScreenManager.cs @@ -21,7 +21,12 @@ namespace MuzikaGromche SetTextImpl(text ?? GameOverTextModdedDefault); } - public static IEnumerator SetTextAndClear(string? text) + public static void SetTextAndClear(string? text) + { + HUDManager.Instance.StartCoroutine(SetTextAndClearImpl(text)); + } + + public static IEnumerator SetTextAndClearImpl(string? text) { SetText(text); // Game Over animation duration is about 4.25 seconds @@ -60,7 +65,6 @@ namespace MuzikaGromche [HarmonyPatch(typeof(RoundManager))] static class DeathScreenGameOverTextResetPatch { - [HarmonyPatch(nameof(RoundManager.DespawnPropsAtEndOfRound))] [HarmonyPatch(nameof(RoundManager.OnDestroy))] [HarmonyPrefix] static void OnDestroy(RoundManager __instance) diff --git a/MuzikaGromche/Plugin.cs b/MuzikaGromche/Plugin.cs index 65fb5cf..55bc57a 100644 --- a/MuzikaGromche/Plugin.cs +++ b/MuzikaGromche/Plugin.cs @@ -2089,8 +2089,6 @@ namespace MuzikaGromche public override void OnDestroy() { Config.Volume.SettingChanged -= UpdateVolume; - - DeathScreenGameOverTextManager.Clear(); Stop(); } @@ -2388,7 +2386,7 @@ namespace MuzikaGromche // Playing as a client with a host who doesn't have the mod return; } - StartCoroutine(DeathScreenGameOverTextManager.SetTextAndClear(CurrentTrack.GameOverText)); + DeathScreenGameOverTextManager.SetTextAndClear(CurrentTrack.GameOverText); } }