diff --git a/MuzikaGromche/Plugin.cs b/MuzikaGromche/Plugin.cs index 05246d3..bdbd31a 100644 --- a/MuzikaGromche/Plugin.cs +++ b/MuzikaGromche/Plugin.cs @@ -16,7 +16,7 @@ namespace MuzikaGromche { Name = "MuzikaGromche", WindUpTimer = 46.3f, - Bpm = 120f, + Bpm = 130f, }, new Track { @@ -73,6 +73,12 @@ namespace MuzikaGromche { __state = new State(); __state.prevStateindex = __instance.previousState; + if (__instance.currentBehaviourStateIndex == 2 && __instance.previousBehaviourStateIndex != 2) { + // if just popped out + // then override farAudio so that vanilla logic does not stop the music + __state.farAudio = __instance.farAudio; + __instance.farAudio = __instance.creatureVoice; + } } static List colors = [Color.magenta, Color.cyan, Color.green, Color.yellow]; @@ -100,14 +106,22 @@ namespace MuzikaGromche [HarmonyPostfix] public static void DoNotStopTheMusic(JesterAI __instance, State __state) { + if (__state.farAudio != null) + { + __instance.farAudio = __state.farAudio; + } + if (__instance.currentBehaviourStateIndex is 1 && __state.prevStateindex != 1) { + // if just started winding up + // then stop the default music... __instance.farAudio.Stop(); __instance.farAudio.Pause(); } if (__instance.currentBehaviourStateIndex is 1 && !__instance.farAudio.isPlaying) { + // ...and start modded music var seed = RoundManager.Instance.dungeonGenerator.Generator.ChosenSeed; var trackId = seed % Plugin.Tracks.Length; Debug.Log($"Seed is {seed}, chosen track is {trackId} out of {Plugin.Tracks.Length} tracks"); @@ -155,6 +169,7 @@ namespace MuzikaGromche internal class State { + public AudioSource farAudio; public int prevStateindex; } }