104 float retVal = dist * 2;
111 if (ent == pToIgnore)
120 if( !obj.IsAnyInherited(targetableObjects) )
127 vector entpos = ent.GetPosition();
129 vector diff = entpos - pos;
131 if (cDistSq > dist*dist)
137 float frontDist = diff[0]*dir[0] + diff[2]*dir[2];
144 vector project = pos + dir * frontDist;
145 vector posdiff =
Vector(project[0] - entpos[0], 0, project[2] - entpos[2]);
146 float sideDist = posdiff.
LengthSq();
148 if (sideDist > tgAngle)
154 float sum = frontDist + sideDist;
169 allTargets.Insert(ent);
211 int sz = mags.Count();
212 for (
int i = 0; i < sz; ++i)
214 Magazine mag_i = mags.Get(i);
215 if (mag_i != exclude_mag && mag_i.CanAddCartridges(1))
227 if (eai_inv && eai_inv.IsInherited(Magazine))
232 mag_inv.ServerSetAmmoCount(0);
239 vector pos = player.GetPosition();
240 EntityAI eai_gnd = player.SpawnEntityOnGroundPos(magTypeName, pos);
241 if (eai_gnd && eai_gnd.IsInherited(Magazine))
246 mag_gnd.ServerSetAmmoCount(0);
264 if (mag.GetInventory().GetCurrentInventoryLocation(il_mag_curr))
270 Error(
"DayZPlayerUtils::HandleDropMagazine - cannot get current inv location of mag=" + mag);
277 vector pos = player.GetPosition();
278 EntityAI eai_gnd = player.SpawnEntityOnGroundPos(magTypeName, pos);
279 if (eai_gnd && eai_gnd.IsInherited(Magazine))
284 mag_gnd.ServerSetAmmoCount(0);
285 if (mag_gnd.ServerStoreCartridge(damage, cartTypeName))
303 float test_heatlh = 1 - damage;
304 int sz = mags.Count();
305 for (
int i = 0; i < sz; ++i)
307 Magazine mag_i = mags.Get(i);
310 if( health_lvl == -1)
312 if (mag_i.CanAddCartridges(1) )
314 int num_health_lvl = mag_i.GetNumberOfHealthLevels();
315 for(
int j = 1; j < num_health_lvl; j++)
317 if (mag_i.GetHealthLevelValue(j) < test_heatlh )
326 if( mag_i.GetHealthLevel() == health_lvl )
328 if (mag_i.ServerStoreCartridge(damage, cartTypeName))
339 if (eai_inv && eai_inv.IsInherited(Magazine))
344 mag_inv.ServerSetAmmoCount(0);
345 mag_inv.SetHealth(
"",
"", (1 - damage) * mag_inv.GetMaxHealth());
346 if (mag_inv.ServerStoreCartridge(damage, cartTypeName))
383 Error(
"DayZPlayerUtils.InitComponentCollisions: already initialized!");
432 vector pp = pPlayer.GetPosition();
const int ECE_IN_INVENTORY
static void InitPlayerComponentCollisions(Human player)
class ComponentCollisionBox EnableDebugDraw
static proto native void ClearComponentCollisions()
static proto float LinearRangeClamp(float pValueX, float pValueY, float pLimits[])
static proto native bool PlayerCanChangeStance(DayZPlayer pPlayer, int pTargetStance, bool forceCheck=false)
static proto native void PhysicsGetEntitiesInBox(vector min, vector max, notnull out array< EntityAI > entList)
returns entities overlapping/touching in AABB box -
static bool HandleDropCartridge(DayZPlayer player, float damage, string cartTypeName, string magTypeName)
private void DayZPlayerUtils()
cannot be instantiated
static proto native void DrawDebugText(string text, vector pos, float size)
static EWaterLevels CheckWaterLevel(DayZPlayer pPlayer, out vector waterLevel)
static private void InitCachedEntList()
ONLY_ROADWAYS
Only roadways are included in the query.
static Magazine SelectStoreCartridge(DayZPlayer player, Weapon_Base weapon, int muzzleIndex, Magazine exclude_mag, float damage, string magTypeName)
static proto native bool DebugOverrideAnimationRotation(string pAnimName, vector pRotation)
overrides total animation rotation
static proto native void GetEntitiesInCone(vector pos, vector dir, float angle, float dist, float minHeigh, float maxHeight, out array< Object > entList)
ORIGIN_DISTANCE
Check only distance to object origins, not BB.
static proto native bool DebugOverrideAnimationTranslation(string pAnimName, vector pTranslation)
overrides total animation translation
static bool HandleStoreCartridge(DayZPlayer player, Weapon_Base weapon, int muzzleIndex, float damage, string cartTypeName, string magTypeName, bool CanDrop=true)
static proto native bool DebugOverrideAnimationSpeed(string pAnimName, float pSpeed)
overrides total animation speed
static proto native void DrawDebugBox(vector pos, float size, int color)
draws debug box (color=red)
DYNAMIC
Dynamic objects are included in the query.
static proto native vector GetMemoryPointPositionBoneRelative(DayZPlayer pPlayer, int pBoneIndex, int pPointIndex)
static int ConvertStanceMaskToStanceIdx(int stanceMask)
static proto native bool InitComponentCollisions(Human player, array< ref ComponentCollisionBox > boxes, array< ref ComponentCollisionCapsule > capsules)
static private ref array< Object > m_CachedEntList
static proto native bool IsComponentCollisionInitialized()
static bool HandleDropMagazine(DayZPlayer player, Magazine mag)
static proto native void DrawStartFrame()
clear info - new draw starts
STATIC
Static objects are included in the query.
static proto native bool FindMagazinesForAmmo(DayZPlayer player, string ammoTypeName, out array< Magazine > mags)
static proto native void SceneGetEntitiesInBox(vector min, vector max, notnull out array< EntityAI > entList, int flags=QueryFlags.DYNAMIC)
returns entities overlapping/touching in AABB box -
FindInventoryLocationType
flags for searching locations in inventory
MeleeTargetData GetMeleeTarget(MeleeTargetSettings settings, out array< Object > allTargets=null)
Super root of all classes in Enforce script.
void ComponentCollisionBox(float x, float y, float z, string b0, string b1)
void ComponentCollisionCapsule(float r, string b0, string b1)
script counterpart to engine's class Inventory
static proto native bool PrepareDropEntityPos(EntityAI owner, notnull EntityAI item, out vector mat[4], bool useValuesInMatrix=false, int conflictCheckDepth=-1)
Finds a transformation for the item to be dropped to If the initial transforation overlaps with anoth...
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
synchronously removes item from current inventory location and adds it to destination no anims involv...
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
float m_fWaterLevelIn
when entering water - what level cases swimming (1.5m)
float m_fToCrouchLevel
when to crouch
float m_fToErectLevel
when to stand
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native float LengthSq()
Returns squared length (magnitudeSqr)
DayZPlayerConstants
defined in C++
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
static proto float Tan(float angle)
Returns tangent of angle in radians.
static const float DEG2RAD
class HumanCommandLadder HumanCommandSwim()