1
0
Fork 0

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.
This commit is contained in:
ivan tkachenko 2026-04-06 06:03:56 +03:00
parent b99e4c1e2c
commit df0cfc16ff
3 changed files with 8 additions and 5 deletions

View File

@ -8,6 +8,7 @@
- Added lyrics to the existing track HighLow. - Added lyrics to the existing track HighLow.
- New random track will be selected every time instead of having the same track all day. - 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. - 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 ## MuzikaGromche 1337.9001.68 - LocalHost hotfix

View File

@ -21,7 +21,12 @@ namespace MuzikaGromche
SetTextImpl(text ?? GameOverTextModdedDefault); 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); SetText(text);
// Game Over animation duration is about 4.25 seconds // Game Over animation duration is about 4.25 seconds
@ -60,7 +65,6 @@ namespace MuzikaGromche
[HarmonyPatch(typeof(RoundManager))] [HarmonyPatch(typeof(RoundManager))]
static class DeathScreenGameOverTextResetPatch static class DeathScreenGameOverTextResetPatch
{ {
[HarmonyPatch(nameof(RoundManager.DespawnPropsAtEndOfRound))]
[HarmonyPatch(nameof(RoundManager.OnDestroy))] [HarmonyPatch(nameof(RoundManager.OnDestroy))]
[HarmonyPrefix] [HarmonyPrefix]
static void OnDestroy(RoundManager __instance) static void OnDestroy(RoundManager __instance)

View File

@ -2089,8 +2089,6 @@ namespace MuzikaGromche
public override void OnDestroy() public override void OnDestroy()
{ {
Config.Volume.SettingChanged -= UpdateVolume; Config.Volume.SettingChanged -= UpdateVolume;
DeathScreenGameOverTextManager.Clear();
Stop(); Stop();
} }
@ -2388,7 +2386,7 @@ namespace MuzikaGromche
// Playing as a client with a host who doesn't have the mod // Playing as a client with a host who doesn't have the mod
return; return;
} }
StartCoroutine(DeathScreenGameOverTextManager.SetTextAndClear(CurrentTrack.GameOverText)); DeathScreenGameOverTextManager.SetTextAndClear(CurrentTrack.GameOverText);
} }
} }