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
472 CleanupDebugShapes(obstruction);
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)
595 CleanupDebugShapes(shapes);
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;
624 CleanupDebugShapes(shapes);
627 private void DrawDebugCone(
bool enabled)
630 vector start, end, endL, endR;
636 CleanupDebugShapes(dbgConeShapes);
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;
660 CleanupDebugShapes(dbgConeShapes);
663 private void DrawSelectionPos(
bool enabled)
667 CleanupDebugShapes(dbgPosShapes);
673 string compName = at.GetObject().GetActionComponentName(at.GetComponentIndex());
674 vector modelPos = at.GetObject().GetSelectionPositionMS(compName);
675 vector worldPos = at.GetObject().ModelToWorld(modelPos);
681 CleanupDebugShapes(dbgPosShapes);
684 private void DrawDebugRay(
bool enabled)
688 CleanupDebugShapes(rayShapes);
693 CleanupDebugShapes(rayShapes);
696 private void CleanupDebugShapes(array<Shape> shapesArr)
698 for (
int it = 0; it < shapesArr.Count(); ++it )
700 Debug.RemoveShape( shapesArr[it] );
eBleedingSourceType GetType()
void DbgPrintTargetDump()
class ActionTargets ActionTarget
ref map< Object, Object > m_VicinityObjects
void SetCursorHitPos(vector cursor_position)
proto native int GetComponentIndex()
vector m_RayStart
Start position of most recent HitZoneSelectionRaycast.
vector m_RayEnd
End position of most recent HitZoneSelectionRaycast.
void DayZPlayerUtils()
cannot be instantiated
void IsObjectObstructedCache(vector rayCastStart, int totalObjects)
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
override bool CanBeActionTarget()
const float c_UtilityMaxDistFromRaySqr
const float c_MaxTargetDistance
const float c_DistanceDelta
int GetTargetsCount()
returns count of founded targets
const string CE_CENTER
p3d
const float HEIGHT_OFFSET
static array< Object > GetVicinityObjects()
const int OBSTRUCTED_COUNT_THRESHOLD
misc
void FilterObstructedObjects(Object cursor_target)
const float c_MaxActionDistance
bool IsObstructedEx(Object object, IsObjectObstructedCache cache)
bool IsObstructed(Object object)
float DistSqrPoint2Line(vector pPoint, vector pL1, vector pL2)
distance between point and line
void StoreTarget(ActionTarget pActionTarget)
inserts action into sorted array based on utility
const float c_RayDistance
searching properties
PlayerBase m_Player
player owner
ActionTarget GetTarget(int index)
returns action target at index
void FilterObstructedObjectsEx(Object cursor_target, array< Object > vicinityObjects)
void ActionTargets(PlayerBase player)
const int GROUPING_COUNT_THRESHOLD
vector CalculateRayStart()
DEPRECATED.
vector m_RayStart
objects in vicinity
ref array< ref ActionTarget > m_Targets
selected & sorted targets by utility function
float ComputeUtility(Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos)
computes utility of target
const float c_UtilityMaxValue
utility constants
int FindIndexForStoring(float value)
binary search algorithm
const float c_ConeHeightMax
const float c_ConeHeightMin
proto native vector GetCurrentCameraPosition()
proto native vector GetCurrentCameraDirection()
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
override bool IsTakeable()
ref array< Object > Objects
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
int hierLevel
which hierarchy level is the collision detected at, == 0 = objects in landscape, > 0 = proxy
vector pos
position of collision (in world coord)
Object parent
if hierLevel > 0 most parent of the proxy object
void Remove(Object object)
void Remove(array< Object > objects)
void ClearVicinityObjects()
Object GetObject(int i)
returns VicinityObjects Key
void TransformToVicinityObjects(array< Object > objects)
transform simple array of Objects to VicinityObjects hashmap
ref map< Object, Object > m_VicinityObjects
Object GetParent(int i)
returns VicinityObjects Element
void StoreVicinityObject(Object object, Object parent=null)
stores VicinityObject to Hashmap - for storing of parent/child relationship
array< Object > GetRawVicinityObjects()
return simple array of Objects in Vicinity
array< Object > GetVicinityObjects()
return simple array of Objects in Vicinity
objects in vicinity - extended with secondary object which is parent of that Object
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.
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 native void Text(string label)
static proto void BeginCleanupScope()