Adds OnDrop virtual to inventory items. Called on the dropped item at the end of AActor::DropInventory.

This commit is contained in:
Marisa Kirisame 2018-09-16 15:05:57 +02:00 committed by drfrag666
parent 7227f54d1c
commit 9028bbd473
2 changed files with 19 additions and 1 deletions

View file

@ -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;
}

View file

@ -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) {}
}
//===========================================================================