mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-18 10:11:11 +00:00
Added CanTouchItem virtual.
- Allows an actor with +PICKUP flag to determine if it can pick up specific items or not.
This commit is contained in:
parent
0fb940632a
commit
6327734659
2 changed files with 12 additions and 0 deletions
|
@ -460,6 +460,15 @@ class Actor : Thinker native
|
||||||
native void Substitute(Actor replacement);
|
native void Substitute(Actor replacement);
|
||||||
native ui void DisplayNameTag();
|
native ui void DisplayNameTag();
|
||||||
|
|
||||||
|
// Called by inventory items to see if this actor is capable of touching them.
|
||||||
|
// If true, the item will attempt to be picked up. Useful for things like
|
||||||
|
// allowing morphs to pick up limited items such as keys while preventing
|
||||||
|
// them from picking other items up.
|
||||||
|
virtual bool CanTouchItem(Inventory item)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Called by PIT_CheckThing to check if two actors actually can collide.
|
// Called by PIT_CheckThing to check if two actors actually can collide.
|
||||||
virtual bool CanCollideWith(Actor other, bool passive)
|
virtual bool CanCollideWith(Actor other, bool passive)
|
||||||
{
|
{
|
||||||
|
|
|
@ -768,6 +768,9 @@ class Inventory : Actor
|
||||||
|
|
||||||
bool localview = toucher.CheckLocalView();
|
bool localview = toucher.CheckLocalView();
|
||||||
|
|
||||||
|
if (!toucher.CanTouchItem(self))
|
||||||
|
return;
|
||||||
|
|
||||||
bool res;
|
bool res;
|
||||||
[res, toucher] = CallTryPickup(toucher);
|
[res, toucher] = CallTryPickup(toucher);
|
||||||
if (!res) return;
|
if (!res) return;
|
||||||
|
|
Loading…
Reference in a new issue