From 22846365769cdf27bac658fe84ced53ed99456d5 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Thu, 10 Jul 2025 04:32:33 +0300 Subject: [PATCH] Rename State member to make it less confusing JesterAI::previousState updates on the next frame after currentBehaviourStateIndex changes, while current- & previous- BehaviourStateIndex only change when SwitchToBehaviourState() is requested. --- MuzikaGromche/Plugin.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MuzikaGromche/Plugin.cs b/MuzikaGromche/Plugin.cs index 1eec440..7b4e8cf 100644 --- a/MuzikaGromche/Plugin.cs +++ b/MuzikaGromche/Plugin.cs @@ -186,7 +186,7 @@ namespace MuzikaGromche { __state = new State { - prevStateindex = __instance.previousState + previousState = __instance.previousState }; if (__instance.currentBehaviourStateIndex == 2 && __instance.previousBehaviourStateIndex != 2) { @@ -206,7 +206,7 @@ namespace MuzikaGromche __instance.farAudio = __state.farAudio; } - if (__instance.currentBehaviourStateIndex == 1 && __state.prevStateindex != 1) + if (__instance.currentBehaviourStateIndex == 1 && __state.previousState != 1) { // if just started winding up // then stop the default music... @@ -236,13 +236,13 @@ namespace MuzikaGromche __instance.farAudio.Play(); } - if (__instance.currentBehaviourStateIndex == 2 && __state.prevStateindex != 2) + if (__instance.currentBehaviourStateIndex == 2 && __state.previousState != 2) { __instance.creatureVoice.Stop(); Plugin.StartLightSwitching(__instance); } - if (__instance.currentBehaviourStateIndex != 2 && __state.prevStateindex == 2) + if (__instance.currentBehaviourStateIndex != 2 && __state.previousState == 2) { Plugin.StopLightSwitching(__instance); Plugin.ResetLightColor(); @@ -264,6 +264,6 @@ namespace MuzikaGromche internal class State { public AudioSource farAudio; - public int prevStateindex; + public int previousState; } }