95 int objectsCount =
g_Game.ConfigGetChildrenCount(configPath);
96 for (
int j = 0; j < objectsCount; j++)
99 g_Game.ConfigGetChildName(configPath, j, childName);
100 int scope =
g_Game.ConfigGetInt(configPath +
" " + childName +
" scope");
101 int categoryMask =
g_Game.ConfigGetInt(configPath +
" " + childName +
" debug_ItemCategory") - 1;
103 g_Game.ConfigGetText(configPath +
" " + childName +
" displayName", displayName);
105 m_Items.Insert(childName,
new ScriptConsoleItem(childName, displayName, scope, categoryMask));
112 #ifdef DIAG_DEVELOPER
115 case ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND:
119 case ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND_PATTERN_GRID:
123 case ERPCs.DEV_RPC_SPAWN_ITEM_ON_CURSOR:
127 case ERPCs.DEV_RPC_SPAWN_ITEM_IN_INVENTORY:
131 case ERPCs.DEV_RPC_CLEAR_INV:
135 case ERPCs.DEV_RPC_SEND_SERVER_LOG:
139 case ERPCs.RPC_SYNC_SCENE_OBJECT:
143 case ERPCs.DEV_RPC_PLUGIN_DZCREATURE_DEBUG:
147 case ERPCs.DEV_RPC_SPAWN_PRESET:
151 ctx.
Read(presetName);
157 case ERPCs.DEV_RPC_SET_TIME:
172 Param1<string> msg_p =
new Param1<string>(msg_log);
183 g_Game.GetPlayers( players );
185 for (
int i = 0; i < players.Count(); ++i )
187 Param1<string> param =
new Param1<string>( msg );
188 Man player = players.Get(i);
190 if ( player && player.HasNetworkID() )
192 player.RPCSingleParam(
ERPCs.DEV_RPC_SEND_SERVER_LOG, param,
true, player.GetIdentity());
200 Param3<string, EntityAI, Param> par =
new Param3<string, EntityAI, Param>(
"", NULL,
new Param );
202 if ( ctx.
Read( par ) )
205 SceneData scene_data = module_scene_editor.GetLoadedScene();
215 if (pluginDZCreatureDebug)
217 pluginDZCreatureDebug.OnRpc(player, rpc_type, ctx);
224 Param5<int,int,int,int,int> p5 =
new Param5<int,int,int,int,int>(0,0,0,0,0);
227 int year = p5.param1;
228 int month = p5.param2;
230 int hour = p5.param4;
231 int minute = p5.param5;
233 g_Game.GetWorld().SetDate(year,month, day, hour, minute);
251 targetPlayer.m_PresetSpawned =
true;
257 PresetSpawnBase presetObj = PresetSpawnBase.Cast(type.Spawn());
261 presetObj.Init(targetPlayer);
272 Param1<string> param =
new Param1<string>(
"" );
274 if ( ctx.
Read(param) && param.param1 !=
"" )
288 Param7<string, float, float, float, bool, string, bool> p =
new Param7<string, float, float, float, bool, string, bool>(
"", 0, 0, 0,
false,
"",
false);
297 Param6<string, float, float, vector, bool, bool> p =
new Param6<string, float, float, vector, bool, bool>(
"", 0, 0,
"0 0 0",
false,
false);
306 auto p =
new Param10<string,int, float, float, int, int, float, float, bool, bool>(
"",0,0,0,0,0,0,0,
false,
false);
309 SpawnEntityOnGroundPatternGrid(player, p.param1, p.param2, p.param3, p.param4, p.param5, p.param6, p.param7, p.param8, p.param9, p.param10);
322 if (playerTarget && p.param5)
324 if (playerTarget.m_PresetSpawned)
326 playerTarget.m_PresetSpawned =
false;
327 playerTarget.m_PresetItems.Clear();
331 playerTarget.m_PresetItems.Insert(ent);
345 PrintString(
"PluginDeveloper.SpawnEntity() Warning- Cant spawn object: " +
name);
347 PrintString(
"PluginDeveloper.SpawnEntity() Warning END");
353 if (presetName && player && player.m_PresetSpawned)
355 player.m_PresetItems.Clear();
356 player.m_PresetSpawned =
false;
361 plr.OnSpawnedFromConsole();
363 else if ( entity.IsInherited(
ItemBase) )
368 else if (entity.IsInherited(
House))
370 entity.PlaceOnSurface();
371 vector pos = entity.GetPosition();
372 vector ori =
g_Game.GetSurfaceOrientation(pos[0], pos[2]);
373 entity.SetOrientation(ori);
375 if (player && presetName)
377 player.m_PresetItems.Insert(entity);
384 auto debugParamsPlayer = DebugSpawnParams.WithPlayer(player);
385 entity.OnDebugSpawnEx(debugParamsPlayer);
389 auto debugParamsNone = DebugSpawnParams.None();
390 entity.OnDebugSpawnEx(debugParamsNone);
397 void SpawnEntityOnGroundPatternGrid(
PlayerBase player,
string item_name,
int count,
float health,
float quantity,
int rows,
int columns,
float gapRow = 1,
float gapColumn = 1,
bool special=
false,
bool withPhysics =
false)
406 float columnDist = 0;
415 for (
int i = 0; i < rows; i++)
417 vector posRow = playerPos + camDirForward * rowDist;
420 for (
int j = 0; j < columns; j++)
422 offsetSide = camDirRight * columnDist;
423 vector placement = posRow + offsetSide;
424 float hlth = health * MiscGameplayFunctions.GetTypeMaxGlobalHealth( item_name );
426 ent.PlaceOnSurface();
430 item.ThrowPhysically(null,
"0 0 0");
433 if (countLoop == count)
437 columnDist += gapColumn;
444 auto params =
new Param10<string, int, float, float, int, int, float, float, bool, bool>(item_name, count, health, quantity, rows, columns, gapRow, gapColumn, special, withPhysics);
445 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND_PATTERN_GRID, params,
true);
451 bool is_ai =
g_Game.IsKindOf(object_name,
"DZ_LightAI");
462 direction =
g_Game.GetCurrentCameraDirection();
464 if ((
g_Game.IsDedicatedServer() || allowFreeflight) && FreeDebugCamera.GetInstance().IsActive())
466 position = FreeDebugCamera.GetInstance().GetPosition();
467 direction = FreeDebugCamera.GetInstance().GetDirection();
471 if (player && !allowFreeflight)
474 direction = player.GetDirection();
482 return player.SpawnEntityOnGroundPos(object_name, pos);
485 bool is_AI =
g_Game.IsKindOf(object_name,
"DZ_LightAI");
488 return SpawnAI(object_name, pos);
500 if (
g_Game.IsKindOf(object_name,
"Boat"))
510 void SpawnItemOnCrosshair(
PlayerBase player,
string itemName,
float health,
float quantity,
float maxDist = 100,
bool allowFreeflight =
false,
bool special =
false,
bool withPhysics =
false)
514 to = from + (dir * maxDist);
553 item.ThrowPhysically(null,
"0 0 0");
559 Param6<string, float, float, vector, bool, bool> params =
new Param6<string, float, float, vector, bool, bool>(item_name, health, quantity, pos, special, withPhysics);
560 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND, params,
true);
578 EntityAI entity = player.SpawnEntityOnGroundOnCursorDir(item_name, distance);
582 if ( !entity.IsBuilding() && health < 0 && entity.GetMaxHealth() > 0)
584 health = entity.GetMaxHealth();
593 item.ThrowPhysically(null,
"0 0 0");
600 Param7<string, float, float, float, bool, string, bool> params =
new Param7<string, float, float, float, bool, string, bool>(item_name, quantity, distance, health, special, presetName, withPhysics);
601 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_ON_CURSOR, params,
true);
617 if (target.IsPlayer())
624 if (target.GetInventory() && target.GetInventory().FindFirstFreeLocationForNewEntity(className,
FindInventoryLocationType.ANY, il))
627 if ( eai && eai.IsInherited(
ItemBase) )
631 health = eai.GetMaxHealth();
637 auto debugParams = DebugSpawnParams.WithPlayer(null);
638 eai.OnDebugSpawnEx(debugParams);
647 g_Game.GetPlayer().RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_IN_INVENTORY, params,
true,
g_Game.GetPlayer().GetIdentity());
660 if (!
g_Game.IsMultiplayer())
661 player.DropItem(player.GetItemInHands());
663 player.ServerDropEntity(player.GetItemInHands());
672 if (
g_Game.IsKindOf(item_name,
"Transport"))
675 auto debugParams = DebugSpawnParams.WithPlayer(player);
676 vehicle.OnDebugSpawnEx(debugParams);
678 if (
g_Game.IsMultiplayer())
684 player.SetGetInVehicleDebug(vehicle);
692 if (player.GetInventory() && player.GetInventory().FindFirstFreeLocationForNewEntity(item_name, locationType, il))
698 vector pos = player.GetPosition();
700 Magazine mag_gnd = Magazine.Cast(eai_gnd);
701 if (mag_gnd && player.GetWeaponManager().CanAttachMagazine(wpn, mag_gnd))
703 player.GetWeaponManager().AttachMagazine(mag_gnd);
710 if ( eai && eai.IsInherited(
ItemBase) )
714 health = eai.GetMaxHealth();
720 auto debugParams2 = DebugSpawnParams.WithPlayer(player);
721 eai.OnDebugSpawnEx(debugParams2);
735 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_IN_INVENTORY, params,
true);
769 EntityAI eai = parent.GetInventory().CreateAttachment(att_name);
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);
797 if ( menu_curr == NULL )
803 player.SetIsInThirdPerson(!player.IsInThirdPerson());
806 vector pos_player, pos_direction;
811 g_Game.CopyFromClipboard(clipboard);
824 clipboard.
Split(
",", items );
826 foreach (
string item:items)
845 entity.ClearInventory();
849 Param1<int> params =
new Param1<int>(0);
850 entity.RPCSingleParam(
ERPCs.DEV_RPC_CLEAR_INV, params,
true);
856 if (
g_Game.GetUIManager().GetMenu() == NULL )
862 g_Game.GetUIManager().Back();
870 if (
g_Game.GetUIManager().GetMenu() == NULL )
876 g_Game.GetUIManager().Back();
877 g_Game.GetMission().RemoveActiveInputExcludes({
"menu"},
true);
887 g_Game.GetUIManager().Back();
888 g_Game.GetMission().RemoveActiveInputExcludes({
"menu"},
true);
892 if (
g_Game.GetUIManager().GetMenu() )
893 g_Game.GetUIManager().GetMenu().Close();
896 g_Game.GetMission().AddActiveInputExcludes({
"menu"});
924 if ( menu_curr == NULL )
947 string pivot = arr.Get( left );
957 if ( i > right || arr.Get(i) > pivot )
966 if ( arr.Get(j) <= pivot )
978 arr.
Set( i, arr.Get(j) );
982 temp = arr.
Get( left );
983 arr.
Set( left, arr.Get(j) );
1010 g_Game.GetMission().ResetGUI();
1020 g_Game.GetInput().ChangeGameFocus(1);
1021 g_Game.GetUIManager().ShowUICursor(
true);
1024 if (
g_Game.IsMultiplayer())
1026 g_Game.RPCSingleParam(
g_Game.GetPlayer(),
ERPCs.DEV_SET_DEV_ITEM,
new Param1<Object>(entity),
true,
g_Game.GetPlayer().GetIdentity());
1031 mid2.RegisterDebugItem(entity, player);
1034 SetDebugDeveloper_item(entity);
1044 FreeDebugCamera debugCam = FreeDebugCamera.GetInstance();
1045 if (debugCam && debugCam.GetCurrentCamera())
1047 entity = debugCam.GetCrosshairObject();
1052 if (player && player.GetActionManager())
1054 ActionTarget at = player.GetActionManager().FindActionTarget();
1055 entity = at.GetObject();
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
const int ECE_EQUIP_ATTACHMENTS
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
const CallID CALL_ID_SCR_CNSL_HISTORY_NEXT
const CallID CALL_ID_SCR_CNSL_HISTORY_BACK
const CallID CALL_ID_SCR_CNSL_ADD_PRINT
Param CallMethod(CallID call_id, Param params)
FindInventoryLocationType
flags for searching locations in inventory
void SetupSpawnedItem(ItemBase item, float health, float quantity)
override void ClearInventory()
class OptionSelectorMultistate extends OptionSelector class_name
void PluginDayZCreatureAIDebug()
Param7 DevSpawnItemParams
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
Super root of all classes in Enforce script.
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
static void ReceivedLogMessageFromServer(string message)
static void OnSetFreeCameraEvent(PlayerBase player, FreeDebugCamera camera)
static bool IsFreeCameraEnabled()
static void FreeCameraToggle(PlayerBase player, bool teleport_player=false)
Enable / Disable Free camera (Fly mod) - disable of camera will teleport player at current free camer...
static void OnRPC(PlayerBase player, int rpc_type, ParamsReadContext ctx)
static void TeleportAtCursorEx()
static void SetPlayerDirection(PlayerBase player, vector direction)
static void SetPlayerPosition(PlayerBase player, vector position, bool breakSync=false)
EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
script counterpart to engine's class Inventory
proto native EntityAI GetParent()
returns parent of current inventory location
proto native vector GetPos()
returns position of item in world if type is Ground
proto native int GetSlot()
returns slot id if current type is Attachment
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
provides access to slot configuration
void ScriptConsoleItem(string name, string displayName, int scope, int categoryMask=-1)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
EntityAI SpawnEntityAsAttachment(PlayerBase player, EntityAI parent, string att_name, float health, float quantity)
tries to spawn item as attachment
void ToggleFreeCamera()
Enable / Disable Free camera (Fly mod) - disable of camera will teleport player at current free camer...
static ref map< string, ref ScriptConsoleItem > m_Items
EntityAI SpawnEntityOnCursorDir(PlayerBase player, string item_name, float quantity, float distance, float health=-1, bool special=false, string presetName="", bool withPhysics=false)
spawns entity in direction of cursor at specified distance
EntityAI SpawnEntityInInventory(notnull EntityAI target, string className, float health, float quantity, bool special=false, string presetName="", FindInventoryLocationType locationType=FindInventoryLocationType.ANY)
tries to spawn item somewhere in inventory
void HandlePresetSpawn(PlayerBase player, string presetName, EntityAI target)
void OnRPCSpawnEntityOnCursorDir(PlayerBase player, ParamsReadContext ctx)
void SpawnItemOnCrosshair(PlayerBase player, string itemName, float health, float quantity, float maxDist=100, bool allowFreeflight=false, bool special=false, bool withPhysics=false)
void PrintLogClient(string msg_log)
void ToggleScriptConsole()
void OnSpawnErrorReport(string name)
void OnRPCSyncSceneObject(ParamsReadContext ctx)
int QuickSortPartition(TStringArray arr, int left, int right)
EntityAI SpawnFromClipboard()
void SortStringArray(TStringArray arr)
void SpawnEntityOnGroundPatternGrid(PlayerBase player, string item_name, int count, float health, float quantity, int rows, int columns, float gapRow=1, float gapColumn=1, bool special=false, bool withPhysics=false)
void SetDirection(PlayerBase player, vector direction)
Set player direction.
void OnSetFreeCameraEvent(PlayerBase player, FreeDebugCamera camera)
void PluginSceneManager()
void HandleSetTime(PlayerBase player, ParamsReadContext ctx)
void ToggleFreeCameraBackPos()
Enable / Disable Free camera (Fly mod)
UIScriptedMenu m_ScriptConsole
EntityAI SpawnEntityInPlayerInventory(PlayerBase player, string item_name, float health, float quantity, bool special=false, string presetName="", FindInventoryLocationType locationType=FindInventoryLocationType.ANY)
static PluginDeveloper GetInstance()
void OnRPCSpawnEntity(PlayerBase player, ParamsReadContext ctx)
EntityAI SpawnEntityOnGroundPos(PlayerBase player, string object_name, vector pos)
void OnRPCSpawnEntityOnGroundPatternGrid(PlayerBase player, ParamsReadContext ctx)
EntityAI SpawnEntityOnGroundPos(PlayerBase player, string item_name, float health, float quantity, vector pos, bool special=false, bool withPhysics=false)
void OnRPCServerLogRecieved(ParamsReadContext ctx)
void TeleportAtCursor()
Set Player position at his cursor position in the world.
void GetCameraDirections(Man player, bool allowFreeflight, out vector position, out vector direction)
void OnRPCSpawnEntityOnGround(PlayerBase player, ParamsReadContext ctx)
static void SetDeveloperItemClientEx(notnull Object entity, bool getFocus=false)
TStringArray GetItemClasses()
void OnRPC(PlayerBase player, int rpc_type, ParamsReadContext ctx)
void OnRPCPluginDayzCreatureDebug(PlayerBase player, int rpc_type, ParamsReadContext ctx)
void ToggleMissionLoader()
void SetupSpawnedEntity(PlayerBase player, EntityAI entity, float health, float quantity=-1, bool special=false, string presetName="")
void ClearInventory(EntityAI entity)
void SetDeveloperItemClient()
EntityAI SpawnAI(string object_name, vector pos)
bool IsEnabledFreeCamera()
void OnRPCClearInventory(PlayerBase player)
void SendServerLogToClient(string msg)
map< string, ref ScriptConsoleItem > GetItems()
void Teleport(PlayerBase player, vector position)
Teleport player at position.
void QuickSort(TStringArray arr, int left, int right)
Plugin interface for controlling of agent pool system.
SceneObject GetSceneObjectByEntityAI(EntityAI e)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
vector Perpend()
Returns perpendicular vector. Perpendicular vector is computed as cross product between input vector ...
Serializer ParamsReadContext
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
Obsolete Managed PrintString(string s)
Helper for printing out string expression. Example: PrintString("Hello " + var);.
class array< Class T > TStringArray
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
proto string Trim()
Returns trimmed string with removed leading and trailing whitespaces.
proto string Get(int index)
Gets n-th character from string.
bool Contains(string sample)
Returns true if sample is substring of string.
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
proto void Set(int index, string input)
Sets the n-th character in string with the input, replacing previous value.