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 = {";
161 res = res +
"; m_Utility: " +
m_Utility.ToString();
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;
245 Class.CastTo(cursorTargetEntity,cursorTarget);
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;
330 DayZPhysics.RayCastBullet(
m_RayStart,
m_RayEnd,collisionLayerMask,null,hitObject,contact_pos,hitNormal,hitFraction);
337 if (DiagMenu.GetBool(
DiagMenuIDs.MISC_ACTION_TARGETS_DEBUG))
339 ShowDebugActionTargets(
true);
340 DrawDebugActionTargets(
true);
343 DrawSelectionPos(DiagMenu.GetBool(
DiagMenuIDs.MISC_ACTION_TARGETS_SELPOS_DEBUG));
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() )
427 if (pTarget.CanUseConstruction())
430 if ( pTarget.IsWell() )
460 if ( c1 <= 0 || c2 == 0 )
464 vector nearestPoint = pL1 + (v * b);
470 #ifdef DIAG_DEVELOPER
476 MiscGameplayFunctions.FilterObstructingObjects(vicinityObjects, obstructingObjects);
478 if ( obstructingObjects.Count() > 0 )
482 int numObstructed = 0;
501 int numObstructed = 0;
507 for (
int i = mCount; i >= 0; --i )
513 if (
object && !parent)
542 void ShowDebugActionTargets(
bool enabled)
558 float util =
m_Targets.Get(i).GetUtility();
559 int compIdx =
m_Targets.Get(i).GetComponentIndex();
562 compName = obj.GetActionComponentName(compIdx);
563 obj.GetActionComponentNameList(compIdx, compNames);
565 if ( compNames.Count() > 0 )
567 for (
int c = 0; c < compNames.Count(); c++ )
569 DbgUI.
Text(obj.GetDisplayName() +
" :: " + obj +
" | util: " + util +
" | compIdx: " + compIdx +
" | compName: " + compNames[c] +
"| wPos: " + obj.GetWorldPosition() );
574 DbgUI.Text(obj.GetDisplayName() +
" :: " + obj +
" | util: " + util +
" | compIdx: " + compIdx +
" | compName: " + compName +
"| wPos: " + obj.GetWorldPosition() );
582 DbgUI.EndCleanupScope();
585 void DrawDebugActionTargets(
bool enabled)
602 w_pos = obj.GetPosition();
605 w_pos_sphr[1] = w_pos_sphr[1] + 0.5;
608 w_pos_lend[1] = w_pos_lend[1] + 0.5;
627 private void DrawDebugCone(
bool enabled)
630 vector start, end, endL, endR;
639 playerAngle = MiscGameplayFunctions.GetHeadingAngle(
m_Player);
642 start[1] = start[1] + 0.2;
650 endL[0] = endL[0] + xL;
651 endL[2] = endL[2] + zL;
652 endR[0] = endR[0] + xR;
653 endR[2] = endR[2] + zR;
663 private void DrawSelectionPos(
bool enabled)
673 string compName = at.GetObject().GetActionComponentName(at.GetComponentIndex());
674 vector modelPos = at.GetObject().GetSelectionPositionMS(compName);
675 vector worldPos = at.GetObject().ModelToWorld(modelPos);
684 private void DrawDebugRay(
bool enabled)
698 for (
int it = 0; it < shapesArr.Count(); ++it )
700 Shape shape = shapesArr[it];
701 Debug.RemoveShape( shape );
eBleedingSourceType GetType()
void DbgPrintTargetDump()
class ActionTargets ActionTarget
ref map< Object, Object > m_VicinityObjects
void SetCursorHitPos(vector cursor_position)
const int GROUPING_COUNT_THRESHOLD
const float c_ConeHeightMin
void ActionTargets(PlayerBase player)
const float c_MaxTargetDistance
int FindIndexForStoring(float value)
binary search algorithm
float DistSqrPoint2Line(vector pPoint, vector pL1, vector pL2)
distance between point and line
PlayerBase m_Player
player owner
vector CalculateRayStart()
DEPRECATED.
const string CE_CENTER
p3d
ref array< ref ActionTarget > m_Targets
selected & sorted targets by utility function
const float c_DistanceDelta
bool IsObstructedEx(Object object, IsObjectObstructedCache cache)
int GetTargetsCount()
returns count of founded targets
const int OBSTRUCTED_COUNT_THRESHOLD
misc
ActionTarget GetTarget(int index)
returns action target at index
const float HEIGHT_OFFSET
vector m_RayStart
objects in vicinity
static array< Object > GetVicinityObjects()
float ComputeUtility(Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos)
computes utility of target
void FilterObstructedObjects(Object cursor_target)
const float c_RayDistance
searching properties
const float c_MaxActionDistance
const float c_UtilityMaxDistFromRaySqr
const float c_ConeHeightMax
void FilterObstructedObjectsEx(Object cursor_target, array< Object > vicinityObjects)
void StoreTarget(ActionTarget pActionTarget)
inserts action into sorted array based on utility
bool IsObstructed(Object object)
const float c_UtilityMaxValue
utility constants
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
override bool IsTakeable()
ref array< Object > Objects
Input parameters for RaycastRVProxy function.
CollisionFlags flags
Sets the raycast behaviour in terms of result.
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)
array< Object > GetVicinityObjects()
return simple array of Objects in Vicinity
Object GetObject(int i)
returns VicinityObjects Key
ref map< Object, Object > m_VicinityObjects
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.
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.
proto native int GetComponentIndex()
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
vector m_RayStart
Start position of most recent HitZoneSelectionRaycast.
vector m_RayEnd
End position of most recent HitZoneSelectionRaycast.
void DayZPlayerUtils()
cannot be instantiated
void CleanupDebugShapes(array< Shape > shapesArr)
DEPRECATED.
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)
void IsObjectObstructedCache(vector rayCastStart, int totalObjects)
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
override bool CanBeActionTarget()