mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-27 22:42:29 +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 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.
|
||||
virtual bool CanCollideWith(Actor other, bool passive)
|
||||
{
|
||||
|
|
|
@ -768,6 +768,9 @@ class Inventory : Actor
|
|||
|
||||
bool localview = toucher.CheckLocalView();
|
||||
|
||||
if (!toucher.CanTouchItem(self))
|
||||
return;
|
||||
|
||||
bool res;
|
||||
[res, toucher] = CallTryPickup(toucher);
|
||||
if (!res) return;
|
||||
|
|
Loading…
Reference in a new issue