diff --git a/Project Reboot 3.0/FortInventory.cpp b/Project Reboot 3.0/FortInventory.cpp index a7818ca..f18fe37 100644 --- a/Project Reboot 3.0/FortInventory.cpp +++ b/Project Reboot 3.0/FortInventory.cpp @@ -276,11 +276,12 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int auto& ItemInstances = GetItemList().GetItemInstances(); auto& ReplicatedEntries = GetItemList().GetReplicatedEntries(); + auto OldItemCount = ReplicatedEntry->GetCount(); auto NewCount = ReplicatedEntry->GetCount() - Count; bool bOverrideChangeStackSize = false; - if (!bIgnoreVariables && ItemDefinition->ShouldPersistWhenFinalStackEmpty()) + if (!bIgnoreVariables && ItemDefinition->ShouldPersistWhenFinalStackEmpty()) // idk this whole branch is brain damage and definitely doesnt work as intended { bool bIsFinalStack = true; @@ -297,8 +298,10 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int if (bIsFinalStack) { - NewCount = NewCount < 0 ? 0 : NewCount; // min(NewCount, 0) or something i forgot - bOverrideChangeStackSize = true; + NewCount = NewCount < 0 ? 0 : NewCount; // min(NewCount, 0) or something i forgot // hm? + + if (OldItemCount == 0) // hm? + bOverrideChangeStackSize = true; } } diff --git a/Project Reboot 3.0/FortWorldItemDefinition.h b/Project Reboot 3.0/FortWorldItemDefinition.h index d5298c7..ebc6d97 100644 --- a/Project Reboot 3.0/FortWorldItemDefinition.h +++ b/Project Reboot 3.0/FortWorldItemDefinition.h @@ -97,7 +97,7 @@ public: return ReadBitfieldValue(bIgnoreRespawningForDroppingAsPickupOffset, bIgnoreRespawningForDroppingAsPickupFieldMask); } - bool ShouldPersistWhenFinalStackEmpty() + bool ShouldPersistWhenFinalStackEmpty() // Used for Batman Grapnel { static auto bPersistInInventoryWhenFinalStackEmptyOffset = GetOffset("bPersistInInventoryWhenFinalStackEmpty", false);