14 void SetTransferParams (
bool transfer_agents =
true,
bool transfer_variables =
true,
bool transfer_health =
true,
bool exclude_quantity =
false,
float quantity_override = -1)
25 super.CopyOldPropertiesToNew(old_item, new_item);
30 MiscGameplayFunctions.TransferInventory(old_item, new_item,
m_Player);
41 Debug.
LogError(
"TurnItemIntoItemLambda: failed to create new item",
"static");
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);
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);
98 m_Player.GetItemAccessor().OnItemInHandsChanged();
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)
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;
273 if (transfer_agents && target_ib)
274 target_ib.TransferAgents(source.GetAgents());
276 if (transfer_variables)
277 MiscGameplayFunctions.TransferEntityVariables(source, target, exclude_quantity);
290 if (exclude_quantity)
292 int maskOriginal = source.m_VariablesMask;
294 target.TransferVariablesFloat(source.GetVariablesFloat());
295 source.m_VariablesMask = maskOriginal;
299 target.TransferVariablesFloat(source.GetVariablesFloat());
302 if (source.IsMagazine() && target.IsMagazine())
304 Magazine source_mag = Magazine.Cast(source);
305 Magazine target_mag = Magazine.Cast(target);
307 target_mag.ServerSetAmmoCount(source_mag.GetAmmoCount());
310 if (source.IsWeapon() && target.IsWeapon())
315 target_wpn.CopyWeaponStateFrom(source_wpn);
318 if (source.HasEnergyManager() && target.HasEnergyManager())
350 int count = children.Count();
351 for (
int i = 0; i < count; ++i)
357 child.GetInventory().GetCurrentInventoryLocation( child_src );
360 child_dst.
Copy( child_src );
368 targetItem.GetInventory().TakeToDst(
InventoryMode.LOCAL, child_src, child_dst);
377 player.LocalDropEntity(child);
389 if (!healthTypes || healthTypes.Count() == 0)
390 HPTypes.Insert(
"Health");
392 HPTypes.Copy(healthTypes);
394 if (transferZoneDamage)
398 source.GetDamageZones(zonesSrc);
399 target.GetDamageZones(zonesTgt);
401 foreach (
string zone : zonesSrc)
403 if (zonesTgt.Find(zone) == -1)
406 foreach (
string health : HPTypes)
408 target.SetHealth01(zone,health,source.GetHealth01(zone,health));
413 foreach (
string gHealth : HPTypes)
415 target.SetHealth01(
"",gHealth,source.GetHealth01(
"",gHealth));
426 magazine = weapon.GetMagazine(weapon.GetCurrentMuzzle());
430 if (magazine.GetAmmoCount() <= 5)
432 magazine.ServerSetAmmoMax();
438 magazine = weapon.GetMagazine(weapon.GetCurrentMuzzle());
442 if (magazine.GetAmmoCount() <= 5)
444 magazine.LocalSetAmmoMax();
461 player.ServerReplaceItemWithNew(lambda);
471 player.ServerReplaceItemInHandsWithNew(lambda);
478 float max_stack_size;
482 max_stack_size =
g_Game.ConfigGetInt(
"cfgVehicles " + item_name +
" varStackMax");
483 if( max_stack_size < 1)
484 max_stack_size =
g_Game.ConfigGetInt(
"cfgVehicles " + item_name +
" varQuantityMax");
485 if( max_stack_size < 1)
488 int full_piles_count =
Math.
Floor(quantity/max_stack_size);
489 int rest = quantity - (full_piles_count*max_stack_size);
491 for (
int i = 0; i < full_piles_count; ++i)
498 pile.SetHealth(health);
499 item_piles.Insert(pile);
509 pile.SetHealth(health);
510 item_piles.Insert(pile);
519 float max_stack_size;
523 max_stack_size =
g_Game.ConfigGetInt(
"cfgVehicles " + item_name +
" varStackMax");
524 if( max_stack_size < 1)
525 max_stack_size =
g_Game.ConfigGetInt(
"cfgVehicles " + item_name +
" varQuantityMax");
526 if( max_stack_size < 1)
529 int full_piles_count =
Math.
Floor(quantity/max_stack_size);
530 int rest = quantity - (full_piles_count*max_stack_size);
533 for (
int i = 0; i < full_piles_count; ++i)
535 randomizedPos = MiscGameplayFunctions.GetRandomizedPositionVerified(starPos,targetPos,radius,ignoreObjectCollison);
538 pile.SetHealth(health);
539 item_piles.Insert(pile);
544 randomizedPos = MiscGameplayFunctions.GetRandomizedPositionVerified(starPos,targetPos,radius,ignoreObjectCollison);
547 pile.SetHealth(health);
548 item_piles.Insert(pile);
560 stack_size =
g_Game.ConfigGetInt(
"cfgMagazines " + item_name +
" count");
562 int piles_count =
Math.
Floor(quantity/stack_size);
563 int rest = quantity - (piles_count*stack_size);
565 for (
int i = 0; i < piles_count; ++i)
568 pile.ServerSetAmmoCount(stack_size);
574 pile.ServerSetAmmoCount(rest);
588 stack_size =
g_Game.ConfigGetInt(
"cfgMagazines " + item_name +
" count");
590 int piles_count =
Math.
Floor(quantity/stack_size);
591 int rest = quantity - (piles_count*stack_size);
594 for (
int i = 0; i < piles_count; ++i)
596 randomizedPos = MiscGameplayFunctions.GetRandomizedPositionVerified(starPos,targetPos,radius,ignoreObjectCollison);
598 pile.ServerSetAmmoCount(stack_size);
604 randomizedPos = MiscGameplayFunctions.GetRandomizedPositionVerified(starPos,targetPos,radius,ignoreObjectCollison);
606 pile.ServerSetAmmoCount(rest);
619 if (!
g_Game.ConfigGetText(
"cfgAmmo " + bullet_type +
" spawnPileType", item_name))
622 stack_size =
g_Game.ConfigGetInt(
"cfgMagazines " + item_name +
" count");
626 int piles_count =
Math.
Floor(quantity/stack_size);
627 int rest = quantity - (piles_count*stack_size);
629 for (
int i = 0; i < piles_count; ++i)
632 pile.ServerSetAmmoCount(stack_size);
639 pile.ServerSetAmmoCount(rest);
652 if (!
g_Game.ConfigGetText(
"cfgAmmo " + bullet_type +
" spawnPileType", item_name))
661 float health_normalized = health / 100;
692 cfg_path = cfg_path +
" "+
class_name+
" DamageSystem GlobalHealth " + health_type +
" hitpoints";
700 vector usti_hlavne_position = weapon.GetSelectionPositionMS(
"usti hlavne" );
701 vector konec_hlavne_position = weapon.GetSelectionPositionMS(
"konec hlavne" );
702 vector end_point = weapon.ModelToWorld(usti_hlavne_position);
703 vector begin_point = weapon.ModelToWorld(konec_hlavne_position);
705 int contact_component;
707 vector aim_point = end_point - begin_point;
709 aim_point = aim_point + end_point;
711 if (
DayZPhysics.
RaycastRV(begin_point, aim_point, position, contact_dir, contact_component, null, null, null,
false,
false, ObjIntersectFire))
719 int headBoneIdx = player.GetBoneIndexByName(
"Head");
720 if ( headBoneIdx == -1 )
721 { pos = player.GetPosition()[1] + 1.6; }
723 { pos = player.GetBonePositionWS(headBoneIdx); }
747 switch (movement_speed)
770 switch (movement_speed)
792 return entity.ConfigGetString(
"OnRestrainChange");
802 type = tool.ConfigGetBool(
"RestrainUnlockType");
804 string new_item_name = current_item.ConfigGetString(
"OnRestrainChange");
806 if ( new_item_name !=
"" )
810 if (player_target.IsAlive())
811 MiscGameplayFunctions.TurnItemIntoItemEx(player_target,
new ReplaceAndDestroyLambdaEx(current_item, new_item_name, player_target, type));
817 MiscGameplayFunctions.TurnItemIntoItemEx(player_target,
new ReplaceAndDestroyLambdaEx(current_item, new_item_name, player_target, type));
822 Error(
"current_item:" +current_item+
", tool:" +tool +
". No value for 'OnRestrainChange' config parameter");
828 return (value >= from) && (value <= to);
836 vector player_dir = player.GetDirection();
837 vector to_target_dir = target_pos - player.GetPosition();
840 to_target_dir[1] = 0;
845 float cos_fi =
vector.
Dot(player_dir, to_target_dir);
846 vector cross = player_dir * to_target_dir;
854 if( (dir <= cone_angle && dir >= -cone_angle) ||
Math.
AbsFloat(dir) == 90 )
865 int max_length = 512;
866 string output = input;
883 Construction construction = base_building.GetConstruction();
884 if (construction &&
BuildCondition( player, target, item,
false, constraction_index ))
899 if ( player.IsPlacingLocal() || player.IsPlacingServer() )
908 return !construction.IsColliding( partName );
922 Object targetObject = target.GetObject();
923 if ( targetObject && targetObject.CanUseConstruction() )
927 construction_action_data.
SetTarget( targetObject );
948 if ( constrution_part )
952 if ( position_check && !player.GetInputController().CameraIsFreeLook() )
974 entity.GetCollisionBox(minMax);
978 float from_override = entity.HeightStartCheckOverride();
979 if (from_override > 0.0)
981 size[1] = from_override;
985 size[1] = minMax[1][1] - minMax[0][1];
988 from = entity.GetPosition() + size;
989 if ( entity.HeightCheckOverride() > 0 )
991 to = entity.GetPosition() +
Vector(0, entity.HeightCheckOverride(), 0);
1015 int contact_component;
1017 return DayZPhysics.
RaycastRV(from, to, contact_pos, contact_dir, contact_component, NULL, NULL, entity,
false,
false, geometry,0.25);
1024 float steam_offset = 0;
1028 particle_pos = parent.GetPosition();
1030 if ( parent.IsInherited( PortableGasStove ) )
1046 else if ( fireplace.IsFireplaceIndoor() )
1048 steam_offset = 0.45;
1057 particle_pos[1] = particle_pos[1] + steam_offset;
1059 return particle_pos;
1066 vector randomPos =
Vector(targetPos[0] + (
Math.
Cos(angle) * usedRadius), targetPos[1], targetPos[2] + (
Math.
Sin(angle) * usedRadius));
1075 params.
type = ObjIntersectIFire;
1080 ret = results[0].pos;
1081 ret[1] = targetPos[1];
1089 MiscGameplayFunctions.GetHeadBonePos(
PlayerBase.Cast(player),startPos);
1090 vector targetPos = player.GetPosition() + (player.GetDirection() * distance);
1101 vector direction = ib.GetDirection();
1105 if (direction[0] < 0)
1112 int count = items.Count();
1113 for (
int i = 0; i < count; ++i )
1115 item = items.Get(i);
1117 ib.GetInventory().DropEntityInBounds(
InventoryMode.SERVER, ib, item, halfExtents, angle, cos, sin);
1123 vector position = parent.GetPosition();
1124 vector orientation = parent.GetOrientation();
1125 vector rotation_matrix[3];
1129 parent.GetCollisionBox(minmax);
1138 count = parent.GetInventory().AttachmentCount();
1139 for (i = 0; i < count; ++i)
1141 ents.Insert(parent.GetInventory().GetAttachmentFromIndex(i));
1145 count = parent.GetInventory().GetCargo().GetItemCount();
1146 for (i = 0; i < count; ++i)
1148 ents.Insert(parent.GetInventory().GetCargo().GetItem(i));
1164 if ( !
GetGame().IsMultiplayer() )
1168 if (CastTo(entityIB, entity))
1175 for (
int l = 0; l < entityIB.GetQuantity(); ++l)
1181 MiscGameplayFunctions.TransferItemProperties(entityIB, new_item);
1182 entityIB.AddQuantity( -1 );
1184 new_item.ThrowPhysically(null, force,
false);
1190 float stackable = entityIB.GetTargetQuantityMax();
1191 if ( !(stackable == 0 || stackable >= entityIB.GetQuantity()) )
1193 while (entityIB.GetQuantity() > stackable)
1196 position[1] = position[1] + 0.1;
1199 ItemBase splitItem = entityIB.SplitIntoStackMaxToInventoryLocationEx( spltDst );
1200 splitItem.ThrowPhysically(null, force,
false);
1205 entity.GetInventory().GetCurrentInventoryLocation(src);
1207 entity.GetInventory().TakeToDst(invMode, src, dst);
1208 entityIB.ThrowPhysically(null, force,
false);
1213 entity.GetInventory().DropEntity(invMode, entity.GetHierarchyRoot(), entity);
1223 float heatIsolation = pItem.GetHeatIsolation();
1224 float itemHealthLabel = pItem.GetHealthLevel();
1225 float itemWetness = pItem.GetWet();
1250 switch (itemHealthLabel)
1274 heatIsolation *= healthFactor;
1275 heatIsolation *= wetFactor;
1277 return heatIsolation;
1282 if (!obstructingObjects)
1285 for (
int i = 0; i < potentiallyObstructingObjects.Count(); ++i )
1287 Object obj = potentiallyObstructingObjects[i];
1288 if ( obj && ( obj.CanObstruct() || obj.CanProxyObstruct() ) )
1289 obstructingObjects.Insert(obj);
1295 return obj.IsTransport() || obj.CanUseConstruction();
1302 vicinityObjects.Copy(objects);
1307 int mCount = vicinityObjects.Count();
1309 if (!filteredObjects)
1313 if ( doDistanceCheck )
1315 for ( i = vicinityObjects.Count() - 1; i >= 0; --i )
1317 Object obj = vicinityObjects[i];
1319 vicinityObjects.Remove(i);
1327 float distance, dist1, dist2;
1329 for ( i = 0; i < obstructingObjects.Count(); ++i )
1331 distance =
vector.
DistanceSq(obstructingObjects[i].GetWorldPosition(), origin);
1332 distanceHelper.Insert(distance);
1335 distanceHelperUnsorted.Copy(distanceHelper);
1336 distanceHelper.Sort();
1338 for ( i = distanceHelper.Count() - 1; i >= 0; --i )
1339 sortedObstructingObjects.Insert(obstructingObjects[distanceHelperUnsorted.Find(distanceHelper[i])]);
1349 for ( i = 0; i < sortedObstructingObjects.Count(); ++i )
1351 Object obstrObj = sortedObstructingObjects[i];
1352 vector worldPos = obstrObj.GetWorldPosition();
1355 if ( obstrObj.GetCollisionBox(minMax) )
1359 max = max * (obstrObj.GetOrientation() * range);
1361 vector center, dx, dy, dz, half;
1362 center = (min + max) * 0.5;
1363 dz = obstrObj.GetOrientation();
1366 half = (max - min) * 0.5;
1372 for ( j = vicinityObjects.Count() - 1; j >= 0; --j )
1374 Object vicObj = vicinityObjects[j];
1377 vector d = vicObj.GetWorldPosition() - worldPos + center;
1380 group.Insert(vicObj);
1381 vicinityObjects.Remove(j);
1386 if ( group.Count() > 0 )
1387 tempGroups.Insert(group);
1392 for ( i = 0; i < tempGroups.Count(); ++i )
1400 for ( i = 0; i < objectGroups.Count(); ++i )
1403 Object sampleObject = objectGroup[0];
1406 filteredObjects.InsertAll(objectGroup);
1415 for (
int i = 0; i < objects.Count(); )
1417 Object obj1 = objects[i];
1422 for (
int j = objects.Count() - 1; j > i; --j )
1424 Object obj2 = objects[j];
1427 vector start = obj1.GetWorldPosition();
1428 vector end = obj2.GetWorldPosition();
1431 if ( distance < squaredDistanceDelta )
1438 objectGroups.Insert(group);
1461 if (doDistanceCheck &&
vector.
DistanceSq(player.GetPosition(), distanceCheckPos) > maxDist * maxDist)
1464 cache.ObjectCenterPos =
object.GetCenter();
1471 if (
object.CanProxyObstruct())
1475 if (cache.HitProxyObjects)
1477 if (cache.HitProxyObjects.Count() > 0)
1479 if (cache.HitProxyObjects[0].hierLevel > 0)
1482 if (!cache.HitProxyObjects[0].parent.IsMan())
1484 if (cache.HitProxyObjects[0].parent)
1487 if (proxyParent.GetInventory() && proxyParent.GetInventory().GetCargo())
1500 for (
int m = 0; m < cache.HitObjects.Count(); ++m)
1502 Object hit_object = cache.HitObjects.Get(m);
1504 if ( hit_object.CanObstruct() )
1531 if (geometryTypeOverride != -1)
1532 rayInput.
type = geometryTypeOverride;
1537 if (cache.HitProxyObjects)
1539 count = cache.HitProxyObjects.Count();
1541 for (i = 0; i < count; ++i)
1543 if (cache.HitProxyObjects[i].hierLevel > 0)
1545 parent = cache.HitProxyObjects[i].parent;
1546 if (parent && !parent.IsMan() && parent.CanProxyObstruct())
1548 if (parent !=
object || (parent ==
object &&
object.CanProxyObstructSelf()))
1556 int geometry = ObjIntersectFire;
1557 if (geometryTypeOverride != -1)
1558 geometry = geometryTypeOverride;
1559 DayZPhysics.
RaycastRV(cache.RaycastStart, cache.ObjectCenterPos, cache.ObjectContactPos, cache.ObjectContactDir, cache.ContactComponent, cache.HitObjects,
object,
GetGame().
GetPlayer(),
false,
false, geometry, 0.0,
CollisionFlags.ALLOBJECTS);
1560 count = cache.HitObjects.Count();
1561 for (i = 0; i < count; ++i)
1563 if (cache.HitObjects[i].CanObstruct())
1575 float adjustedDamage;
1579 if (modifierSurface == 0)
1580 modifierSurface = 1;
1582 if (player.GetInColdArea())
1585 adjustedDamage = baseDamage * modifierSurface;
1593 item.DecreaseHealth(dmg,
false);
1605 return val / maxVal;
1608 static float Bobbing(
float period,
float amplitude,
float elapsedTime)
1614 elapsedTime /= period;
1617 cycle += elapsedTime;
1619 cycle =
Math.
Sin(cycle) * amplitude;
1632 EntityAI entity = player.GetInventory().CreateInInventory(
"Splint");
1634 entity = player.SpawnEntityOnGroundOnCursorDir(
"Splint", 0.5);
1638 Class.
CastTo(attachment, player.GetItemOnSlot(
"Splint_Right"));
1639 if ( attachment && attachment.GetType() ==
"Splint_Applied" )
1643 MiscGameplayFunctions.TransferItemProperties(attachment,new_item);
1648 if (new_item.GetHealthLevel() < 4)
1650 int newDmgLevel = new_item.GetHealthLevel() + 1;
1652 float max = new_item.GetMaxHealth(
"",
"");
1654 switch ( newDmgLevel )
1679 attachment.Delete();
1686 if( player.GetSimulationTimeStamp() < 20 && !player.IsPersistentFlag(
PersistentFlag.AREA_PRESENCE) )
1691 vector player_pos = player.GetPosition();
1692 vector closest_safe_pos = MiscGameplayFunctions.GetClosestSafePos(player_pos, safe_positions);
1694 if (player_pos!=closest_safe_pos)
1696 closest_safe_pos[1] =
GetGame().
SurfaceY(closest_safe_pos[0], closest_safe_pos[2]);
1698 player.SetPosition( closest_safe_pos );
1702 PluginAdminLog adminLog = PluginAdminLog.Cast(
GetPlugin(PluginAdminLog));
1704 adminLog.PlayerTeleportedLog(player,player_pos,closest_safe_pos,
"Unwillingly spawning in contaminated area.");
1713 vector closest_pos = to_pos;
1714 float smallest_dist =
float.MAX;
1723 if ( dist < smallest_dist)
1725 smallest_dist = dist;
1735 vector playerPos = player.GetPosition();
1736 if (playerPos != safePos)
1738 player.SetPosition(safePos);
1761 float minValue = 0.0;
1762 for (
int i = 0; i < pArray.Count(); ++i)
1764 if (minValue == 0 || pArray.Get(i) < minValue)
1766 minValue = pArray.Get(i);
1775 float maxValue = 0.0;
1776 for (
int i = 0; i < pArray.Count(); ++i)
1778 if (maxValue == 0 || pArray.Get(i) > maxValue)
1780 maxValue = pArray.Get(i);
1794 if (pSelection.Count() == 0 || pCompName.
Length() == 0)
1799 for (
int i = 0; i < pSelection.Count(); ++i)
1802 if (pSelection[i] && pSelection[i].
GetName() == pCompName)
1813 if (!MiscGameplayFunctions.IsComponentInSelection(pSelection, pCompName))
1818 for (
int i = 0; i < pSelection.Count(); ++i)
1821 if (pSelection[i] && pSelection[i].
GetName() == pCompName)
1832 if (listOfTypenames.Count() > 0)
1837 Object childToRemove = child;
1838 child =
Object.Cast(child.GetSibling());
1840 if (childToRemove.IsAnyInherited(listOfTypenames))
1842 vector pos = parent.GetPosition();
1843 parent.RemoveChild(childToRemove,
false);
1848 childToRemove.SetTransform(m4);
1849 childToRemove.PlaceOnSurface();
1857 if (listOfTypenames.Count() > 0)
1862 Object childToRemove = child;
1863 child =
Object.Cast(child.GetSibling());
1865 if (childToRemove.IsAnyInherited(listOfTypenames))
1867 parent.RemoveChild(childToRemove,
false);
1868 childToRemove.Delete();
1880 outputObjects.Insert(child);
1889 if (parent.GetLiquidType() != 0 && parent.GetQuantityNormalized() > liquidQuantityThresholdPercentage && !parent.GetIsFrozen())
1898 g_Game.GetWeather().GetWindMagnitude().GetLimits(windMin, windMax);
1899 float snowfall =
g_Game.GetWeather().GetSnowfall().GetActual();
1900 float value = snowfall +
g_Game.GetWeather().GetWindMagnitude().GetActual() / windMax;
1914 old_item.GetTransform(mtx);
1916 player.GetTransform(mtx);
1918 OverrideNewLocation(gnd);
1923 super.RemoveOldItemFromLocation();
1924 m_Player.GetHumanInventory().OnEntityInHandsDestroyed(m_OldLocation);
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
override void OnSuccess(EntityAI new_item)
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
const int ECE_PLACE_ON_SURFACE
const int ECE_UPDATEPATHGRAPH
const int ECE_CREATEPHYSICS
void Construction(BaseBuildingBase parent)
proto native int GetComponentIndex()
bool IsUnderRoof()
Is character under roof (periodically checked - GameConstants.ENVIRO_TICK_ROOF_RC_CHECK)....
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 void TransferEntityVariables(EntityAI source, EntityAI target, bool exclude_quantity=false)
static vector TruncateVec(vector value, int decimals=2)
truncate float to specified precision
static string ObtainRestrainItemTargetClassname(notnull EntityAI entity)
static void GetAttachedChildren(IEntity parent, array< IEntity > outputObjects)
Fills the provided array with all children entities in hierarchy of this entity.
static vector GetRandomizedPositionVerifiedPlayer(Man player, float distance, float radius, Object ignore)
static void TransferEntityHealth(EntityAI source, EntityAI target, array< string > healthTypes=null, bool transferZoneDamage=true)
static void DealAbsoluteDmg(ItemBase item, float dmg)
static void TransferItemVariables(ItemBase source, ItemBase target, bool exclude_quantity=false)
DEPRECATED.
static float GetCombinedSnowfallWindValue()
static bool TeleportPlayerToSafeLocation3D(notnull PlayerBase player, vector safePos)
'stupider' teleport method, does not touch flag management. Applies Y from the position as well!
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)
static vector GetRandomizedPosition(vector targetPos, float radius)
static void DealEvinronmentAdjustedDmg(ItemBase item, PlayerBase player, float baseDamage)
static array< Magazine > CreateMagazinePilesFromBulletDispersed(string bullet_type, vector starPos, vector targetPos, float radius, float quantity, float health, Object ignoreObjectCollison)
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
void MoveEquipToExistingItemAndDestroyOldRootLambda(EntityAI old_item, string new_item_type, PlayerBase player, EntityAI new_item)
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 DeleteAttachedChildrenByTypename(notnull EntityAI parent, array< typename > listOfTypenames)
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 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 array< ItemBase > CreateItemBasePilesDispersed(string item_name, vector starPos, vector targetPos, float radius, float quantity, float health, Object ignoreObjectCollison)
creation method using raycast-dispersed positioning; ECE_TRACE not used as a result
static bool IsObjectObstructedProxy(Object object, IsObjectObstructedCache cache, PlayerBase player)
static float GetWaterMetabolicSpeed(int movement_speed)
static bool IsObjectObstructedFilterEx(Object object, IsObjectObstructedCache cache, PlayerBase player, int geometryTypeOverride=-1)
groups 'RaycastRVProxy' and 'RaycastRV' approaches into one method, allowes for comprehensive geometr...
static vector GetRandomizedPositionVerified(vector startPos, vector targetPos, float radius, Object ignore=null)
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 variables, agents and other local scripted properties as well as any relevant non-scri...
static float GetCurrentItemHeatIsolation(ItemBase pItem)
static array< Magazine > CreateMagazinePilesDispersed(string item_name, vector starPos, vector targetPos, float radius, float quantity, float health, Object ignoreObjectCollison)
creation method using raycast-dispersed positioning; ECE_TRACE not used as a result
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 SoakItemInsideParentContainingLiquidAboveThreshold(notnull ItemBase item, notnull ItemBase parent, float liquidQuantityThresholdPercentage=0.05)
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
PluginBase GetPlugin(typename plugin_type)
override bool IsPlayerInside(PlayerBase player, string selection)
override bool PerformRoofCheckForBase(string partName, PlayerBase player, out bool result)
override bool MustBeBuiltFromOutside()
override bool IsFacingCamera(string selection)
proto native NoiseSystem GetNoiseSystem()
proto native float SurfaceY(float x, float z)
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
string ConfigGetTextOut(string path)
Get string value from config on path.
proto native void RemoteObjectTreeDelete(Object obj)
RemoteObjectDelete - deletes only remote object (unregisters from network). do not use if not sure wh...
proto void SurfaceUnderObject(notnull Object object, out string type, out int liquidType)
proto native void RemoteObjectTreeCreate(Object obj)
RemoteObjectCreate - postponed registration of network object (and creation of remote object)....
proto native void ConfigGetFloatArray(string path, out TFloatArray values)
Get array of floats from config on path.
proto native Mission GetMission()
static ref TFloatArray ARRAY_FLOAT
Super root of all classes in Enforce script.
void SwitchOn()
Energy manager: Switches ON the device so it starts doing its work if it has enough energy.
float GetEnergy()
Energy manager: Returns the amount of stored energy this device has.
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)
void SetTarget(Object target)
ConstructionPart GetBuildPartAtIndex(int idx)
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.
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
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.
void DestroyItemInCorpsesHandsAndCreateNewOnGndLambda(EntityAI old_item, string new_item_type, PlayerBase player, bool destroy=false)
override void RemoveOldItemFromLocation()
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
void DropEquipAndDestroyRootLambda(EntityAI old_item, string new_item_type, PlayerBase player)
void TransferFoodStage(notnull Edible_Base source)
override bool IsBaseFireplace()
override bool IsIndoorOven()
override bool IsBarrelWithHoles()
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 EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
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/....
script counterpart to engine's class Inventory
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
proto native void SetParent(notnull EntityAI parent)
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
sets current inventory location type to Ground with transformation mat
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
provides access to slot configuration
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override bool CanBeSplit()
this one is a also bit special: it moves all items to already existing item and destroys the ex-root ...
static float GetNoiseReduction(Weather weather)
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_WATER_BASAL
static const float METABOLIC_SPEED_WATER_WALK
static const float METABOLIC_SPEED_ENERGY_JOG
static const float METABOLIC_SPEED_WATER_JOG
static const float METABOLIC_SPEED_ENERGY_WALK
static const float METABOLIC_SPEED_WATER_SPRINT
static const float METABOLIC_SPEED_ENERGY_SPRINT
static const float METABOLIC_SPEED_ENERGY_BASAL
void ReplaceAndDestroyLambda(EntityAI old_item, string new_item_type, PlayerBase player, bool destroy=false)
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
override void VerifyItemTypeBySlotType()
if attaching from att.slot to att.slot, skips the change to "ground" version. Allows for correct prop...
void TurnItemIntoItemLambda(EntityAI old_item, string new_item_type, PlayerBase player)
float m_quantity_override
void SetTransferParams(bool transfer_agents=true, bool transfer_variables=true, bool transfer_health=true, bool exclude_quantity=false, float quantity_override=-1)
void ReplaceItemWithNewLambda(EntityAI old_item, string new_item_type, PlayerBase player)
override void OnSuccess(EntityAI new_item)
void ReplaceItemWithNewLambdaBase(EntityAI old_item, string new_item_type)
void UndoRemoveNetworkObjectInfo()
void CreateNetworkObjectInfo(EntityAI new_item)
Step G. - create NetworkObjectInfo for new item.
ref InventoryLocation m_NewLocation
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
void RemoveNetworkObjectInfo()
Step C. - remove network part of the object @NOTE this operation does not delete the object,...
base class for transformation operations (creating one item from another)
static float GetParamFloat(string surface_name, string param_name)
override void OnSuccess(EntityAI new_item)
float GetColdAreaToolDamageModifier()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static const vector Aside
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
static const vector Forward
proto float Normalize()
Normalizes vector. Returns length.
static vector RotateAroundZero(vector pos, vector axis, float cosAngle, float sinAngle)
Rotate a vector around 0,0,0.
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
proto native IEntity GetSibling()
Returns pointer to next child Entity on the same hierarchy.
proto native IEntity GetChildren()
Returns pointer to first child Entity in hierarchy.
const float ENVIRO_ISOLATION_WETFACTOR_SOAKED
const float ENVIRO_ISOLATION_WETFACTOR_WET
const float ENVIRO_ISOLATION_WETFACTOR_DAMP
const float ENVIRO_ISOLATION_WETFACTOR_DRENCHED
const float ENVIRO_ISOLATION_HEALTHFACTOR_RUINED
const float ENVIRO_ISOLATION_HEALTHFACTOR_DAMAGED
const float ENVIRO_ISOLATION_HEALTHFACTOR_WORN
const float ENVIRO_ISOLATION_WETFACTOR_DRY
impact of item wetness to the heat isolation
const float ENVIRO_ISOLATION_HEALTHFACTOR_PRISTINE
impact of item health (state) to the heat isolation
const float ENVIRO_ISOLATION_HEALTHFACTOR_B_DAMAGED
const float DAMAGE_BADLY_DAMAGED_VALUE
const float DAMAGE_RUINED_VALUE
const float DAMAGE_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 float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Floor(float f)
Returns floor of value.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static const float PI_HALF
static proto float ModFloat(float x, float y)
Returns the floating-point remainder of x/y rounded towards zero.
static proto float Acos(float c)
Returns angle in radians from cosinus.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Round(float f)
Returns mathematical round of value.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
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 Sin(float angle)
Returns sinus of angle in radians.
static proto float Pow(float v, float power)
Return power of v ^ power.
static const float RAD2DEG
static proto float AbsFloat(float f)
Returns absolute value.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
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 native int Length()
Returns length of string.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
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.