Skip to content

Commit 5f352df

Browse files
committed
Fixed local items not copying properties properly
1 parent 29a2ca0 commit 5f352df

File tree

7 files changed

+22
-21
lines changed

7 files changed

+22
-21
lines changed

wadsrc/static/zscript/actors/hexen/flechette.zs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,12 @@ class ArtiPoisonBag : Inventory
246246
//
247247
//============================================================================
248248

249-
override Inventory CreateCopy (Actor other)
249+
override Inventory CreateCopy (Actor other, bool force)
250250
{
251251
// Only the base class gets special handling
252252
if (GetClass() != "ArtiPoisonBag")
253253
{
254-
return Super.CreateCopy (other);
254+
return Super.CreateCopy (other, force);
255255
}
256256

257257
class<Actor> spawntype = GetFlechetteType(other);

wadsrc/static/zscript/actors/inventory/ammo.zs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class Ammo : Inventory
132132
//
133133
//===========================================================================
134134

135-
override Inventory CreateCopy (Actor other)
135+
override Inventory CreateCopy (Actor other, bool force)
136136
{
137137
Inventory copy;
138138
int amount = Amount;
@@ -157,7 +157,7 @@ class Ammo : Inventory
157157
}
158158
else
159159
{
160-
copy = Super.CreateCopy (other);
160+
copy = Super.CreateCopy (other, force);
161161
copy.Amount = amount;
162162
}
163163
if (copy.Amount > copy.MaxAmount)
@@ -242,7 +242,7 @@ class BackpackItem : Inventory
242242
//
243243
//===========================================================================
244244

245-
override Inventory CreateCopy (Actor other)
245+
override Inventory CreateCopy (Actor other, bool force)
246246
{
247247
// Find every unique type of ammoitem. Give it to the player if
248248
// he doesn't have it already, and double its maximum capacity.
@@ -292,7 +292,7 @@ class BackpackItem : Inventory
292292
}
293293
}
294294
}
295-
return Super.CreateCopy (other);
295+
return Super.CreateCopy (other, force);
296296
}
297297

298298
//===========================================================================

wadsrc/static/zscript/actors/inventory/armor.zs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ class BasicArmorBonus : Armor
247247
//
248248
//===========================================================================
249249

250-
override Inventory CreateCopy (Actor other)
250+
override Inventory CreateCopy (Actor other, bool force)
251251
{
252-
let copy = BasicArmorBonus(Super.CreateCopy (other));
252+
let copy = BasicArmorBonus(Super.CreateCopy (other, force));
253253
copy.SavePercent = SavePercent;
254254
copy.SaveAmount = SaveAmount;
255255
copy.MaxSaveAmount = MaxSaveAmount;
@@ -366,9 +366,9 @@ class BasicArmorPickup : Armor
366366
//
367367
//===========================================================================
368368

369-
override Inventory CreateCopy (Actor other)
369+
override Inventory CreateCopy (Actor other, bool force)
370370
{
371-
let copy = BasicArmorPickup(Super.CreateCopy (other));
371+
let copy = BasicArmorPickup(Super.CreateCopy (other, force));
372372
copy.SavePercent = SavePercent;
373373
copy.SaveAmount = SaveAmount;
374374
copy.MaxAbsorb = MaxAbsorb;

wadsrc/static/zscript/actors/inventory/health.zs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ class HealthPickup : Inventory
133133
//
134134
//===========================================================================
135135

136-
override Inventory CreateCopy (Actor other)
136+
override Inventory CreateCopy (Actor other, bool force)
137137
{
138-
Inventory copy = Super.CreateCopy (other);
138+
Inventory copy = Super.CreateCopy (other, force);
139139
copy.health = health;
140140
return copy;
141141
}

wadsrc/static/zscript/actors/inventory/inventory.zs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,13 @@ class Inventory : Actor
409409
//
410410
//===========================================================================
411411

412-
virtual Inventory CreateCopy (Actor other)
412+
virtual Inventory CreateCopy (Actor other, bool force = false)
413413
{
414414
Inventory copy;
415-
416-
Amount = MIN(Amount, MaxAmount);
417-
if (GoAway ())
415+
if (!force)
416+
Amount = MIN(Amount, MaxAmount);
417+
418+
if (force || GoAway ())
418419
{
419420
copy = Inventory(Spawn (GetClass()));
420421
copy.Amount = Amount;
@@ -835,7 +836,7 @@ class Inventory : Actor
835836
Inventory give = self;
836837
if (localPickUp)
837838
{
838-
give = Inventory(Spawn(GetClass()));
839+
give = CreateCopy(toucher, true);
839840
if (!give)
840841
return;
841842
}

wadsrc/static/zscript/actors/inventory/weapons.zs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,9 @@ class Weapon : StateProvider
660660
//
661661
//===========================================================================
662662

663-
override Inventory CreateCopy (Actor other)
663+
override Inventory CreateCopy (Actor other, bool force)
664664
{
665-
let copy = Weapon(Super.CreateCopy (other));
665+
let copy = Weapon(Super.CreateCopy (other, force));
666666
if (copy != self && copy != null)
667667
{
668668
copy.AmmoGive1 = AmmoGive1;

wadsrc/static/zscript/actors/strife/coin.zs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ class Coin : Inventory
5858
return false;
5959
}
6060

61-
override Inventory CreateCopy (Actor other)
61+
override Inventory CreateCopy (Actor other, bool force)
6262
{
6363
if (GetClass() == "Coin")
6464
{
65-
return Super.CreateCopy (other);
65+
return Super.CreateCopy (other, force);
6666
}
6767
Inventory copy = Inventory(Spawn("Coin"));
6868
copy.Amount = Amount;

0 commit comments

Comments
 (0)