16 if (ib && (ib.IsBeingPlaced() || ib.IsHologram()))
36 for (
int i = 0; i < objects.Count(); i++)
65 return vicinityObjects;
77 return vicinityObjects;
104 for (
int i = 0; i < objects.Count(); i++)
156 string res =
"ActionTarget dump = {";
207 int hitComponentIndex;
209 vector headingDirection = MiscGameplayFunctions.GetHeadingVector(
m_Player);
221 if ( results.Count() > 0 )
227 for (i = 0; i < results.Count(); i++)
230 distance_helper.Insert(distance);
234 distance_helper_unsorted.Copy(distance_helper);
235 distance_helper.Sort();
240 for ( i = 0; i < results.Count(); i++)
242 res = results.Get(distance_helper_unsorted.Find(distance_helper[i]));
244 cursorTarget = res.
obj;
246 if (cursorTarget && !cursorTarget.CanBeActionTarget())
252 if ( !res.
parent.IsMan() )
279 hitComponentIndex = -1;
286 if (camera && camera.GetCurrentPitch() <= -45)
290 vicinityObjects.RemoveItem(
m_Player);
309 int targetComponent = -1;
310 targetComponent = hitComponentIndex;
322 vector contact_pos, contact_dir, hitNormal;
323 int contactComponent;
339 ShowDebugActionTargets(
true);
340 DrawDebugActionTargets(
true);
347 ShowDebugActionTargets(
false);
348 DrawDebugActionTargets(
false);
349 DrawDebugCone(
false);
351 DrawSelectionPos(
false);
365 return MiscGameplayFunctions.IsObjectObstructedEx(
object, cache);
380 m_Targets.InsertAt(pActionTarget, index);
389 while ( left <= right )
391 int middle = (left + right) / 2;
392 float middleValue =
m_Targets.Get(middle).GetUtility();
394 if ( middleValue == value )
396 else if ( middleValue < value )
414 if ( pTarget == cursorTarget )
417 if ( pTarget.GetType() ==
string.Empty )
420 if ( pTarget.IsBuilding() )
423 if ( pTarget.IsTransport() )
426 if ( pTarget.IsWell() )
453 if ( c1 <= 0 || c2 == 0 )
457 vector nearestPoint = pL1 + (v * b);
463 #ifdef DIAG_DEVELOPER
465 CleanupDebugShapes(obstruction);
469 MiscGameplayFunctions.FilterObstructingObjects(vicinityObjects, obstructingObjects);
471 if ( obstructingObjects.Count() > 0 )
475 int numObstructed = 0;
494 int numObstructed = 0;
500 for (
int i = mCount; i >= 0; --i )
506 if (
object && !parent)
535 void ShowDebugActionTargets(
bool enabled)
551 float util =
m_Targets.Get(i).GetUtility();
552 int compIdx =
m_Targets.Get(i).GetComponentIndex();
555 compName = obj.GetActionComponentName(compIdx);
556 obj.GetActionComponentNameList(compIdx, compNames);
558 if ( compNames.Count() > 0 )
560 for (
int c = 0; c < compNames.Count(); c++ )
562 DbgUI.
Text(obj.GetDisplayName() +
" :: " + obj +
" | util: " + util +
" | compIdx: " + compIdx +
" | compName: " + compNames[c] +
"| wPos: " + obj.GetWorldPosition() );
567 DbgUI.
Text(obj.GetDisplayName() +
" :: " + obj +
" | util: " + util +
" | compIdx: " + compIdx +
" | compName: " + compName +
"| wPos: " + obj.GetWorldPosition() );
578 void DrawDebugActionTargets(
bool enabled)
588 CleanupDebugShapes(shapes);
595 w_pos = obj.GetPosition();
598 w_pos_sphr[1] = w_pos_sphr[1] + 0.5;
601 w_pos_lend[1] = w_pos_lend[1] + 0.5;
617 CleanupDebugShapes(shapes);
620 private void DrawDebugCone(
bool enabled)
623 vector start, end, endL, endR;
629 CleanupDebugShapes(dbgConeShapes);
632 playerAngle = MiscGameplayFunctions.GetHeadingAngle(
m_Player);
635 start[1] = start[1] + 0.2;
643 endL[0] = endL[0] + xL;
644 endL[2] = endL[2] + zL;
645 endR[0] = endR[0] + xR;
646 endR[2] = endR[2] + zR;
653 CleanupDebugShapes(dbgConeShapes);
656 private void DrawSelectionPos(
bool enabled)
660 CleanupDebugShapes(dbgPosShapes);
666 string compName = at.GetObject().GetActionComponentName(at.GetComponentIndex());
667 vector modelPos = at.GetObject().GetSelectionPositionMS(compName);
668 vector worldPos = at.GetObject().ModelToWorld(modelPos);
674 CleanupDebugShapes(dbgPosShapes);
677 private void DrawDebugRay(
bool enabled)
681 CleanupDebugShapes(rayShapes);
686 CleanupDebugShapes(rayShapes);
691 for (
int it = 0; it < shapesArr.Count(); ++it )
eBleedingSourceType GetType()
void DbgPrintTargetDump()
class ActionTargets ActionTarget
private vector m_CursorHitPos
private ref map< Object, Object > m_VicinityObjects
void SetCursorHitPos(vector cursor_position)
proto native int GetComponentIndex()
private void DayZPlayerUtils()
cannot be instantiated
void IsObjectObstructedCache(vector rayCastStart, int totalObjects)
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
protected Widget m_Parent
override bool CanBeActionTarget()
void ActionTargets(PlayerBase player)
private const float c_ConeHeightMax
private const float c_UtilityMaxValue
utility constants
private const float HEIGHT_OFFSET
private const int OBSTRUCTED_COUNT_THRESHOLD
misc
private const int GROUPING_COUNT_THRESHOLD
private const float c_MaxActionDistance
private PlayerBase m_Player
player owner
private void StoreTarget(ActionTarget pActionTarget)
inserts action into sorted array based on utility
private const float c_RayDistance
searching properties
private void FilterObstructedObjectsEx(Object cursor_target, array< Object > vicinityObjects)
private const float c_UtilityMaxDistFromRaySqr
private const float c_ConeHeightMin
vector CalculateRayStart()
DEPRECATED.
private const float c_MaxTargetDistance
private const string CE_CENTER
p3d
private void FilterObstructedObjects(Object cursor_target)
int GetTargetsCount()
returns count of founded targets
ActionTarget GetTarget(int index)
returns action target at index
static private ref VicinityObjects m_VicinityObjects private bool m_Debug private vector m_RayStart
objects in vicinity
static array< Object > GetVicinityObjects()
private bool IsObstructed(Object object)
private bool IsObstructedEx(Object object, IsObjectObstructedCache cache)
private ref array< ref ActionTarget > m_Targets
selected & sorted targets by utility function
private const float c_DistanceDelta
private float DistSqrPoint2Line(vector pPoint, vector pL1, vector pL2)
distance between point and line
private int FindIndexForStoring(float value)
binary search algorithm
private float ComputeUtility(Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos)
computes utility of target
private const float c_ConeAngle
proto native vector GetCurrentCameraDirection()
proto native vector GetCurrentCameraPosition()
Super root of all classes in Enforce script.
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
static void RemoveShape(out Shape shape)
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
override bool IsTakeable()
ref array< Object > Objects
vector pos
position of collision (in world coord)
Object obj
object,that we collide with (NULL if none), If hierLevel > 0 object is the proxy object
int component
index of component in corresponding geometry level
Object parent
if hierLevel > 0 most parent of the proxy object
int hierLevel
which hierarchy level is the collision detected at, == 0 = objects in landscape, > 0 = proxy
objects in vicinity - extended with secondary object which is parent of that Object
void TransformToVicinityObjects(array< Object > objects)
transform simple array of Objects to VicinityObjects hashmap
void Remove(Object object)
private ref map< Object, Object > m_VicinityObjects
array< Object > GetVicinityObjects()
return simple array of Objects in Vicinity
Object GetObject(int i)
returns VicinityObjects Key
void StoreVicinityObject(Object object, Object parent=null)
stores VicinityObject to Hashmap - for storing of parent/child relationship
void Remove(array< Object > objects)
Object GetParent(int i)
returns VicinityObjects Element
array< Object > GetRawVicinityObjects()
return simple array of Objects in Vicinity
void ClearVicinityObjects()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool beautify=true)
Vector to string.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto void BeginCleanupScope()
static proto native void Text(string label)
static proto native void EndCleanupScope()
static proto native void End()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static const float PI_HALF
static const float DEG2RAD
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto float Sqrt(float val)
Returns square root.