diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 2658a052f..7dd0cfc2b 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -534,7 +534,9 @@ class Actor : Thinker native // [AA] Called by inventory items at the end of CallTryPickup to let actors // do something with the items they've received. 'Item' might be null for // items that disappear on pickup. - virtual void HasReceived(Inventory item) {} + // 'itemcls' is passed unconditionally, so it can still be read even if + // 'item' is null due to being destroyed with GoAwayAndDie() on pickup. + virtual void HasReceived(Inventory item, class itemcls) {} // Called in TryMove if the mover ran into another Actor. This isn't called on players // if they're currently predicting. Guarantees collisions unlike CanCollideWith. @@ -705,7 +707,7 @@ class Actor : Thinker native native void SoundAlert(Actor target, bool splash = false, double maxdist = 0); native void ClearBounce(); native TerrainDef GetFloorTerrain(); - native bool CheckLocalView(int consoleplayer = -1 /* parameter is not used anymore but needed for backward compatibilityö. */); + native bool CheckLocalView(int consoleplayer = -1 /* parameter is not used anymore but needed for backward compatibility�. */); native bool CheckNoDelay(); native bool UpdateWaterLevel (bool splash = true); native bool IsZeroDamage(); diff --git a/wadsrc/static/zscript/actors/inventory/inventory.zs b/wadsrc/static/zscript/actors/inventory/inventory.zs index 0ca6faf3e..52009f2e1 100644 --- a/wadsrc/static/zscript/actors/inventory/inventory.zs +++ b/wadsrc/static/zscript/actors/inventory/inventory.zs @@ -647,9 +647,10 @@ class Inventory : Actor // unmorphed versions of a currently morphed actor cannot pick up anything. if (bUnmorphed) return false, null; - //[AA] starting with true, so that CanReceive can unset it, + // [AA] starting with true, so that CanReceive can unset it, // if necessary: bool res = true; + class cls = self.GetClass(); // [AA] CanReceive lets the actor receiving the item process it first. if (!toucher.CanReceive(self)) { @@ -696,7 +697,7 @@ class Inventory : Actor } } // [AA] Let the toucher do something with the item they've just received: - toucher.HasReceived(self); + toucher.HasReceived(self, cls); // If the item can be shared, make sure every player gets a copy. if (multiplayer && !deathmatch && !bDropped && ShouldShareItem(toucher))