DayZ 1.30
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 строка 747

748 {
749 if ( g_Game.IsServer() )
750 {
751 Weapon_Base wpn = Weapon_Base.Cast(parent);
752 if (wpn)
753 {
754 GameInventory inventory = parent.GetInventory();
755 return inventory.CreateInInventory(att_name);
756 /*
757 vector pos = player.GetPosition();
758 EntityAI eai_gnd = SpawnEntityOnGroundPos(player, att_name, health, quantity, pos);
759 Magazine mag_gnd = Magazine.Cast(eai_gnd);
760 if (mag_gnd && player.GetWeaponManager().CanAttachMagazine(wpn, mag_gnd))
761 {
762 player.GetWeaponManager().AttachMagazine(mag_gnd);
763 }
764 return eai_gnd;
765 */
766 }
767 else
768 {
769 EntityAI eai = parent.GetInventory().CreateAttachment(att_name);
770 if (eai)
771 {
772 if ( eai.IsInherited(ItemBase) )
773 {
774 ItemBase i = ItemBase.Cast( eai );
775 SetupSpawnedItem(ItemBase.Cast( eai ), health, quantity);
776 }
777 return eai;
778 }
779 else
780 OnSpawnErrorReport(att_name);
781 }
782 return NULL;
783 }
784 else
785 {
786 // Client -> Server Spawning: Client Side
787 Param3<string, float, float> params = new Param3<string, float, float>(att_name, health, quantity);
788 player.RPCSingleParam(ERPCs.DEV_RPC_SPAWN_ITEM_AS_ATTACHMENT, params, true);
789 }
790 return NULL;
791 }
class LogManager EntityAI
DayZGame g_Game
Определения DayZGame.c:4074
ERPCs
Определения ERPCs.c:2
class GP5GasMask extends MaskBase ItemBase
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4972
EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
void OnSpawnErrorReport(string name)
Определения PluginDeveloper.c:343

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