diff --git a/Patches/SwapPatches.cs b/Patches/SwapPatches.cs index be7dde3..111cb21 100644 --- a/Patches/SwapPatches.cs +++ b/Patches/SwapPatches.cs @@ -509,6 +509,9 @@ namespace UIFixes return AccessTools.Method(typeof(Player.FirearmController.Class1015), nameof(Player.FirearmController.Class1015.OnModChanged)); } + // The firearm state machine state Class1015 is the "adding mod" state + // Unpatched, it fires off the success callback before returning to ready state (GClass1608) + // Patched to not be that stupid [PatchPrefix] public static bool Prefix( Player.FirearmController.Class1015 __instance, @@ -533,18 +536,21 @@ namespace UIFixes ___firearmsAnimator_0.Fold(___weapon_0.Folded); __instance.State = Player.EOperationState.Finished; - // Moved from bottom + // Begin change (moved from bottom) ___firearmController_0.InitiateOperation().Start(null); __instance.method_5(gameObject); + // End change ___callback_0.Succeed(); + ___player_0.BodyAnimatorCommon.SetFloat(PlayerAnimator.WEAPON_SIZE_MODIFIER_PARAM_HASH, (float)___weapon_0.CalculateCellSize().X); ___player_0.UpdateFirstPersonGrip(GripPose.EGripType.Common, ___firearmController_0.HandsHierarchy); - Mod mod; - if ((mod = ___item_0 as Mod) != null && mod.HasLightComponent) + + if (___item_0 is Mod mod && mod.HasLightComponent) { ___player_0.SendWeaponLightPacket(); } + ___firearmController_0.WeaponModified(); return false; diff --git a/UIFixes.csproj b/UIFixes.csproj index e5c9d40..d23a8ac 100644 --- a/UIFixes.csproj +++ b/UIFixes.csproj @@ -4,7 +4,7 @@ net471 Tyfon.UIFixes SPT UI Fixes - 1.7.2 + 1.7.3 true latest Debug;Release;Dist diff --git a/server/package.json b/server/package.json index c22525b..22a8594 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "uifixes", - "version": "1.7.2", + "version": "1.7.3", "main": "src/mod.js", "license": "MIT", "author": "Tyfon",