14 void SetTransferParams (
bool transfer_agents =
true,
bool transfer_variables =
true,
bool transfer_health =
true,
bool exclude_quantity =
false,
float quantity_override = -1)
16 m_TransferAgents = transfer_agents;
17 m_TransferVariables = transfer_variables;
18 m_TransferHealth = transfer_health;
19 m_ExcludeQuantity = exclude_quantity;
20 m_quantity_override = quantity_override;
25 super.CopyOldPropertiesToNew(old_item, new_item);
29 MiscGameplayFunctions.TransferItemProperties(old_item, new_item, m_TransferAgents, m_TransferVariables, m_TransferHealth, m_ExcludeQuantity);
30 MiscGameplayFunctions.TransferInventory(old_item, new_item,
m_Player);
33 if (
ItemBase.Cast(new_item) && m_quantity_override != -1)
35 m_quantity_override =
Math.
Max(m_quantity_override,0);
36 ItemBase.Cast(new_item).SetQuantity(m_quantity_override);
41 Debug.
LogError(
"TurnItemIntoItemLambda: failed to create new item",
"static");
48 if (m_NewLocation.GetType() ==
InventoryLocationType.ATTACHMENT && m_OldItem.ConfigIsExisting(
"ChangeIntoOnAttach"))
56 m_OldItem.ConfigGetTextArray(
"ChangeInventorySlot",inventory_slots);
57 if (inventory_slots.Count() < 1)
60 attach_types.Insert(m_OldItem.ConfigGetString(
"ChangeIntoOnAttach"));
64 inventory_slots_idx.Clear();
65 for (
int i = 0; i < inventory_slots.Count(); i++)
69 m_OldItem.ConfigGetTextArray(
"ChangeIntoOnAttach",attach_types);
72 idx = m_NewLocation.GetSlot();
73 str = attach_types.Get(inventory_slots_idx.Find(idx));
83 super.OnSuccess(new_item);
86 m_Player.GetItemAccessor().OnItemInHandsChanged();
95 super.OnSuccess(new_item);
103class TurnItemIntoItemLambdaRestrainLambda
extends TurnItemIntoItemLambdaAnimSysNotifyLambda
107 super.OnSuccess(new_item);
126 super.CopyOldPropertiesToNew(old_item, new_item);
132 int count = children.Count();
133 for (
int i = 0; i < count; i++)
139 child.GetInventory().GetCurrentInventoryLocation(child_src);
152 m_Player.LocalTakeToDst(child_src, child_dst);
172 if (new_item_type !=
string.
Empty)
173 Error(
"MoveEquipAndDestroyRootLambda expects new_item_type to be empty");
178 super.RemoveNetworkObjectInfo();
183 super.UndoRemoveNetworkObjectInfo();
190 super.CopyOldPropertiesToNew(old_item, new_item);
197 super.CreateNetworkObjectInfo(new_item);
213class MiscGameplayFunctions
216 static float Truncate(
float value,
int decimals = 2)
224 return Truncate(value, decimals).ToString();
229 int multiplier =
Math.
Pow(10,decimals);
238 return MiscGameplayFunctions.TruncateToS(value[0],decimals) + delimiter + MiscGameplayFunctions.TruncateToS(value[1],decimals) +delimiter + MiscGameplayFunctions.TruncateToS(value[2],decimals));
243 return string.
Format(
"#(argb,8,8,3)color(%1,CO)",
string.Format(
"%1,%2,%3,%4", r, g, b, a));
247 static string ValueToBar(
float value,
string bar =
"[----------]",
string mark =
"x")
249 int length = bar.
Length() - 2;
250 float index =
Math.
Lerp(0,length, value);
260 int length_first = pos+1;
261 int length_base = base.
Length();
262 int length_second = length_base - length_first;
263 string first = base.
Substring(0,length_first);
264 string second = base.
Substring(pos+1,length_second);
265 return first + insert + second;
274 if( transfer_agents ) target_ib.TransferAgents( source.GetAgents() );
276 if( transfer_variables )
278 MiscGameplayFunctions.TransferItemVariables(source_ib, target_ib, exclude_quantity);
284 target_ib.SetHealth(
"",
"", source.GetHealth01(
"",
"") * target_ib.GetMaxHealth(
"",
""));
290 target.TransferVariablesFloat( source.GetVariablesFloat() );
292 if ( exclude_quantity )
296 else if ( source.IsMagazine() && target.IsMagazine() )
298 Magazine source_mag = Magazine.Cast(source);
299 Magazine target_mag = Magazine.Cast(target);
301 target_mag.ServerSetAmmoCount( source_mag.GetAmmoCount() );
304 if ( source.IsWeapon() && target.IsWeapon() )
309 target_wpn.CopyWeaponStateFrom(source_wpn);
311 else if ( source.HasEnergyManager() && target.HasEnergyManager() )
326 target_edb.TransferFoodStage(source_edb);
336 int count = children.Count();
337 for (
int i = 0; i < count; i++)
343 child.GetInventory().GetCurrentInventoryLocation( child_src );
346 child_dst.
Copy( child_src );
354 targetItem.GetInventory().TakeToDst(
InventoryMode.LOCAL, child_src, child_dst);
363 player.LocalDropEntity(child);
379 magazine = weapon.GetMagazine(weapon.GetCurrentMuzzle());
383 if (magazine.GetAmmoCount() <= 5)
385 magazine.ServerSetAmmoMax();
391 magazine = weapon.GetMagazine(weapon.GetCurrentMuzzle());
395 if (magazine.GetAmmoCount() <= 5)
397 magazine.LocalSetAmmoMax();
414 player.ServerReplaceItemWithNew(lambda);
424 player.ServerReplaceItemInHandsWithNew(lambda);
431 float max_stack_size;
435 max_stack_size =
g_Game.ConfigGetInt(
"cfgVehicles " + item_name +
" varStackMax");
436 if( max_stack_size < 1)
437 max_stack_size =
g_Game.ConfigGetInt(
"cfgVehicles " + item_name +
" varQuantityMax");
438 if( max_stack_size < 1)
441 int full_piles_count =
Math.
Floor(quantity/max_stack_size);
442 int rest = quantity - (full_piles_count*max_stack_size);
444 for (
int i = 0; i < full_piles_count; i++ )
450 pile.SetQuantity(max_stack_size);
451 pile.SetHealth(health);
452 item_piles.Insert(pile);
460 pile.SetQuantity(rest);
461 pile.SetHealth(health);
462 item_piles.Insert(pile);
474 stack_size =
g_Game.ConfigGetInt(
"cfgMagazines " + item_name +
" count");
476 int piles_count =
Math.
Floor(quantity/stack_size);
477 int rest = quantity - (piles_count*stack_size);
479 for (
int i = 0; i < piles_count; i++ )
482 pile.ServerSetAmmoCount(stack_size);
488 pile.ServerSetAmmoCount(rest);
501 if( !
g_Game.ConfigGetText(
"cfgAmmo " + bullet_type +
" spawnPileType", item_name) )
504 stack_size =
g_Game.ConfigGetInt(
"cfgMagazines " + item_name +
" count");
508 int piles_count =
Math.
Floor(quantity/stack_size);
509 int rest = quantity - (piles_count*stack_size);
511 for (
int i = 0; i < piles_count; i++ )
514 pile.ServerSetAmmoCount(stack_size);
520 pile.ServerSetAmmoCount(rest);
529 float health_normalized = health / 100;
560 cfg_path = cfg_path +
" "+
class_name+
" DamageSystem GlobalHealth " + health_type +
" hitpoints";
568 vector usti_hlavne_position = weapon.GetSelectionPositionMS(
"usti hlavne" );
569 vector konec_hlavne_position = weapon.GetSelectionPositionMS(
"konec hlavne" );
570 vector end_point = weapon.ModelToWorld(usti_hlavne_position);
571 vector begin_point = weapon.ModelToWorld(konec_hlavne_position);
573 int contact_component;
575 vector aim_point = end_point - begin_point;
577 aim_point = aim_point + end_point;
579 if (
DayZPhysics.
RaycastRV(begin_point, aim_point, position, contact_dir, contact_component, null, null, null,
false,
false, ObjIntersectFire))
587 int headBoneIdx = player.GetBoneIndexByName(
"Head");
588 if ( headBoneIdx == -1 )
589 { pos = player.GetPosition()[1] + 1.6; }
591 { pos = player.GetBonePositionWS(headBoneIdx); }
615 switch (movement_speed)
638 switch (movement_speed)
660 return entity.ConfigGetString(
"OnRestrainChange");
670 type = tool.ConfigGetBool(
"RestrainUnlockType");
672 string new_item_name = current_item.ConfigGetString(
"OnRestrainChange");
674 if ( new_item_name !=
"" )
678 if (player_target.IsAlive())
679 MiscGameplayFunctions.TurnItemIntoItemEx(player_target,
new ReplaceAndDestroyLambdaEx(current_item, new_item_name, player_target, type));
685 MiscGameplayFunctions.TurnItemIntoItemEx(player_target,
new ReplaceAndDestroyLambdaEx(current_item, new_item_name, player_target, type));
690 Error(
"current_item:" +current_item+
", tool:" +tool +
". No value for 'OnRestrainChange' config parameter");
696 return (value >= from) && (value <= to);
704 vector player_dir = player.GetDirection();
705 vector to_target_dir = target_pos - player.GetPosition();
708 to_target_dir[1] = 0;
713 float cos_fi =
vector.
Dot(player_dir, to_target_dir);
714 vector cross = player_dir * to_target_dir;
722 if( (dir <= cone_angle && dir >= -cone_angle) ||
Math.
AbsFloat(dir) == 90 )
734 int max_length = 512;
735 string output = input;
752 Construction construction = base_building.GetConstruction();
753 if (construction &&
BuildCondition( player, target, item,
false, constraction_index ))
768 if ( player.IsPlacingLocal() || player.IsPlacingServer() )
777 return !construction.IsColliding( partName );
791 Object targetObject = target.GetObject();
792 if ( targetObject && targetObject.CanUseConstruction() )
796 construction_action_data.
SetTarget( targetObject );
817 if ( constrution_part )
821 if ( position_check && !player.GetInputController().CameraIsFreeLook() )
843 entity.GetCollisionBox(minMax);
847 float from_override = entity.HeightStartCheckOverride();
848 if (from_override > 0.0)
850 size[1] = from_override;
854 size[1] = minMax[1][1] - minMax[0][1];
857 from = entity.GetPosition() + size;
858 if ( entity.HeightCheckOverride() > 0 )
860 to = entity.GetPosition() +
Vector(0, entity.HeightCheckOverride(), 0);
885 int contact_component;
887 bool boo =
DayZPhysics.
RaycastRV( from, to, contact_pos, contact_dir, contact_component, NULL, NULL, entity,
false,
false, geometry,0.25 );
907 float steam_offset = 0;
911 particle_pos = parent.GetPosition();
913 if ( parent.IsInherited( PortableGasStove ) )
940 particle_pos[1] = particle_pos[1] + steam_offset;
952 vector direction = ib.GetDirection();
956 if (direction[0] < 0)
963 int count = items.Count();
964 for (
int i = 0; i < count; ++i )
968 ib.GetInventory().DropEntityInBounds(
InventoryMode.SERVER, ib, item, halfExtents, angle, cos, sin);
974 vector position = parent.GetPosition();
975 vector orientation = parent.GetOrientation();
976 vector rotation_matrix[3];
980 parent.GetCollisionBox(minmax);
986 for (
int i = 0; i < parent.GetInventory().AttachmentCount(); ++i )
995 for (
int j = 0; j < parent.GetInventory().GetCargo().GetItemCount(); ++j )
1008 if ( !
GetGame().IsMultiplayer() )
1012 if (CastTo(entityIB, entity))
1019 for (
int l = 0; l < entityIB.GetQuantity(); ++l)
1025 MiscGameplayFunctions.TransferItemProperties(entityIB, new_item);
1026 entityIB.AddQuantity( -1 );
1027 new_item.SetQuantity( 1 );
1028 new_item.ThrowPhysically(null, force,
false);
1034 float stackable = entityIB.GetTargetQuantityMax();
1035 if ( !(stackable == 0 || stackable >= entityIB.GetQuantity()) )
1037 while (entityIB.GetQuantity() > stackable)
1040 position[1] = position[1] + 0.1;
1043 ItemBase splitItem = entityIB.SplitIntoStackMaxToInventoryLocationEx( spltDst );
1044 splitItem.ThrowPhysically(null, force,
false);
1049 entity.GetInventory().GetCurrentInventoryLocation(src);
1051 entity.GetInventory().TakeToDst(invMode, src, dst);
1052 entityIB.ThrowPhysically(null, force,
false);
1057 entity.GetInventory().DropEntity(invMode, entity.GetHierarchyRoot(), entity);
1067 float heatIsolation = pItem.GetHeatIsolation();
1068 float itemHealthLabel = pItem.GetHealthLevel();
1069 float itemWetness = pItem.GetWet();
1094 switch (itemHealthLabel)
1118 heatIsolation *= healthFactor;
1119 heatIsolation *= wetFactor;
1121 return heatIsolation;
1126 if (!obstructingObjects)
1129 for (
int i = 0; i < potentiallyObstructingObjects.Count(); ++i )
1131 Object obj = potentiallyObstructingObjects[i];
1132 if ( obj && ( obj.CanObstruct() || obj.CanProxyObstruct() ) )
1133 obstructingObjects.Insert(obj);
1139 return obj.IsTransport() || obj.CanUseConstruction();
1146 vicinityObjects.Copy(objects);
1151 int mCount = vicinityObjects.Count();
1153 if (!filteredObjects)
1157 if ( doDistanceCheck )
1159 for ( i = vicinityObjects.Count() - 1; i >= 0; --i )
1161 Object obj = vicinityObjects[i];
1163 vicinityObjects.Remove(i);
1171 float distance, dist1, dist2;
1173 for ( i = 0; i < obstructingObjects.Count(); ++i )
1175 distance =
vector.
DistanceSq(obstructingObjects[i].GetWorldPosition(), origin);
1176 distanceHelper.Insert(distance);
1179 distanceHelperUnsorted.Copy(distanceHelper);
1180 distanceHelper.Sort();
1182 for ( i = distanceHelper.Count() - 1; i >= 0; --i )
1183 sortedObstructingObjects.Insert(obstructingObjects[distanceHelperUnsorted.Find(distanceHelper[i])]);
1193 for ( i = 0; i < sortedObstructingObjects.Count(); ++i )
1195 Object obstrObj = sortedObstructingObjects[i];
1196 vector worldPos = obstrObj.GetWorldPosition();
1199 if ( obstrObj.GetCollisionBox(minMax) )
1203 max = max * (obstrObj.GetOrientation() * range);
1205 vector center, dx, dy, dz, half;
1206 center = (min + max) * 0.5;
1207 dz = obstrObj.GetOrientation();
1210 half = (max - min) * 0.5;
1216 for ( j = vicinityObjects.Count() - 1; j >= 0; --j )
1218 Object vicObj = vicinityObjects[j];
1221 vector d = vicObj.GetWorldPosition() - worldPos + center;
1224 group.Insert(vicObj);
1225 vicinityObjects.Remove(j);
1230 if ( group.Count() > 0 )
1231 tempGroups.Insert(group);
1236 for ( i = 0; i < tempGroups.Count(); ++i )
1244 for ( i = 0; i < objectGroups.Count(); ++i )
1247 Object sampleObject = objectGroup[0];
1250 filteredObjects.InsertAll(objectGroup);
1259 for (
int i = 0; i < objects.Count(); )
1261 Object obj1 = objects[i];
1266 for (
int j = objects.Count() - 1; j > i; --j )
1268 Object obj2 = objects[j];
1271 vector start = obj1.GetWorldPosition();
1272 vector end = obj2.GetWorldPosition();
1275 if ( distance < squaredDistanceDelta )
1282 objectGroups.Insert(group);
1305 if (doDistanceCheck &&
vector.
DistanceSq(player.GetPosition(), distanceCheckPos) > maxDist * maxDist)
1308 cache.ObjectCenterPos =
object.GetCenter();
1313 DayZPhysics.
RaycastRV(cache.RaycastStart, cache.ObjectCenterPos, cache.ObjectContactPos, cache.ObjectContactDir, cache.ContactComponent, cache.HitObjects,
object,
GetGame().
GetPlayer(),
false,
false, ObjIntersectFire, 0.0,
CollisionFlags.ALLOBJECTS);
1320 if (
object.CanProxyObstruct())
1324 if (cache.HitProxyObjects)
1326 if (cache.HitProxyObjects.Count() > 0)
1328 if (cache.HitProxyObjects[0].hierLevel > 0)
1331 if (!cache.HitProxyObjects[0].parent.IsMan())
1333 if (cache.HitProxyObjects[0].parent)
1336 if (proxyParent.GetInventory() && proxyParent.GetInventory().GetCargo())
1349 for (
int m = 0; m < cache.HitObjects.Count(); m++ )
1351 Object hit_object = cache.HitObjects.Get(m);
1353 if ( hit_object.CanObstruct() )
1377 item.DecreaseHealth(dmg,
false);
1389 return val / maxVal;
1392 static float Bobbing(
float period,
float amplitude,
float elapsedTime)
1398 elapsedTime /= period;
1401 cycle += elapsedTime;
1403 cycle =
Math.
Sin(cycle) * amplitude;
1416 EntityAI entity = player.GetInventory().CreateInInventory(
"Splint");
1418 entity = player.SpawnEntityOnGroundOnCursorDir(
"Splint", 0.5);
1422 Class.
CastTo(attachment, player.GetItemOnSlot(
"Splint_Right"));
1423 if ( attachment && attachment.GetType() ==
"Splint_Applied" )
1427 MiscGameplayFunctions.TransferItemProperties(attachment,new_item);
1432 if (new_item.GetHealthLevel() < 4)
1434 int newDmgLevel = new_item.GetHealthLevel() + 1;
1436 float max = new_item.GetMaxHealth(
"",
"");
1438 switch ( newDmgLevel )
1463 attachment.Delete();
1470 if( player.GetSimulationTimeStamp() < 20 && !player.IsPersistentFlag(
PersistentFlag.AREA_PRESENCE) )
1475 vector player_pos = player.GetPosition();
1476 vector closest_safe_pos = MiscGameplayFunctions.GetClosestSafePos(player_pos, safe_positions);
1478 if (player_pos!=closest_safe_pos)
1480 closest_safe_pos[1] =
GetGame().
SurfaceY(closest_safe_pos[0], closest_safe_pos[2]);
1482 player.SetPosition( closest_safe_pos );
1494 vector closest_pos = to_pos;
1495 float smallest_dist =
float.MAX;
1504 if ( dist < smallest_dist)
1506 smallest_dist = dist;
1527 float minValue = 0.0;
1528 for (
int i = 0; i < pArray.Count(); i++)
1530 if (minValue == 0 || pArray.Get(i) < minValue)
1532 minValue = pArray.Get(i);
1541 float maxValue = 0.0;
1542 for (
int i = 0; i < pArray.Count(); i++)
1544 if (maxValue == 0 || pArray.Get(i) > maxValue)
1546 maxValue = pArray.Get(i);
1560 if (pSelection.Count() == 0 || pCompName.
Length() == 0)
1565 for (
int i = 0; i < pSelection.Count(); ++i)
1568 if (pSelection[i] && pSelection[i].
GetName() == pCompName)
1579 if (!MiscGameplayFunctions.IsComponentInSelection(pSelection, pCompName))
1584 for (
int i = 0; i < pSelection.Count(); ++i)
1587 if (pSelection[i] && pSelection[i].
GetName() == pCompName)
1598 if (listOfTypenames.Count() > 0)
1603 Object childToRemove = child;
1604 child =
Object.Cast(child.GetSibling());
1606 if (childToRemove.IsAnyInherited(listOfTypenames))
1608 vector pos = childToRemove.GetPosition();
1609 parent.RemoveChild(childToRemove,
false);
1614 childToRemove.SetTransform(m4);
1615 childToRemove.PlaceOnSurface();
1630 old_item.GetTransform(mtx);
1632 player.GetTransform(mtx);
1634 OverrideNewLocation(gnd);
1639 super.RemoveOldItemFromLocation();
1640 m_Player.GetHumanInventory().OnEntityInHandsDestroyed(m_OldLocation);
override void OnSuccess(EntityAI entity)
class ActionTargets ActionTarget
const int ECE_PLACE_ON_SURFACE
const int ECE_UPDATEPATHGRAPH
const int ECE_CREATEPHYSICS
void Construction(BaseBuildingBase parent)
proto native int GetComponentIndex()
InventoryLocationType
types of Inventory Location
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
ref array< ref RaycastRVResult > HitProxyObjects
static bool CanIgnoreDistanceCheck(Object obj)
DestroyItemInCorpsesHandsAndCreateNewOnGndLambda RaycastStart
static vector TruncateVec(vector value, int decimals=2)
truncate float to specified precision
static string ObtainRestrainItemTargetClassname(notnull EntityAI entity)
static void DealAbsoluteDmg(ItemBase item, float dmg)
static void TransferItemVariables(ItemBase source, ItemBase target, bool exclude_quantity=false)
static float Bobbing(float period, float amplitude, float elapsedTime)
static bool IsPlayerOrientedTowardPos(notnull DayZPlayerImplement player, vector target_pos, float cone_angle)
Check if player direction(based on cone of defined angle) is oriented to target position.
static void RemoveAllAttachedChildrenByTypename(notnull EntityAI parent, array< typename > listOfTypenames)
static bool BuildCondition(PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)
static void TurnItemIntoItemEx(notnull PlayerBase player, ReplaceItemWithNewLambdaBase lambda)
static bool ComplexBuildCollideCheckClient(PlayerBase player, ActionTarget target, ItemBase item, string partName="")
static void DropAllItemsInInventoryInBounds(ItemBase ib, vector halfExtents)
static vector GetSteamPosition(EntityAI parent)
static void GenerateAINoiseAtPosition(vector position, float lifeTime, NoiseParams noiseParams)
enum ThrowEntityFlags Truncate(float value, int decimals=2)
truncate float to specified precision
static vector GetClosestSafePos(vector to_pos, notnull array< ref array< float > > positions)
static void FilterObstructedObjectsByGrouping(vector origin, float range, float distanceDelta, array< Object > objects, array< Object > obstructingObjects, out array< Object > filteredObjects, bool doDistanceCheck=false, bool checkIfDistanceCanBeIgnored=false, float maxDist=0)
group objects that are close to each other together
static int GetHealthLevelForAmmo(string class_name, float health)
ref set< Object > HitObjects
static void TurnItemInHandsIntoItem(notnull ItemBase old_item, string new_item_type, notnull PlayerBase player)
void IsObjectObstructedCache(vector rayCastStart, int totalObjects)
static float GetTypeMaxGlobalHealth(string class_name, string health_type="Health")
static float Normalize(int val, int maxVal)
static string TruncateVecToS(vector value, int decimals=2, string delimiter=" ")
static string TruncateToS(float value, int decimals=2)
truncate float to specified precision, output as string
static void TurnItemInHandsIntoItemEx(notnull PlayerBase player, ReplaceItemWithNewLambdaBase lambda)
static TransferInventoryResult TransferInventory(EntityAI sourceItem, EntityAI targetItem, PlayerBase player)
static string GetItemDisplayName(string type)
static void TransformRestrainItem(EntityAI current_item, EntityAI tool, PlayerBase player_source, PlayerBase player_target, bool destroy=false)
static vector GetHeadingVector(notnull PlayerBase player)
static array< Magazine > CreateMagazinePilesFromBullet(string bullet_type, vector ground_position, float quantity, float health)
static bool IsValueInRange(float value, float from, float to)
static string SanitizeString(string input)
static bool IsComponentInSelection(array< Selection > pSelection, string pCompName)
static void GetHeadBonePos(notnull PlayerBase player, out vector pos)
static bool GetProjectedCursorPos3d(out vector position, Weapon_Base weapon)
static float GetEnergyMetabolicSpeed(int movement_speed)
static bool IsObjectObstructedFilter(Object object, IsObjectObstructedCache cache, PlayerBase player)
static void IsUnderRoofFromToCalculation(EntityAI entity, out vector from, out vector to, float height=GameConstants.ROOF_CHECK_RAYCAST_DIST)
static bool IsUnderRoof(EntityAI entity, float height=GameConstants.ROOF_CHECK_RAYCAST_DIST)
static float GetHeadingAngle(notnull DayZPlayerImplement player)
static bool IsObjectObstructed(Object object, bool doDistanceCheck=false, vector distanceCheckPos="0 0 0", float maxDist=0)
static void ThrowEntityFromInventory(notnull EntityAI entity, vector position, float direction[4], vector force, int flags)
static void RemoveSplint(PlayerBase player)
static bool IsObjectObstructedProxy(Object object, IsObjectObstructedCache cache, PlayerBase player)
static float GetWaterMetabolicSpeed(int movement_speed)
static void UnlimitedAmmoDebugCheck(Weapon_Base weapon)
static string ValueToBar(float value, string bar="[----------]", string mark="x")
Produces ACII "progress bar" based on an 0..1 'value' input.
static bool IsObjectObstructedEx(Object object, IsObjectObstructedCache cache, bool doDistanceCheck=false, vector distanceCheckPos="0 0 0", float maxDist=0)
static void SplitArrayIntoGroupsByDistance(array< Object > objects, array< ref array< Object > > objectGroups, float squaredDistanceDelta)
static string InsertAtPos(string base, string insert, int pos)
Insert 'insert' behind index 'pos' of the 'base' string.
static void TransferItemProperties(EntityAI source, notnull EntityAI target, bool transfer_agents=true, bool transfer_variables=true, bool transfer_health=true, bool exclude_quantity=false)
will transform item' variables, agents and other local scripted properties as well as any relevant no...
static float GetCurrentItemHeatIsolation(ItemBase pItem)
static float FModulus(float x, float y)
static array< Magazine > CreateMagazinePiles(string item_name, vector ground_position, float quantity, float health)
static bool IsUnderRoofEx(EntityAI entity, float height=GameConstants.ROOF_CHECK_RAYCAST_DIST, int geometry=ObjIntersectView)
static void TeleportCheck(notnull PlayerBase player, notnull array< ref array< float > > safe_positions)
checks if we should teleport the player to a safe location and if so, performs the teleportation
static void TurnItemIntoItem(notnull ItemBase old_item, string new_item_type, notnull PlayerBase player)
static void ThrowAllItemsInInventory(notnull EntityAI parent, int flags)
static void FilterObstructingObjects(array< Object > potentiallyObstructingObjects, out array< Object > obstructingObjects)
static array< ItemBase > CreateItemBasePiles(string item_name, vector ground_position, float quantity, float health, bool floaty_spawn=false)
Spawns multiple piles of stackable ItemBase objects on ground (intended for generic use)
class NoiseSystem NoiseParams()
class OptionSelectorMultistate extends OptionSelector class_name
override bool MustBeBuiltFromOutside()
override bool IsFacingCamera(string selection)
override bool IsPlayerInside(PlayerBase player, string selection)
override bool PerformRoofCheckForBase(string partName, PlayerBase player, out bool result)
proto native void RemoteObjectTreeDelete(Object obj)
RemoteObjectDelete - deletes only remote object (unregisters from network). do not use if not sure wh...
proto native bool IsDedicatedServer()
Robust check which is preferred than the above, as it is valid much sooner.
proto native void ConfigGetFloatArray(string path, out TFloatArray values)
Get array of floats from config on path.
proto native Object CreateObjectEx(string type, vector pos, int iFlags, int iRotation=RF_DEFAULT)
Creates object of certain type.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
proto native void RemoteObjectTreeCreate(Object obj)
RemoteObjectCreate - postponed registration of network object (and creation of remote object)....
proto native float SurfaceY(float x, float z)
proto native NoiseSystem GetNoiseSystem()
string ConfigGetTextOut(string path)
Get string value from config on path.
static ref TFloatArray ARRAY_FLOAT
Super root of all classes in Enforce script.
float GetEnergy()
Energy manager: Returns the amount of stored energy this device has.
void SwitchOn()
Energy manager: Switches ON the device so it starts doing its work if it has enough energy.
void SetEnergy(float new_energy)
Energy manager: Sets stored energy for this device. It ignores the min/max limit!
bool IsSwitchedOn()
Energy manager: Returns state of the switch. Whenever the device is working or not does not matter....
ConstructionPart GetBuildPartNoToolAtIndex(int idx)
ConstructionPart GetBuildPartAtIndex(int idx)
void SetTarget(Object target)
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
override void OnItemInHandsChanged()
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
protected override void RemoveOldItemFromLocation()
void DestroyItemInCorpsesHandsAndCreateNewOnGndLambda(EntityAI old_item, string new_item_type, PlayerBase player, bool destroy=false)
this one is a bit special: it drops all items and destroys the ex-root of the hierarchy
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
void DropEquipAndDestroyRootLambda(EntityAI old_item, string new_item_type, PlayerBase player)
override bool IsBarrelWithHoles()
override bool IsBaseFireplace()
override bool IsIndoorOven()
override bool IsFireplaceIndoor()
script counterpart to engine's class Inventory
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
static proto native bool PrepareDropEntityPos(EntityAI owner, notnull EntityAI item, out vector mat[4], bool useValuesInMatrix=false, int conflictCheckDepth=-1)
Finds a transformation for the item to be dropped to If the initial transforation overlaps with anoth...
static proto native bool LocationCanAddEntity(notnull InventoryLocation inv_loc)
queries if the entity contained in inv_loc.m_item can be added to ground/attachment/cargo/hands/....
proto native void SetParent(notnull EntityAI parent)
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
sets current inventory location type to Ground with transformation mat
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
this one is a also bit special: it moves all items to already existing item and destroys the ex-root ...
proto void AddNoiseTarget(vector pos, float lifetime, NoiseParams noise_params, float external_strength_multiplier=1.0)
Will make a noise at that position which the AI will "see" for the duration of 'lifetime'.
static const float METABOLIC_SPEED_ENERGY_BASAL
static const float METABOLIC_SPEED_WATER_WALK
static const float METABOLIC_SPEED_ENERGY_SPRINT
static const float METABOLIC_SPEED_WATER_JOG
static const float METABOLIC_SPEED_WATER_BASAL
static const float METABOLIC_SPEED_ENERGY_JOG
static const float METABOLIC_SPEED_ENERGY_WALK
static const float METABOLIC_SPEED_WATER_SPRINT
base class for transformation operations (creating one item from another)
protected void RemoveNetworkObjectInfo()
Step C. - remove network part of the object @NOTE this operation does not delete the object,...
protected void CreateNetworkObjectInfo(EntityAI new_item)
Step G. - create NetworkObjectInfo for new item.
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
protected void UndoRemoveNetworkObjectInfo()
protected ref InventoryLocation m_NewLocation
adds automatic QuickBar handling
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
override void OnSuccess(EntityAI new_item)
void TurnItemIntoItemLambda(EntityAI old_item, string new_item_type, PlayerBase player)
override void VerifyItemTypeBySlotType()
if attaching from att.slot to att.slot, skips the change to "ground" version. Allows for correct prop...
void SetTransferParams(bool transfer_agents=true, bool transfer_variables=true, bool transfer_health=true, bool exclude_quantity=false, float quantity_override=-1)
float m_quantity_override
override void OnSuccess(EntityAI new_item)
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
static const vector Forward
static vector RotateAroundZero(vector pos, vector axis, float cosAngle, float sinAngle)
Rotate a vector around 0,0,0.
proto float Normalize()
Normalizes vector. Returns length.
static const vector Aside
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
DayZPlayerConstants
defined in C++
const int INDEX_NOT_FOUND
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
const float PROJECTED_CURSOR_DISTANCE
const float ROOF_CHECK_RAYCAST_DIST
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
const float ENVIRO_ISOLATION_WETFACTOR_WET
const float ENVIRO_ISOLATION_HEALTHFACTOR_B_DAMAGED
const float ENVIRO_ISOLATION_WETFACTOR_SOAKED
const float ENVIRO_ISOLATION_WETFACTOR_DRENCHED
const float ENVIRO_ISOLATION_HEALTHFACTOR_DAMAGED
const float ENVIRO_ISOLATION_HEALTHFACTOR_RUINED
const float ENVIRO_ISOLATION_HEALTHFACTOR_WORN
const float ENVIRO_ISOLATION_HEALTHFACTOR_PRISTINE
impact of item health (state) to the heat isolation
const float ENVIRO_ISOLATION_WETFACTOR_DAMP
const float ENVIRO_ISOLATION_WETFACTOR_DRY
Heat buffer static timer tick (set for 2s enviro tick, 180s to 1.0)
const float DAMAGE_RUINED_VALUE
const float DAMAGE_DAMAGED_VALUE
const float DAMAGE_BADLY_DAMAGED_VALUE
const float DAMAGE_WORN_VALUE
const int STATE_BADLY_DAMAGED
const int VARIABLE_QUANTITY
const float STATE_SOAKING_WET
const float STATE_DRENCHED
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto void MatrixToQuat(vector mat[3], out float d[4])
Converts rotation matrix to quaternion.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
static proto float Acos(float c)
Returns angle in radians from cosinus.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float ModFloat(float x, float y)
Returns the floating-point remainder of x/y rounded towards zero.
static const float PI_HALF
static proto float Pow(float v, float power)
Return power of v ^ power.
static proto float Round(float f)
Returns mathematical round of value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float AbsFloat(float f)
Returns absolute value.
static const float RAD2DEG
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto float Floor(float f)
Returns floor of value.
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin)
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
proto int ToLower()
Changes string to lowercase. Returns length.
proto native int Length()
Returns length of string.