SpawnEntityInInventory queries future parent about free inventory location of the future item
567 {
568 if (target.IsPlayer())
569 {
571 }
573 {
574 InventoryLocation il = new InventoryLocation;
575 if (target.GetInventory() && target.GetInventory().FindFirstFreeLocationForNewEntity(className,
FindInventoryLocationType.ANY, il))
576 {
578 if ( eai && eai.IsInherited(
ItemBase) )
579 {
580 if ( health < 0 )
581 {
582 health = eai.GetMaxHealth();
583 }
586 if ( special )
587 {
588 auto debugParams = DebugSpawnParams.WithPlayer(null);
589 eai.OnDebugSpawnEx(debugParams);
590 }
591 }
592 return eai;
593 }
594 }
595 else
596 {
598 g_Game.GetPlayer().RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_IN_INVENTORY, params,
true,
g_Game.GetPlayer().GetIdentity());
599 }
600 return null;
601 }
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Param7< EntityAI, string, float, float, bool, string, FindInventoryLocationType > DevSpawnItemParams
EntityAI SpawnEntityInPlayerInventory(PlayerBase player, string item_name, float health, float quantity, bool special=false, string presetName="", FindInventoryLocationType locationType=FindInventoryLocationType.ANY)