DayZ 1.29
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 строка 698

699 {
700 if ( g_Game.IsServer() )
701 {
702 Weapon_Base wpn = Weapon_Base.Cast(parent);
703 if (wpn)
704 {
705 GameInventory inventory = parent.GetInventory();
706 return inventory.CreateInInventory(att_name);
707 /*
708 vector pos = player.GetPosition();
709 EntityAI eai_gnd = SpawnEntityOnGroundPos(player, att_name, health, quantity, pos);
710 Magazine mag_gnd = Magazine.Cast(eai_gnd);
711 if (mag_gnd && player.GetWeaponManager().CanAttachMagazine(wpn, mag_gnd))
712 {
713 player.GetWeaponManager().AttachMagazine(mag_gnd);
714 }
715 return eai_gnd;
716 */
717 }
718 else
719 {
720 EntityAI eai = parent.GetInventory().CreateAttachment(att_name);
721 if (eai)
722 {
723 if ( eai.IsInherited(ItemBase) )
724 {
725 ItemBase i = ItemBase.Cast( eai );
726 SetupSpawnedItem(ItemBase.Cast( eai ), health, quantity);
727 }
728 return eai;
729 }
730 else
731 OnSpawnErrorReport(att_name);
732 }
733 return NULL;
734 }
735 else
736 {
737 // Client -> Server Spawning: Client Side
738 Param3<string, float, float> params = new Param3<string, float, float>(att_name, health, quantity);
739 player.RPCSingleParam(ERPCs.DEV_RPC_SPAWN_ITEM_AS_ATTACHMENT, params, true);
740 }
741 return NULL;
742 }
class LogManager EntityAI
DayZGame g_Game
Определения DayZGame.c:3942
ERPCs
Определения ERPCs.c:2
class GP5GasMask extends MaskBase ItemBase
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4931
EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
void OnSpawnErrorReport(string name)
Определения PluginDeveloper.c:294

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