DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ SpawnEntityAsAttachment()

EntityAI PluginBase::SpawnEntityAsAttachment ( PlayerBase player,
EntityAI parent,
string att_name,
float health,
float quantity )
inlineprotected

tries to spawn item as attachment

Аргументы
[in]healthhealth of the item
[in]quantityquantity to set if item.HasQuantity() (-1 == set to max)
Возвращает
entity if ok, null otherwise

См. определение в файле PluginDeveloper.c строка 634

635 {
636 if ( GetGame().IsServer() )
637 {
638 Weapon_Base wpn = Weapon_Base.Cast(parent);
639 if (wpn)
640 {
641 GameInventory inventory = parent.GetInventory();
642 return inventory.CreateInInventory(att_name);
643 /*
644 vector pos = player.GetPosition();
645 EntityAI eai_gnd = SpawnEntityOnGroundPos(player, att_name, health, quantity, pos);
646 Magazine mag_gnd = Magazine.Cast(eai_gnd);
647 if (mag_gnd && player.GetWeaponManager().CanAttachMagazine(wpn, mag_gnd))
648 {
649 player.GetWeaponManager().AttachMagazine(mag_gnd);
650 }
651 return eai_gnd;
652 */
653 }
654 else
655 {
656 EntityAI eai = parent.GetInventory().CreateAttachment(att_name);
657 if (eai)
658 {
659 if ( eai.IsInherited(ItemBase) )
660 {
661 ItemBase i = ItemBase.Cast( eai );
662 SetupSpawnedItem(ItemBase.Cast( eai ), health, quantity);
663 }
664 return eai;
665 }
666 else
667 OnSpawnErrorReport(att_name);
668 }
669 return NULL;
670 }
671 else
672 {
673 // Client -> Server Spawning: Client Side
674 Param3<string, float, float> params = new Param3<string, float, float>(att_name, health, quantity);
675 player.RPCSingleParam(ERPCs.DEV_RPC_SPAWN_ITEM_AS_ATTACHMENT, params, true);
676 }
677 return NULL;
678 }
class LogManager EntityAI
ERPCs
Определения ERPCs.c:2
class GP5GasMask extends MaskBase ItemBase
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
Определения Inventory.c:874
void OnSpawnErrorReport(string name)
Определения PluginDeveloper.c:294
proto native CGame GetGame()

Перекрестные ссылки GameInventory::CreateInInventory(), GetGame(), OnSpawnErrorReport() и SetupSpawnedItem().