From 61acfee5f5971baf0702c31f318b17816baf1476 Mon Sep 17 00:00:00 2001 From: Extremelyd1 <10898310+Extremelyd1@users.noreply.github.com> Date: Sun, 28 Jul 2024 16:46:42 +0200 Subject: [PATCH] Fix Flower quest placement synchronisation --- HKMP/Fsm/FsmPatcher.cs | 12 ++++++++++++ HKMP/Game/Client/Save/SaveChanges.cs | 23 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/HKMP/Fsm/FsmPatcher.cs b/HKMP/Fsm/FsmPatcher.cs index c7e1cd4..46aad80 100644 --- a/HKMP/Fsm/FsmPatcher.cs +++ b/HKMP/Fsm/FsmPatcher.cs @@ -119,5 +119,17 @@ private void OnFsmEnable(On.PlayMakerFSM.orig_OnEnable orig, PlayMakerFSM self) self.InsertAction("Split", setBoolAction, 0); self.RemoveFirstAction("Break"); } + + // Patch the 'Conversation Control' FSM of the Flower Quest end to set the player data bool earlier in the + // FSM so that it synchronises better + if (self.name.StartsWith("Inspect Region") && self.Fsm.Name.Equals("Conversation Control")) { + var setPdBoolAction = self.GetFirstAction("Flowers"); + if (setPdBoolAction == null) { + return; + } + + self.InsertAction("Glow", setPdBoolAction, 0); + self.RemoveFirstAction("Flowers"); + } } } diff --git a/HKMP/Game/Client/Save/SaveChanges.cs b/HKMP/Game/Client/Save/SaveChanges.cs index aa229be..c5d493d 100644 --- a/HKMP/Game/Client/Save/SaveChanges.cs +++ b/HKMP/Game/Client/Save/SaveChanges.cs @@ -261,6 +261,29 @@ public void ApplyPlayerDataSaveChange(string name) { fsm.RemoveFirstAction("Activate"); fsm.SetState("Activate"); + return; + } + + if (name == "xunFlowerGiven" && currentScene == "Fungus3_49") { + var go = GameObject.Find("Inspect Region"); + if (go == null) { + return; + } + + var fsm = go.LocateMyFSM("Conversation Control"); + if (fsm == null) { + return; + } + + // Remove a bunch of actions that only apply to the placing player + fsm.RemoveFirstAction("Flowers"); + fsm.RemoveFirstAction("Ghost Appear"); + fsm.RemoveFirstAction("Ghost Appear"); + fsm.RemoveFirstAction("Look Up"); + fsm.RemoveFirstAction("Get Up"); + + fsm.SetState("Glow"); + return; } }