1typedef Param7<EntityAI, string, float, float, bool, string, FindInventoryLocationType>
DevSpawnItemParams;
10 return PluginDeveloper.Cast(
GetPlugin( PluginDeveloper ) );
66 case ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND:
70 case ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND_PATTERN_GRID:
74 case ERPCs.DEV_RPC_SPAWN_ITEM_ON_CURSOR:
78 case ERPCs.DEV_RPC_SPAWN_ITEM_IN_INVENTORY:
82 case ERPCs.DEV_RPC_CLEAR_INV:
86 case ERPCs.DEV_RPC_SEND_SERVER_LOG:
90 case ERPCs.RPC_SYNC_SCENE_OBJECT:
94 case ERPCs.DEV_RPC_PLUGIN_DZCREATURE_DEBUG:
98 case ERPCs.DEV_RPC_SPAWN_PRESET:
102 ctx.Read(presetName);
108 case ERPCs.DEV_RPC_SET_TIME:
123 Param1<string> msg_p =
new Param1<string>(msg_log);
134 GetGame().GetPlayers( players );
136 for (
int i = 0; i < players.Count(); ++i )
138 Param1<string> param =
new Param1<string>( msg );
139 Man player = players.Get(i);
141 if ( player && player.HasNetworkID() )
143 player.RPCSingleParam(
ERPCs.DEV_RPC_SEND_SERVER_LOG, param,
true, player.GetIdentity());
153 if ( ctx.Read( par ) )
155 PluginSceneManager module_scene_editor = PluginSceneManager.Cast(
GetPlugin( PluginSceneManager ) );
156 SceneData scene_data = module_scene_editor.GetLoadedScene();
166 if (pluginDZCreatureDebug)
168 pluginDZCreatureDebug.OnRpc(player, rpc_type, ctx);
175 Param5<int,int,int,int,int> p5 =
new Param5<int,int,int,int,int>(0,0,0,0,0);
178 int year = p5.param1;
179 int month = p5.param2;
181 int hour = p5.param4;
182 int minute = p5.param5;
184 GetGame().GetWorld().SetDate(year,month, day, hour, minute);
202 targetPlayer.m_PresetSpawned =
true;
208 PresetSpawnBase presetObj = PresetSpawnBase.Cast(type.Spawn());
212 presetObj.Init(targetPlayer);
223 Param1<string> param =
new Param1<string>(
"" );
225 if ( ctx.Read(param) && param.param1 !=
"" )
227 Debug.ReceivedLogMessageFromServer(param.param1);
239 Param7<string, float, float, float, bool, string, bool> p =
new Param7<string, float, float, float, bool, string, bool>(
"", 0, 0, 0,
false,
"",
false);
248 Param6<string, float, float, vector, bool, bool> p =
new Param6<string, float, float, vector, bool, bool>(
"", 0, 0,
"0 0 0",
false,
false);
257 auto p =
new Param10<string,int, float, float, int, int, float, float, bool, bool>(
"",0,0,0,0,0,0,0,
false,
false);
260 SpawnEntityOnGroundPatternGrid(player, p.param1, p.param2, p.param3, p.param4, p.param5, p.param6, p.param7, p.param8, p.param9, p.param10);
273 if (playerTarget && p.param5)
275 if (playerTarget.m_PresetSpawned)
277 playerTarget.m_PresetSpawned =
false;
278 playerTarget.m_PresetItems.Clear();
282 playerTarget.m_PresetItems.Insert(ent);
296 PrintString(
"PluginDeveloper.SpawnEntity() Warning- Cant spawn object: " +
name);
298 PrintString(
"PluginDeveloper.SpawnEntity() Warning END");
304 if (presetName && player.m_PresetSpawned)
306 player.m_PresetItems.Clear();
307 player.m_PresetSpawned =
false;
312 plr.OnSpawnedFromConsole();
314 else if ( entity.IsInherited(
ItemBase) )
319 else if (entity.IsInherited(
House))
321 entity.PlaceOnSurface();
322 vector pos = entity.GetPosition();
324 entity.SetOrientation(ori);
328 player.m_PresetItems.Insert(entity);
333 auto debugParams = DebugSpawnParams.WithPlayer(player);
334 entity.OnDebugSpawnEx(debugParams);
340 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)
349 float columnDist = 0;
351 vector playerPos = player.GetPosition();
352 vector camDirForward = player.GetDirection();
353 vector camDirRight = camDirForward.Perpend() * -1;
355 for (
int i = 0; i < rows; i++)
357 vector posRow = playerPos + camDirForward * rowDist;
360 for (
int j = 0; j < columns; j++)
362 offsetSide = camDirRight * columnDist;
363 vector placement = posRow + offsetSide;
364 float hlth = health * MiscGameplayFunctions.GetTypeMaxGlobalHealth( item_name );
366 ent.PlaceOnSurface();
369 if (
Class.CastTo(item, ent) && withPhysics)
370 item.ThrowPhysically(null,
"0 0 0");
373 if (countLoop == count)
377 columnDist += gapColumn;
384 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);
385 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND_PATTERN_GRID, params,
true);
389 void SpawnItemOnCrosshair(notnull
PlayerBase player,
string itemName,
float health,
float quantity,
float maxDist = 100,
bool allowFreeflight =
false,
bool special =
false,
bool withPhysics =
false)
392 if (allowFreeflight && FreeDebugCamera.GetInstance().IsActive())
394 from = FreeDebugCamera.GetInstance().GetPosition();
395 to = from + FreeDebugCamera.GetInstance().GetDirection() * maxDist;
399 from =
GetGame().GetCurrentCameraPosition();
400 to = from +
GetGame().GetCurrentCameraDirection() * maxDist;
411 DayZPhysics.RayCastBullet(from, to, hitMask, player, obj, hitPos, hitNormal, hitFraction);
414 if (hitPos !=
vector.Zero)
432 EntityAI entity = player.SpawnEntityOnGroundPos(item_name, pos);
439 if (
Class.CastTo(item, entity) && withPhysics)
440 item.ThrowPhysically(null,
"0 0 0");
446 Param6<string, float, float, vector, bool, bool> params =
new Param6<string, float, float, vector, bool, bool>(item_name, health, quantity, pos, special, withPhysics);
447 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND, params,
true);
465 EntityAI entity = player.SpawnEntityOnGroundOnCursorDir(item_name, distance);
469 if ( !entity.IsBuilding() && health < 0 && entity.GetMaxHealth() > 0)
471 health = entity.GetMaxHealth();
479 if (
Class.CastTo(item, entity) && withPhysics)
480 item.ThrowPhysically(null,
"0 0 0");
487 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);
488 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_ON_CURSOR, params,
true);
504 if (target.IsPlayer())
511 if (target.GetInventory() && target.GetInventory().FindFirstFreeLocationForNewEntity(className,
FindInventoryLocationType.ANY, il))
514 if ( eai && eai.IsInherited(
ItemBase) )
518 health = eai.GetMaxHealth();
524 auto debugParams = DebugSpawnParams.WithPlayer(null);
525 eai.OnDebugSpawnEx(debugParams);
547 if (!
GetGame().IsMultiplayer())
548 player.DropItem(player.GetItemInHands());
550 player.ServerDropEntity(player.GetItemInHands());
552 GetGame().GetCallQueue(
CALL_CATEGORY_SYSTEM).CallLater(SpawnEntityInPlayerInventory, 500,
false, player, item_name, health, quantity, special, presetName, locationType);
559 if (
GetGame().IsKindOf(item_name,
"Transport"))
562 auto debugParams = DebugSpawnParams.WithPlayer(player);
563 vehicle.OnDebugSpawnEx(debugParams);
571 player.SetGetInVehicleDebug(vehicle);
579 if (player.GetInventory() && player.GetInventory().FindFirstFreeLocationForNewEntity(item_name, locationType, il))
585 vector pos = player.GetPosition();
587 Magazine mag_gnd = Magazine.Cast(eai_gnd);
588 if (mag_gnd && player.GetWeaponManager().CanAttachMagazine(wpn, mag_gnd))
590 player.GetWeaponManager().AttachMagazine(mag_gnd);
597 if ( eai && eai.IsInherited(
ItemBase) )
601 health = eai.GetMaxHealth();
607 auto debugParams2 = DebugSpawnParams.WithPlayer(player);
608 eai.OnDebugSpawnEx(debugParams2);
622 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_IN_INVENTORY, params,
true);
656 EntityAI eai = parent.GetInventory().CreateAttachment(att_name);
675 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_AS_ATTACHMENT, params,
true);
684 if ( menu_curr == NULL )
689 if ( !
GetGame().GetWorld().Is3rdPersonDisabled() )
691 player.SetIsInThirdPerson(!player.IsInThirdPerson());
694 vector pos_player = player.GetPosition();
698 GetGame().CopyFromClipboard(clipboard);
700 if (!clipboard.Contains(
","))
711 clipboard.Split(
",", items );
713 foreach (
string item:items)
733 entity.ClearInventory();
737 Param1<int> params =
new Param1<int>(0);
738 entity.RPCSingleParam(
ERPCs.DEV_RPC_CLEAR_INV, params,
true);
744 if (
g_Game.GetUIManager().GetMenu() == NULL )
750 g_Game.GetUIManager().Back();
758 if (
g_Game.GetUIManager().GetMenu() == NULL )
764 g_Game.GetUIManager().Back();
765 GetGame().GetMission().RemoveActiveInputExcludes({
"menu"},
true);
775 g_Game.GetUIManager().Back();
776 GetGame().GetMission().RemoveActiveInputExcludes({
"menu"},
true);
780 if (
g_Game.GetUIManager().GetMenu() )
781 g_Game.GetUIManager().GetMenu().Close();
784 GetGame().GetMission().AddActiveInputExcludes({
"menu"});
790 private void ScriptHistoryNext()
799 private void ScriptHistoryBack()
808 private bool IsIngame()
812 if ( menu_curr == NULL )
820 private bool IsInConsole()
833 int QuickSortPartition(
TStringArray arr,
int left,
int right )
835 string pivot = arr.Get( left );
845 if ( i > right || arr.Get(i) > pivot )
854 if ( arr.Get(j) <= pivot )
866 arr.Set( i, arr.Get(j) );
870 temp = arr.Get( left );
871 arr.Set( left, arr.Get(j) );
883 j = QuickSortPartition( arr, left, right );
884 QuickSort( arr, left, j - 1 );
885 QuickSort( arr, j + 1, right );
891 QuickSort( arr, 0, arr.Count() - 1 );
898 GetGame().GetMission().ResetGUI();
902 static void SetDeveloperItemClientEx(notnull
Object entity,
bool getFocus =
false)
908 GetGame().GetInput().ChangeGameFocus(1);
909 GetGame().GetUIManager().ShowUICursor(
true);
919 mid2.RegisterDebugItem(entity, player);
922 SetDebugDeveloper_item(entity);
926 void SetDeveloperItemClient()
932 FreeDebugCamera debugCam = FreeDebugCamera.GetInstance();
933 if (debugCam && debugCam.GetCurrentCamera())
935 entity = debugCam.GetCrosshairObject();
940 if (player && player.GetActionManager())
942 ActionTarget at = player.GetActionManager().FindActionTarget();
943 entity = at.GetObject();
949 SetDeveloperItemClientEx(entity,
true);
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
vector GetSurfaceOrientation(float x, float z)
Returns tilt of the ground on the given position in degrees, so you can use this value to rotate any ...
Super root of all classes in Enforce script.
static void OnSetFreeCameraEvent(PlayerBase player, FreeDebugCamera camera)
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)
script counterpart to engine's class Inventory
EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
provides access to slot configuration
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Plugin interface for controlling of agent pool system.
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...
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 PrintLogClient(string msg_log)
void ToggleScriptConsole()
void OnSpawnErrorReport(string name)
void OnRPCSyncSceneObject(ParamsReadContext ctx)
EntityAI SpawnFromClipboard()
void SpawnItemOnCrosshair(notnull PlayerBase player, string itemName, float health, float quantity, float maxDist=100, bool allowFreeflight=false, bool special=false, bool withPhysics=false)
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 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)
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)
spawns entity on exact position
void OnRPCServerLogRecieved(ParamsReadContext ctx)
void TeleportAtCursor()
Set Player position at his cursor position in the world.
void OnRPCSpawnEntityOnGround(PlayerBase player, ParamsReadContext ctx)
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)
bool IsEnabledFreeCamera()
void OnRPCClearInventory(PlayerBase player)
void SendServerLogToClient(string msg)
void Teleport(PlayerBase player, vector position)
Teleport player at position.
SceneObject GetSceneObjectByEntityAI(EntityAI e)
Serialization general interface. Serializer API works with:
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
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)
proto native CGame GetGame()
array< string > TStringArray
class array< Class T > PrintString
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< EntityAI, string, float, float, bool, string, FindInventoryLocationType > DevSpawnItemParams
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)