35 m_quantity_override =
Math.
Max(m_quantity_override, 0);
40 Debug.
LogError(
"TurnItemIntoItemLambda: failed to create new item",
"static");
46 if (m_NewLocation.GetType() ==
InventoryLocationType.ATTACHMENT && m_OldItem.ConfigIsExisting(
"ChangeIntoOnAttach"))
58 attach_types.Insert(m_OldItem.ConfigGetString(
"ChangeIntoOnAttach"));
65 m_OldItem.ConfigGetTextArray(
"ChangeIntoOnAttach",
attach_types);
68 idx = m_NewLocation.GetSlot();
79 m_Player.GetItemAccessor().OnItemInHandsChanged();
163 Error(
"MoveEquipAndDestroyRootLambda expects new_item_type to be empty");
168 super.RemoveNetworkObjectInfo();
173 super.UndoRemoveNetworkObjectInfo();
233 return string.
Format(
"#(argb,8,8,3)color(%1,CO)",
string.Format(
"%1,%2,%3,%4", r, g, b, a));
278 target.TransferVariablesFloat(
source.GetVariablesFloat());
297 else if (
source.HasEnergyManager() &&
target.HasEnergyManager())
302 emt.SetEnergy(
ems.GetEnergy());
304 if (
ems.IsSwitchedOn())
552 if (
DayZPhysics.
RaycastRV(
begin_point,
aim_point,
position,
contact_dir,
contact_component,
null,
null,
null,
false,
false,
ObjIntersectFire))
562 pos =
player.GetPosition()[1] + 1.6;
633 return entity.ConfigGetString(
"OnRestrainChange");
643 type =
tool.ConfigGetBool(
"RestrainUnlockType");
660 Error(
"current_item:" +
current_item +
", tool:" +
tool +
". No value for 'OnRestrainChange' config parameter");
731 if (
player.IsPlacingLocal() ||
player.IsPlacingServer())
811 if (
entity.HeightCheckOverride() > 0)
838 bool boo =
DayZPhysics.
RaycastRV(
from,
to,
contact_pos,
contact_dir,
contact_component,
NULL,
NULL,
entity,
false,
false,
geometry, 0.25);
921 parent.GetCollisionBox(
minmax);
927 for (
int i = 0;
i < parent.GetInventory().AttachmentCount(); ++
i)
936 for (
int j = 0;
j < parent.GetInventory().GetCargo().GetItemCount(); ++
j)
949 if (!
GetGame().IsMultiplayer())
990 entity.GetInventory().GetCurrentInventoryLocation(
src);
1063 if (obj && (obj.CanObstruct() || obj.CanProxyObstruct()))
1070 return obj.IsTransport() || obj.CanUseConstruction();
1161 if (
group.Count() > 0)
1239 cache.ObjectCenterPos =
object.GetCenter();
1246 if (
object.CanProxyObstruct())
1250 if (
cache.HitProxyObjects)
1252 if (
cache.HitProxyObjects.Count() > 0)
1254 if (
cache.HitProxyObjects[0].hierLevel > 0)
1257 if (!
cache.HitProxyObjects[0].parent.IsMan())
1259 if (
cache.HitProxyObjects[0].parent)
1275 for (
int m = 0;
m <
cache.HitObjects.Count();
m++)
1312 if (
cache.HitProxyObjects)
1318 if (
cache.HitProxyObjects[
i].hierLevel > 0)
1320 parent =
cache.HitProxyObjects[
i].parent;
1321 if (parent && !parent.IsMan() && parent.CanProxyObstruct())
1323 if (parent !=
object || (parent ==
object &&
object.CanProxyObstructSelf()))
1334 DayZPhysics.
RaycastRV(
cache.RaycastStart,
cache.ObjectCenterPos,
cache.ObjectContactPos,
cache.ObjectContactDir,
cache.ContactComponent,
cache.HitObjects,
object,
GetGame().
GetPlayer(),
false,
false,
geometry, 0.0,
CollisionFlags.ALLOBJECTS);
1338 if (
cache.HitObjects[
i].CanObstruct())
1348 item.DecreaseHealth(
dmg,
false);
1372 cycle += elapsedTime;
1389 entity =
player.SpawnEntityOnGroundOnCursorDir(
"Splint", 0.5);
1497 for (
int i = 0;
i <
pArray.Count();
i++)
1509 for (
int i = 0;
i <
pArray.Count();
i++)
1520 return GetGame().ConfigGetTextOut(
"CfgVehicles " + type +
" displayName");
1610 OverrideNewLocation(
gnd);
1615 super.RemoveOldItemFromLocation();
1616 m_Player.GetHumanInventory().OnEntityInHandsDestroyed(m_OldLocation);
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
override void OnSuccess(EntityAI new_item)
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 GetAttachedChildren(IEntity parent, array< IEntity > outputObjects)
Fills the provided array with all children entities in hierarchy of this 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
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 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 bool IsObjectObstructedFilterEx(Object object, IsObjectObstructedCache cache, PlayerBase player, int geometryTypeOverride=-1)
groups 'RaycastRVProxy' and 'RaycastRV' approaches into one method, allowes for comprehensive geometr...
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 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
static ref TFloatArray ARRAY_FLOAT
Super root of all classes in Enforce script.
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)
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.
void DestroyItemInCorpsesHandsAndCreateNewOnGndLambda(EntityAI old_item, string new_item_type, PlayerBase player, bool destroy=false)
override void RemoveOldItemFromLocation()
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)
script counterpart to engine's class Inventory
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/....
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
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 ...
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
base class for transformation operations (creating one item from another)
void UndoRemoveNetworkObjectInfo()
ref InventoryLocation m_NewLocation
void RemoveNetworkObjectInfo()
Step C. - remove network part of the object @NOTE this operation does not delete the object,...
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
void CreateNetworkObjectInfo(EntityAI new_item)
Step G. - create NetworkObjectInfo for new item.
adds automatic QuickBar handling
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)
override void OnSuccess(EntityAI new_item)
override void OnSuccess(EntityAI new_item)
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
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 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
Heat buffer static timer tick (set for 2s enviro tick, 180s to 1.0)
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 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.
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin)
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.