From 369531011e01b6f02bb094524536577acc0a38aa Mon Sep 17 00:00:00 2001 From: "Tommo J. Phillips" Date: Sat, 30 Sep 2023 13:34:00 +1000 Subject: [PATCH] # Implemented fix for part drop/throw while PlayerInMenu FsmBool is true. --- ModAPI/Attachable/Part/PartManager.cs | 26 ++++++++++++++++++++++---- ModAPI/Properties/AssemblyInfo.cs | 14 +++++++------- ModAPI/Properties/FileHistory.txt | 2 +- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/ModAPI/Attachable/Part/PartManager.cs b/ModAPI/Attachable/Part/PartManager.cs index eec0d68..aee16dc 100644 --- a/ModAPI/Attachable/Part/PartManager.cs +++ b/ModAPI/Attachable/Part/PartManager.cs @@ -26,6 +26,7 @@ public class PartManager private SaveManager _partSaveManager; private Action _partLeaveAction; private FsmGameObject _pickedUpObject; + private PlayMakerFSM _handPickup; #endregion @@ -104,12 +105,18 @@ internal void load() _partSaveManager = new SaveManager(); _pickedUpObject = ModClient.getPickedUpGameObject; - PlayMakerFSM handPickup = ModClient.getHandPickUpFsm; + _handPickup = ModClient.getHandPickUpFsm; // injecting part picked, drop and throw functions. - handPickup.GetState("Part picked").insertNewAction(onPickedUp, 5); - handPickup.GetState("Drop part").prependNewAction(onPartDropped); - handPickup.GetState("Throw part").prependNewAction(onPartThrown); + _handPickup.GetState("Part picked").insertNewAction(onPickedUp, 5); + + FsmState dropState = _handPickup.GetState("Drop part"); + dropState.prependNewAction(onPartDropped); + dropState.addNewTransitionToState("LOOP", "Part picked"); + + FsmState throwState = _handPickup.GetState("Throw part"); + throwState.prependNewAction(onPartThrown); + throwState.addNewTransitionToState("LOOP", "Part picked"); // inject save function (For Auto Save) GameObject.Find("ITEMS").GetPlayMaker("SaveItems").GetState("Save game").prependNewAction(onSave); @@ -186,6 +193,11 @@ private void onPartDropped() { // Written, 11.06.2022 + if (ModClient.playerInMenu) + { + _handPickup.SendEvent("LOOP"); + return; + } if (_pickedPart) _partLeaveAction = _pickedPart.invokeDroppedEvent; else @@ -196,6 +208,12 @@ private void onPartThrown() { // Written, 11.06.2022 + if (ModClient.playerInMenu) + { + _handPickup.SendEvent("LOOP"); + return; + } + if (_pickedPart) _partLeaveAction = _pickedPart.invokeThrownEvent; else diff --git a/ModAPI/Properties/AssemblyInfo.cs b/ModAPI/Properties/AssemblyInfo.cs index a7a1a6e..b9940c9 100644 --- a/ModAPI/Properties/AssemblyInfo.cs +++ b/ModAPI/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ // General Information [assembly: AssemblyTitle("ModApi")] -[assembly: AssemblyDescription("ModApi v0.2.0 BUILD 2")] +[assembly: AssemblyDescription("ModApi v0.2.0 BUILD 7")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Tommo J. Productions")] [assembly: AssemblyProduct("ModApi")] @@ -13,7 +13,7 @@ // Version information [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.2.0.2")] +[assembly: AssemblyFileVersion("0.2.0.7")] namespace TommoJProductions.ModApi { @@ -26,7 +26,7 @@ public class VersionInfo /// /// Represents latest release version date. Format: dd:MM:yyyy hh:mm tt /// - public static readonly string lastestRelease = "30.09.2023 10:51 AM"; + public static readonly string lastestRelease = "30.09.2023 01:29 PM"; /// /// Represents current version. (Excluding build number) @@ -40,20 +40,20 @@ public class VersionInfo /// /// Represents current full version . (including build number) /// - public static readonly string fullVersion = "0.2.0.2"; + public static readonly string fullVersion = "0.2.0.7"; /// /// Represents current (constant) full version . (including build number) /// - public const string FULL_VERSION = "0.2.0.2"; + public const string FULL_VERSION = "0.2.0.7"; /// /// Represents current build number. (excludes major, minor and revision numbers) /// - public static readonly string build = "2"; + public static readonly string build = "7"; /// /// Represents current (const) build number. (excludes major, minor and revision numbers) /// - public const string BUILD = "2"; + public const string BUILD = "7"; /// /// Represents if the mod has been complied for x64 diff --git a/ModAPI/Properties/FileHistory.txt b/ModAPI/Properties/FileHistory.txt index 308d125..6789ecc 100644 --- a/ModAPI/Properties/FileHistory.txt +++ b/ModAPI/Properties/FileHistory.txt @@ -1 +1 @@ -0.2.0 BUILD 2 \ No newline at end of file +0.2.0 BUILD 7 \ No newline at end of file