mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
a bit of stuff
toys, ammo in bottom right kinda, fix lootin speeds, being inaccurate, playlist looting kindof, or some things just not working.
This commit is contained in:
@@ -170,7 +170,7 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
|
||||
return std::make_pair(NewItemInstances, ModifiedItemInstances);
|
||||
}
|
||||
|
||||
bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count)
|
||||
bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count, bool bForceRemoval)
|
||||
{
|
||||
if (bShouldUpdate)
|
||||
*bShouldUpdate = false;
|
||||
@@ -188,8 +188,11 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
|
||||
|
||||
auto NewCount = ReplicatedEntry->GetCount() - Count;
|
||||
|
||||
if (NewCount > 0)
|
||||
if (NewCount > 0 || (ItemDefinition->ShouldPersistWhenFinalStackEmpty() && !bForceRemoval))
|
||||
{
|
||||
if (ItemDefinition->ShouldPersistWhenFinalStackEmpty())
|
||||
NewCount = NewCount < 0 ? 0 : NewCount; // min(NewCount, 0) or something i forgot
|
||||
|
||||
ItemInstance->GetItemEntry()->GetCount() = NewCount;
|
||||
ReplicatedEntry->GetCount() = NewCount;
|
||||
|
||||
@@ -291,6 +294,28 @@ UFortItem* AFortInventory::FindItemInstance(UFortItemDefinition* ItemDefinition)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void AFortInventory::CorrectLoadedAmmo(const FGuid& Guid, int NewAmmoCount)
|
||||
{
|
||||
auto CurrentWeaponInstance = FindItemInstance(Guid);
|
||||
|
||||
if (!CurrentWeaponInstance)
|
||||
return;
|
||||
|
||||
auto CurrentWeaponReplicatedEntry = FindReplicatedEntry(Guid);
|
||||
|
||||
if (!CurrentWeaponReplicatedEntry)
|
||||
return;
|
||||
|
||||
if (CurrentWeaponReplicatedEntry->GetLoadedAmmo() != NewAmmoCount)
|
||||
{
|
||||
CurrentWeaponInstance->GetItemEntry()->GetLoadedAmmo() = NewAmmoCount;
|
||||
CurrentWeaponReplicatedEntry->GetLoadedAmmo() = NewAmmoCount;
|
||||
|
||||
GetItemList().MarkItemDirty(CurrentWeaponInstance->GetItemEntry());
|
||||
GetItemList().MarkItemDirty(CurrentWeaponReplicatedEntry);
|
||||
}
|
||||
}
|
||||
|
||||
UFortItem* AFortInventory::FindItemInstance(const FGuid& Guid)
|
||||
{
|
||||
auto& ItemInstances = GetItemList().GetItemInstances();
|
||||
|
||||
Reference in New Issue
Block a user