mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 01:21:17 +00:00
Adds OnDrop virtual to inventory items. Called on the dropped item at the end of AActor::DropInventory.
This commit is contained in:
parent
7227f54d1c
commit
9028bbd473
2 changed files with 19 additions and 1 deletions
|
@ -1172,6 +1172,14 @@ AInventory *AActor::DropInventory (AInventory *item, int amt)
|
|||
drop->Vel += Vel;
|
||||
drop->flags &= ~MF_NOGRAVITY; // Don't float
|
||||
drop->ClearCounters(); // do not count for statistics again
|
||||
{
|
||||
// [MK] call OnDrop so item can change its drop behaviour
|
||||
IFVIRTUALPTR(drop, AInventory, OnDrop)
|
||||
{
|
||||
VMValue params[] = { drop, this };
|
||||
VMCall(func, params, 2, nullptr, 0);
|
||||
}
|
||||
}
|
||||
return drop;
|
||||
}
|
||||
|
||||
|
|
|
@ -907,6 +907,16 @@ class Inventory : Actor native
|
|||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AInventory :: OnDrop
|
||||
//
|
||||
// Called by AActor::DropInventory. Allows items to modify how they behave
|
||||
// after being dropped.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
virtual void OnDrop (Actor dropper) {}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
Loading…
Reference in a new issue