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);
1135 for (
int i = 0; i < parent.GetInventory().AttachmentCount(); ++i )
1144 for (
int j = 0; j < parent.GetInventory().GetCargo().GetItemCount(); ++j )
1157 if ( !
GetGame().IsMultiplayer() )
1161 if (CastTo(entityIB, entity))
1168 for (
int l = 0; l < entityIB.GetQuantity(); ++l)
1174 MiscGameplayFunctions.TransferItemProperties(entityIB, new_item);
1175 entityIB.AddQuantity( -1 );
1177 new_item.ThrowPhysically(null, force,
false);
1183 float stackable = entityIB.GetTargetQuantityMax();
1184 if ( !(stackable == 0 || stackable >= entityIB.GetQuantity()) )
1186 while (entityIB.GetQuantity() > stackable)
1189 position[1] = position[1] + 0.1;
1192 ItemBase splitItem = entityIB.SplitIntoStackMaxToInventoryLocationEx( spltDst );
1193 splitItem.ThrowPhysically(null, force,
false);
1198 entity.GetInventory().GetCurrentInventoryLocation(src);
1200 entity.GetInventory().TakeToDst(invMode, src, dst);
1201 entityIB.ThrowPhysically(null, force,
false);
1206 entity.GetInventory().DropEntity(invMode, entity.GetHierarchyRoot(), entity);
1216 float heatIsolation = pItem.GetHeatIsolation();
1217 float itemHealthLabel = pItem.GetHealthLevel();
1218 float itemWetness = pItem.GetWet();
1243 switch (itemHealthLabel)
1267 heatIsolation *= healthFactor;
1268 heatIsolation *= wetFactor;
1270 return heatIsolation;
1275 if (!obstructingObjects)
1278 for (
int i = 0; i < potentiallyObstructingObjects.Count(); ++i )
1280 Object obj = potentiallyObstructingObjects[i];
1281 if ( obj && ( obj.CanObstruct() || obj.CanProxyObstruct() ) )
1282 obstructingObjects.Insert(obj);
1288 return obj.IsTransport() || obj.CanUseConstruction();
1295 vicinityObjects.Copy(objects);
1300 int mCount = vicinityObjects.Count();
1302 if (!filteredObjects)
1306 if ( doDistanceCheck )
1308 for ( i = vicinityObjects.Count() - 1; i >= 0; --i )
1310 Object obj = vicinityObjects[i];
1312 vicinityObjects.Remove(i);
1320 float distance, dist1, dist2;
1322 for ( i = 0; i < obstructingObjects.Count(); ++i )
1324 distance =
vector.
DistanceSq(obstructingObjects[i].GetWorldPosition(), origin);
1325 distanceHelper.Insert(distance);
1328 distanceHelperUnsorted.Copy(distanceHelper);
1329 distanceHelper.Sort();
1331 for ( i = distanceHelper.Count() - 1; i >= 0; --i )
1332 sortedObstructingObjects.Insert(obstructingObjects[distanceHelperUnsorted.Find(distanceHelper[i])]);
1342 for ( i = 0; i < sortedObstructingObjects.Count(); ++i )
1344 Object obstrObj = sortedObstructingObjects[i];
1345 vector worldPos = obstrObj.GetWorldPosition();
1348 if ( obstrObj.GetCollisionBox(minMax) )
1352 max = max * (obstrObj.GetOrientation() * range);
1354 vector center, dx, dy, dz, half;
1355 center = (min + max) * 0.5;
1356 dz = obstrObj.GetOrientation();
1359 half = (max - min) * 0.5;
1365 for ( j = vicinityObjects.Count() - 1; j >= 0; --j )
1367 Object vicObj = vicinityObjects[j];
1370 vector d = vicObj.GetWorldPosition() - worldPos + center;
1373 group.Insert(vicObj);
1374 vicinityObjects.Remove(j);
1379 if ( group.Count() > 0 )
1380 tempGroups.Insert(group);
1385 for ( i = 0; i < tempGroups.Count(); ++i )
1393 for ( i = 0; i < objectGroups.Count(); ++i )
1396 Object sampleObject = objectGroup[0];
1399 filteredObjects.InsertAll(objectGroup);
1408 for (
int i = 0; i < objects.Count(); )
1410 Object obj1 = objects[i];
1415 for (
int j = objects.Count() - 1; j > i; --j )
1417 Object obj2 = objects[j];
1420 vector start = obj1.GetWorldPosition();
1421 vector end = obj2.GetWorldPosition();
1424 if ( distance < squaredDistanceDelta )
1431 objectGroups.Insert(group);
1454 if (doDistanceCheck &&
vector.
DistanceSq(player.GetPosition(), distanceCheckPos) > maxDist * maxDist)
1457 cache.ObjectCenterPos =
object.GetCenter();
1464 if (
object.CanProxyObstruct())
1468 if (cache.HitProxyObjects)
1470 if (cache.HitProxyObjects.Count() > 0)
1472 if (cache.HitProxyObjects[0].hierLevel > 0)
1475 if (!cache.HitProxyObjects[0].parent.IsMan())
1477 if (cache.HitProxyObjects[0].parent)
1480 if (proxyParent.GetInventory() && proxyParent.GetInventory().GetCargo())
1493 for (
int m = 0; m < cache.HitObjects.Count(); ++m)
1495 Object hit_object = cache.HitObjects.Get(m);
1497 if ( hit_object.CanObstruct() )
1524 if (geometryTypeOverride != -1)
1525 rayInput.
type = geometryTypeOverride;
1530 if (cache.HitProxyObjects)
1532 count = cache.HitProxyObjects.Count();
1534 for (i = 0; i < count; ++i)
1536 if (cache.HitProxyObjects[i].hierLevel > 0)
1538 parent = cache.HitProxyObjects[i].parent;
1539 if (parent && !parent.IsMan() && parent.CanProxyObstruct())
1541 if (parent !=
object || (parent ==
object &&
object.CanProxyObstructSelf()))
1549 int geometry = ObjIntersectFire;
1550 if (geometryTypeOverride != -1)
1551 geometry = geometryTypeOverride;
1552 DayZPhysics.
RaycastRV(cache.RaycastStart, cache.ObjectCenterPos, cache.ObjectContactPos, cache.ObjectContactDir, cache.ContactComponent, cache.HitObjects,
object,
GetGame().
GetPlayer(),
false,
false, geometry, 0.0,
CollisionFlags.ALLOBJECTS);
1553 count = cache.HitObjects.Count();
1554 for (i = 0; i < count; ++i)
1556 if (cache.HitObjects[i].CanObstruct())
1568 float adjustedDamage;
1572 if (modifierSurface == 0)
1573 modifierSurface = 1;
1575 if (player.GetInColdArea())
1578 adjustedDamage = baseDamage * modifierSurface;
1586 item.DecreaseHealth(dmg,
false);
1598 return val / maxVal;
1601 static float Bobbing(
float period,
float amplitude,
float elapsedTime)
1607 elapsedTime /= period;
1610 cycle += elapsedTime;
1612 cycle =
Math.
Sin(cycle) * amplitude;
1625 EntityAI entity = player.GetInventory().CreateInInventory(
"Splint");
1627 entity = player.SpawnEntityOnGroundOnCursorDir(
"Splint", 0.5);
1631 Class.
CastTo(attachment, player.GetItemOnSlot(
"Splint_Right"));
1632 if ( attachment && attachment.GetType() ==
"Splint_Applied" )
1636 MiscGameplayFunctions.TransferItemProperties(attachment,new_item);
1641 if (new_item.GetHealthLevel() < 4)
1643 int newDmgLevel = new_item.GetHealthLevel() + 1;
1645 float max = new_item.GetMaxHealth(
"",
"");
1647 switch ( newDmgLevel )
1672 attachment.Delete();
1679 if( player.GetSimulationTimeStamp() < 20 && !player.IsPersistentFlag(
PersistentFlag.AREA_PRESENCE) )
1684 vector player_pos = player.GetPosition();
1685 vector closest_safe_pos = MiscGameplayFunctions.GetClosestSafePos(player_pos, safe_positions);
1687 if (player_pos!=closest_safe_pos)
1689 closest_safe_pos[1] =
GetGame().
SurfaceY(closest_safe_pos[0], closest_safe_pos[2]);
1691 player.SetPosition( closest_safe_pos );
1695 PluginAdminLog adminLog = PluginAdminLog.Cast(
GetPlugin(PluginAdminLog));
1697 adminLog.PlayerTeleportedLog(player,player_pos,closest_safe_pos,
"Unwillingly spawning in contaminated area.");
1706 vector closest_pos = to_pos;
1707 float smallest_dist =
float.MAX;
1716 if ( dist < smallest_dist)
1718 smallest_dist = dist;
1728 vector playerPos = player.GetPosition();
1729 if (playerPos != safePos)
1731 player.SetPosition(safePos);
1754 float minValue = 0.0;
1755 for (
int i = 0; i < pArray.Count(); ++i)
1757 if (minValue == 0 || pArray.Get(i) < minValue)
1759 minValue = pArray.Get(i);
1768 float maxValue = 0.0;
1769 for (
int i = 0; i < pArray.Count(); ++i)
1771 if (maxValue == 0 || pArray.Get(i) > maxValue)
1773 maxValue = pArray.Get(i);
1787 if (pSelection.Count() == 0 || pCompName.
Length() == 0)
1792 for (
int i = 0; i < pSelection.Count(); ++i)
1795 if (pSelection[i] && pSelection[i].
GetName() == pCompName)
1806 if (!MiscGameplayFunctions.IsComponentInSelection(pSelection, pCompName))
1811 for (
int i = 0; i < pSelection.Count(); ++i)
1814 if (pSelection[i] && pSelection[i].
GetName() == pCompName)
1825 if (listOfTypenames.Count() > 0)
1830 Object childToRemove = child;
1831 child =
Object.Cast(child.GetSibling());
1833 if (childToRemove.IsAnyInherited(listOfTypenames))
1835 vector pos = parent.GetPosition();
1836 parent.RemoveChild(childToRemove,
false);
1841 childToRemove.SetTransform(m4);
1842 childToRemove.PlaceOnSurface();
1850 if (listOfTypenames.Count() > 0)
1855 Object childToRemove = child;
1856 child =
Object.Cast(child.GetSibling());
1858 if (childToRemove.IsAnyInherited(listOfTypenames))
1860 parent.RemoveChild(childToRemove,
false);
1861 childToRemove.Delete();
1873 outputObjects.Insert(child);
1882 if (parent.GetLiquidType() != 0 && parent.GetQuantityNormalized() > liquidQuantityThresholdPercentage && !parent.GetIsFrozen())
1891 g_Game.GetWeather().GetWindMagnitude().GetLimits(windMin, windMax);
1892 float snowfall =
g_Game.GetWeather().GetSnowfall().GetActual();
1893 float value = snowfall +
g_Game.GetWeather().GetWindMagnitude().GetActual() / windMax;
1907 old_item.GetTransform(mtx);
1909 player.GetTransform(mtx);
1911 OverrideNewLocation(gnd);
1916 super.RemoveOldItemFromLocation();
1917 m_Player.GetHumanInventory().OnEntityInHandsDestroyed(m_OldLocation);
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
override void OnSuccess(EntityAI new_item)
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 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 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 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.