PreTravelled virtual for player and inventory.

This commit is contained in:
Marisa Kirisame 2021-10-15 17:10:56 +02:00 committed by Christoph Oelckers
parent bc75dc056e
commit d5ad8b28ec
2 changed files with 32 additions and 0 deletions

View file

@ -853,6 +853,17 @@ class Inventory : Actor
}
}
//===========================================================================
//
// Inventory :: PreTravelled
//
// Called when an item in somebody's inventory is about to be carried
// over to another map, in case it needs to do special clean-up.
//
//===========================================================================
virtual void PreTravelled() {}
//===========================================================================
//
// Inventory :: Travelled

View file

@ -2083,6 +2083,15 @@ class PlayerPawn : Actor
me.ClearInventory();
me.GiveDefaultInventory();
}
// [MK] notify self and inventory that we're about to travel
// this must be called here so these functions can still have a
// chance to alter the world before a snapshot is done in hubs
me.PreTravelled();
for (item = me.Inv; item != NULL; item = item.Inv)
{
item.PreTravelled();
}
}
//===========================================================================
@ -2461,6 +2470,18 @@ class PlayerPawn : Actor
return wasdrowning;
}
//===========================================================================
//
// PlayerPawn :: PreTravelled
//
// Called before the player moves to another map, in case it needs to do
// special clean-up. This is called right before all carried items
// execute their respective PreTravelled() virtuals.
//
//===========================================================================
virtual void PreTravelled() {}
//===========================================================================
//
// PlayerPawn :: Travelled