mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +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
4c13a8df6e
commit
38c8f0d585
2 changed files with 19 additions and 1 deletions
|
@ -1158,6 +1158,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -906,7 +906,17 @@ class Inventory : Actor native
|
|||
return item;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// 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