forked from nikita/muzika-gromche
When player dies, check for nearby Jester music source to show Game Over text
This commit is contained in:
parent
8561834e22
commit
3cdd99f57e
|
|
@ -8,7 +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.
|
||||
- Override Death Screen / Game Over text in more cases.
|
||||
- Attempted to fix issue when Jester wouldn't select any track after the first one.
|
||||
|
||||
## MuzikaGromche 1337.9001.68 - LocalHost hotfix
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections;
|
||||
using GameNetcodeStuff;
|
||||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
|
@ -73,4 +74,29 @@ namespace MuzikaGromche
|
|||
DeathScreenGameOverTextManager.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControllerB))]
|
||||
static class PlayerControllerBKillPlayerPatch
|
||||
{
|
||||
// Use prefix to test distance from listener before the listener is reassigned
|
||||
[HarmonyPatch(nameof(PlayerControllerB.KillPlayer))]
|
||||
[HarmonyPrefix]
|
||||
static void KillPlayerPrefix(PlayerControllerB __instance)
|
||||
{
|
||||
if (__instance.IsOwner && !__instance.isPlayerDead && __instance.AllowPlayerDeath())
|
||||
{
|
||||
// KILL LOCAL PLAYER
|
||||
var list = Object.FindObjectsByType<EnemyAI>(FindObjectsInactive.Exclude, FindObjectsSortMode.None);
|
||||
foreach (var jester in list)
|
||||
{
|
||||
if (jester.TryGetComponent<MuzikaGromcheJesterNetworkBehaviour>(out var behaviour) &&
|
||||
behaviour.IsPlaying && Plugin.LocalPlayerCanHearMusic(jester))
|
||||
{
|
||||
behaviour.OverrideDeathScreenGameOverText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ namespace MuzikaGromche
|
|||
Harmony.PatchAll(typeof(DiscoBallDespawnPatch));
|
||||
Harmony.PatchAll(typeof(SpawnRatePatch));
|
||||
Harmony.PatchAll(typeof(DeathScreenGameOverTextResetPatch));
|
||||
Harmony.PatchAll(typeof(PlayerControllerBKillPlayerPatch));
|
||||
Harmony.PatchAll(typeof(ScreenFiltersManager.HUDManagerScreenFiltersPatch));
|
||||
Harmony.PatchAll(typeof(ClearAudioClipCachePatch));
|
||||
NetcodePatcher();
|
||||
|
|
|
|||
Loading…
Reference in New Issue