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

567 {
568 // spawn preset items into inventory
569 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
570 if (GetCurrentPresetIndex() != -1)
571 {
572 bool is_preset_fixed = IsCurrentPresetFixed();
573 TStringArray preset_array = new TStringArray;
574
575 if (is_preset_fixed)
576 {
577 m_ConfigDebugProfileFixed.GetPresetItems(preset_name, preset_array);
578
579 }
580 else
581 {
582 m_ConfigDebugProfile.GetPresetItems(preset_name, preset_array);
583 }
584
585 if (clear_inventory)
586 {
587 m_Developer.ClearInventory(target);
588 }
589
590 for (int i = 0; i < preset_array.Count(); i++)
591 {
592 float health = -1;
593 int quantity = 1;
594 bool with_physics = false;
595 if (is_preset_fixed)
596 {
597 health = m_ConfigDebugProfileFixed.GetItemHealth(preset_name, i);
598 quantity = m_ConfigDebugProfileFixed.GetItemQuantity(preset_name, i);
599 with_physics = m_ConfigDebugProfileFixed.GetItemWithPhysics(preset_name, i);
600 }
601 else
602 {
603 health = m_ConfigDebugProfile.GetItemHealth(preset_name, i);
604 quantity = m_ConfigDebugProfile.GetItemQuantity(preset_name, i);
605 with_physics = m_ConfigDebugProfile.GetItemWithPhysics(preset_name, i);
606 }
607 if (location == InventoryLocationType.ATTACHMENT)
608 EntityAI ent = m_Developer.SpawnEntityInInventory(target, preset_array.Get(i), -1, quantity, false, preset_name);
609 //m_Developer.SpawnEntityAsAttachment(player, target, preset_array.Get(i), -1, quantity, false, preset_name);
610 else if (location == InventoryLocationType.GROUND)
611 {
612 m_Developer.SpawnEntityOnCursorDir(player, preset_array.Get(i), quantity, distance, health, false, preset_name, with_physics);
613 }
614 }
615 if (g_Game.IsMultiplayer())
616 {
617 ScriptRPC rpc = new ScriptRPC();
618 rpc.Write(preset_name);
619 rpc.Write(target);
620 rpc.Send(player, ERPCs.DEV_RPC_SPAWN_PRESET, true, player.GetIdentity());
621 }
622 else
623 {
624 PluginDeveloper plugin = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
625 plugin.HandlePresetSpawn(player,preset_name,target);
626 }
627 }
628 }
class LogManager EntityAI
DayZGame g_Game
Определения DayZGame.c:4074
ERPCs
Определения ERPCs.c:2
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:326
bool IsCurrentPresetFixed()
Определения ScriptConsoleItemsTab.c:403
PluginDeveloper m_Developer
Определения ScriptConsoleItemsTab.c:26
int GetCurrentPresetIndex()
Определения ScriptConsoleItemsTab.c:393
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)
class array< Class T > TStringArray

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

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