- scriptified AddInventory.
This commit is contained in:
parent
d812b94d57
commit
a426655d61
8 changed files with 64 additions and 68 deletions
|
|
@ -350,6 +350,7 @@ DEFINE_FIELD(AActor, RenderHidden)
|
|||
DEFINE_FIELD(AActor, RenderRequired)
|
||||
DEFINE_FIELD(AActor, friendlyseeblocks)
|
||||
DEFINE_FIELD(AActor, SpawnTime)
|
||||
DEFINE_FIELD(AActor, InventoryID)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
@ -752,46 +753,6 @@ DEFINE_ACTION_FUNCTION(AActor, SetState)
|
|||
ACTION_RETURN_BOOL(self->SetState(state, nofunction));
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// AActor :: AddInventory
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void AActor::AddInventory (AInventory *item)
|
||||
{
|
||||
// Check if it's already attached to an actor
|
||||
if (item->Owner != NULL)
|
||||
{
|
||||
// Is it attached to us?
|
||||
if (item->Owner == this)
|
||||
return;
|
||||
|
||||
// No, then remove it from the other actor first
|
||||
item->Owner->RemoveInventory (item);
|
||||
}
|
||||
|
||||
item->Owner = this;
|
||||
item->Inventory = Inventory;
|
||||
Inventory = item;
|
||||
|
||||
// Each item receives an unique ID when added to an actor's inventory.
|
||||
// This is used by the DEM_INVUSE command to identify the item. Simply
|
||||
// using the item's position in the list won't work, because ticcmds get
|
||||
// run sometime in the future, so by the time it runs, the inventory
|
||||
// might not be in the same state as it was when DEM_INVUSE was sent.
|
||||
Inventory->InventoryID = InventoryID++;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, AddInventory)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_OBJECT_NOT_NULL(item, AInventory);
|
||||
self->AddInventory(item);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// AActor :: GiveInventory
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue