diff --git a/HKMP/Fsm/FsmPatcher.cs b/HKMP/Fsm/FsmPatcher.cs index 46aad80..f68b183 100644 --- a/HKMP/Fsm/FsmPatcher.cs +++ b/HKMP/Fsm/FsmPatcher.cs @@ -75,7 +75,12 @@ private void OnFsmEnable(On.PlayMakerFSM.orig_OnEnable orig, PlayMakerFSM self) // Get the original watch animation action for the FSM event it sends var watchAnimationAction = self.GetFirstAction("End Challenge"); - + // If the action was already removed before (maybe because the OnEnable triggers multiple times) + // we don't have to do anything anymore + if (watchAnimationAction == null) { + return; + } + // Insert a wait action that takes exactly the duration of the animation and sends the original event // when it finishes self.InsertAction("End Challenge", new Wait { diff --git a/HKMP/Game/Client/Entity/Entity.cs b/HKMP/Game/Client/Entity/Entity.cs index 4983f22..551bbbe 100644 --- a/HKMP/Game/Client/Entity/Entity.cs +++ b/HKMP/Game/Client/Entity/Entity.cs @@ -308,7 +308,8 @@ private void ProcessHostFsm(PlayMakerFSM fsm) { MonoBehaviourUtil.Instance.StartCoroutine(WaitForActionInitialization()); IEnumerator WaitForActionInitialization() { while (checkFunc.Invoke()) { - if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != sceneName) { + if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != + global::GameManager.GetBaseSceneName(sceneName)) { yield break; }