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

◆ SpawnPreset()

void ScriptConsoleItemsTab::SpawnPreset ( EntityAI target,
bool clear_inventory,
string preset_name,
InventoryLocationType location = InventoryLocationType.ATTACHMENT,
float distance = 0 )
inlineprotected

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

566 {
567 // spawn preset items into inventory
568 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
569 if (GetCurrentPresetIndex() != -1)
570 {
571 bool is_preset_fixed = IsCurrentPresetFixed();
572 TStringArray preset_array = new TStringArray;
573
574 if (is_preset_fixed)
575 {
576 m_ConfigDebugProfileFixed.GetPresetItems(preset_name, preset_array);
577
578 }
579 else
580 {
581 m_ConfigDebugProfile.GetPresetItems(preset_name, preset_array);
582 }
583
584 if (clear_inventory)
585 {
586 m_Developer.ClearInventory(target);
587 }
588
589 for (int i = 0; i < preset_array.Count(); i++)
590 {
591 float health = -1;
592 int quantity = 1;
593 bool with_physics = false;
594 if (is_preset_fixed)
595 {
596 health = m_ConfigDebugProfileFixed.GetItemHealth(preset_name, i);
597 quantity = m_ConfigDebugProfileFixed.GetItemQuantity(preset_name, i);
598 with_physics = m_ConfigDebugProfileFixed.GetItemWithPhysics(preset_name, i);
599 }
600 else
601 {
602 health = m_ConfigDebugProfile.GetItemHealth(preset_name, i);
603 quantity = m_ConfigDebugProfile.GetItemQuantity(preset_name, i);
604 with_physics = m_ConfigDebugProfile.GetItemWithPhysics(preset_name, i);
605 }
606 if (location == InventoryLocationType.ATTACHMENT)
607 EntityAI ent = m_Developer.SpawnEntityInInventory(target, preset_array.Get(i), -1, quantity, false, preset_name);
608 //m_Developer.SpawnEntityAsAttachment(player, target, preset_array.Get(i), -1, quantity, false, preset_name);
609 else if (location == InventoryLocationType.GROUND)
610 {
611 m_Developer.SpawnEntityOnCursorDir(player, preset_array.Get(i), quantity, distance, health, false, preset_name, with_physics);
612 }
613 }
614 if (GetGame().IsMultiplayer())
615 {
616 ScriptRPC rpc = new ScriptRPC();
617 rpc.Write(preset_name);
618 rpc.Write(target);
619 rpc.Send(player, ERPCs.DEV_RPC_SPAWN_PRESET, true, player.GetIdentity());
620 }
621 else
622 {
623 PluginDeveloper plugin = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
624 plugin.HandlePresetSpawn(player,preset_name,target);
625 }
626 }
627 }
class LogManager EntityAI
ERPCs
Определения ERPCs.c:2
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
PlayerBase GetPlayer()
Определения ModifierBase.c:51
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
bool IsCurrentPresetFixed()
Определения ScriptConsoleItemsTab.c:402
PluginDeveloper m_Developer
Определения ScriptConsoleItemsTab.c:26
int GetCurrentPresetIndex()
Определения ScriptConsoleItemsTab.c:392
PluginConfigDebugProfile m_ConfigDebugProfile
Определения ScriptConsoleTabBase.c:11
PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed
Определения ScriptConsoleTabBase.c:12
proto native void Send(Object target, int rpc_type, bool guaranteed, PlayerIdentity recipient=NULL)
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on ser...
proto bool Write(void value_out)
proto native CGame GetGame()
array< string > TStringArray
Определения EnScript.c:685

Перекрестные ссылки GetCurrentPresetIndex(), GetGame(), GetPlayer(), GetPlugin(), IsCurrentPresetFixed(), ScriptConsoleTabBase::m_ConfigDebugProfile, ScriptConsoleTabBase::m_ConfigDebugProfileFixed, m_Developer, ScriptRPC::Send() и Serializer::Write().

Используется в OnClick().