Skip to content

Commit

Permalink
Fix Flower quest placement synchronisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Extremelyd1 committed Jul 28, 2024
1 parent 561063b commit 61acfee
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
12 changes: 12 additions & 0 deletions HKMP/Fsm/FsmPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,17 @@ private void OnFsmEnable(On.PlayMakerFSM.orig_OnEnable orig, PlayMakerFSM self)
self.InsertAction("Split", setBoolAction, 0);
self.RemoveFirstAction<SetBoolValue>("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<SetPlayerDataBool>("Flowers");
if (setPdBoolAction == null) {
return;
}

self.InsertAction("Glow", setPdBoolAction, 0);
self.RemoveFirstAction<SetPlayerDataBool>("Flowers");
}
}
}
23 changes: 23 additions & 0 deletions HKMP/Game/Client/Save/SaveChanges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,29 @@ public void ApplyPlayerDataSaveChange(string name) {
fsm.RemoveFirstAction<SetPlayerDataBool>("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<SetPlayerDataBool>("Flowers");
fsm.RemoveFirstAction<Tk2dPlayAnimationWithEvents>("Ghost Appear");
fsm.RemoveFirstAction<FaceObject>("Ghost Appear");
fsm.RemoveFirstAction<Tk2dPlayAnimation>("Look Up");
fsm.RemoveFirstAction<Tk2dPlayAnimation>("Get Up");

fsm.SetState("Glow");
return;
}
}

Expand Down

0 comments on commit 61acfee

Please sign in to comment.