Fixed local items not copying properties properly

Revert "Fixed local items not copying properties properly"

This reverts commit 5f352df587c629545fafc09e80428e645f5e8df3.

...
This commit is contained in:
Boondorl 2024-04-14 20:09:10 -04:00 committed by Christoph Oelckers
parent 0328eca7f0
commit 70a165b566
1 changed files with 18 additions and 1 deletions

View File

@ -12,6 +12,7 @@ class Inventory : Actor
private bool bSharingItem; // Currently being shared (avoid infinite recursions).
private bool pickedUp[MAXPLAYERS]; // If items are set to local, track who already picked it up.
private bool bCreatingCopy; // Tells GoAway that it needs to return true so a new copy of the item is spawned.
deprecated("3.7") private int ItemFlags;
Actor Owner; // Who owns this item? NULL if it's still a pickup.
@ -835,9 +836,11 @@ class Inventory : Actor
Inventory give = self;
if (localPickUp)
{
give = Inventory(Spawn(GetClass()));
give = CreateLocalCopy(toucher);
if (!give)
return;
localPickUp = give != self;
}
bool res;
@ -1043,6 +1046,9 @@ class Inventory : Actor
protected bool GoAway ()
{
if (bCreatingCopy)
return true;
// Dropped items never stick around
if (bDropped)
{
@ -1114,6 +1120,17 @@ class Inventory : Actor
DisableLocalRendering(pNum, true);
}
// Force spawn a new version of the item. This needs to use CreateCopy so that
// any transferrable properties on the item get correctly set.
Inventory CreateLocalCopy(Actor client)
{
bCreatingCopy = true;
let item = CreateCopy(client);
bCreatingCopy = false;
return item;
}
//===========================================================================
//
// Inventory :: ModifyDamage