1
0
Fork 0

Fix AudioSource distance check for lyrics event

It was checking maxDistance of a non-overridden loop clip during windup.
This commit is contained in:
ivan tkachenko 2025-07-30 18:37:56 +03:00
parent f959a4ebb2
commit 7ed299ead8
2 changed files with 7 additions and 3 deletions

View File

@ -3,6 +3,7 @@
## MuzikaGromche 13.37.1337 ## MuzikaGromche 13.37.1337
- Added LobbyCompatibility to dependencies to avoid desync issues. - Added LobbyCompatibility to dependencies to avoid desync issues.
- Fixed lyrics not being displayed in some situations.
## MuzikaGromche 13.37.911 - Sri Lanka Bus hotfix ## MuzikaGromche 13.37.911 - Sri Lanka Bus hotfix

View File

@ -496,6 +496,9 @@ namespace MuzikaGromche
SetLightColor(Color.white); SetLightColor(Color.white);
} }
// Max audible distance for AudioSource and LyricsEvent
public const float AudioMaxDistance = 150;
public static bool LocalPlayerCanHearMusic(EnemyAI jester) public static bool LocalPlayerCanHearMusic(EnemyAI jester)
{ {
var player = GameNetworkManager.Instance.localPlayerController; var player = GameNetworkManager.Instance.localPlayerController;
@ -504,7 +507,7 @@ namespace MuzikaGromche
return false; return false;
} }
var distance = Vector3.Distance(player.transform.position, jester.transform.position); var distance = Vector3.Distance(player.transform.position, jester.transform.position);
return distance < jester.creatureVoice.maxDistance; return distance <= AudioMaxDistance;
} }
private void Awake() private void Awake()
@ -1803,7 +1806,7 @@ namespace MuzikaGromche
__instance.popUpTimer = Plugin.CurrentTrack.WindUpTimer; __instance.popUpTimer = Plugin.CurrentTrack.WindUpTimer;
// Override popGoesTheWeaselTheme with Start audio // Override popGoesTheWeaselTheme with Start audio
__instance.farAudio.maxDistance = 150; __instance.farAudio.maxDistance = Plugin.AudioMaxDistance;
__instance.farAudio.clip = Plugin.CurrentTrack.LoadedStart; __instance.farAudio.clip = Plugin.CurrentTrack.LoadedStart;
__instance.farAudio.loop = false; __instance.farAudio.loop = false;
if (Config.ShouldSkipWindingPhase) if (Config.ShouldSkipWindingPhase)
@ -1838,7 +1841,7 @@ namespace MuzikaGromche
// Override screamingSFX with Loop, delayed by the remaining time of the Start audio // Override screamingSFX with Loop, delayed by the remaining time of the Start audio
__instance.creatureVoice.Stop(); __instance.creatureVoice.Stop();
__instance.creatureVoice.maxDistance = 150; __instance.creatureVoice.maxDistance = Plugin.AudioMaxDistance;
__instance.creatureVoice.clip = Plugin.CurrentTrack.LoadedLoop; __instance.creatureVoice.clip = Plugin.CurrentTrack.LoadedLoop;
__instance.creatureVoice.PlayDelayed(delay); __instance.creatureVoice.PlayDelayed(delay);