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++)
192 string res =
"ActionTarget dump = {";
197 res = res +
"; m_Utility: " +
m_Utility.ToString();
216 return m_VicinityObjects.GetVicinityObjects();
229 m_VicinityObjects.ClearVicinityObjects();
232 Object cursorTarget = null;
237 int hitComponentIndex;
239 vector headingDirection = MiscGameplayFunctions.GetHeadingVector(
m_Player);
251 if ( results.Count() > 0 )
257 for (i = 0; i < results.Count(); i++)
260 distance_helper.Insert(distance);
264 distance_helper_unsorted.Copy(distance_helper);
265 distance_helper.Sort();
269 for (i = 0; i < results.Count(); i++)
271 res = results.Get(distance_helper_unsorted.Find(distance_helper[i]));
273 cursorTarget = res.
obj;
275 if (cursorTarget && !cursorTarget.CanBeActionTarget())
283 m_VicinityObjects.StoreVicinityObject(res.
obj, res.
parent);
291 m_VicinityObjects.StoreVicinityObject(res.
obj, null);
310 surfaceParams.
rsd = RoadSurfaceDetection.ABOVE;
314 if (
g_Game.GetSurface(surfaceParams, surfaceResult))
316 if (surfaceResult && surfaceResult.
surface)
334 hitComponentIndex = -1;
341 if (camera && camera.GetCurrentPitch() <= -45)
345 vicinityObjects.RemoveItem(
m_Player);
349 m_VicinityObjects.TransformToVicinityObjects(vicinityObjects);
356 for (i = 0; i < m_VicinityObjects.Count(); i++)
358 Object object = m_VicinityObjects.GetObject(i);
359 Object parent = m_VicinityObjects.GetParent(i);
364 int targetComponent = -1;
365 targetComponent = hitComponentIndex;
381 vector contact_pos, contact_dir, hitNormal;
382 int contactComponent;
398 ShowDebugActionTargets(
true);
399 DrawDebugActionTargets(
true);
406 ShowDebugActionTargets(
false);
407 DrawDebugActionTargets(
false);
408 DrawDebugCone(
false);
410 DrawSelectionPos(
false);
424 return MiscGameplayFunctions.IsObjectObstructedEx(
object, cache);
439 m_Targets.InsertAt(pActionTarget, index);
448 while ( left <= right )
450 int middle = (left + right) / 2;
451 float middleValue =
m_Targets.Get(middle).GetUtility();
453 if ( middleValue == value )
455 else if ( middleValue < value )
473 if (pTarget == cursorTarget)
476 if (pTarget.GetType() ==
string.Empty)
479 if (pTarget.IsBuilding())
482 if (pTarget.IsTransport())
486 if (pTarget.CanUseConstruction())
489 if (pTarget.IsWell())
523 if ( c1 <= 0 || c2 == 0 )
527 vector nearestPoint = pL1 + (v * b);
533 #ifdef DIAG_DEVELOPER
539 MiscGameplayFunctions.FilterObstructingObjects(vicinityObjects, obstructingObjects);
541 if ( obstructingObjects.Count() > 0 )
545 int numObstructed = 0;
546 int mCount = m_VicinityObjects.Count();
552 m_VicinityObjects.ClearVicinityObjects();
553 m_VicinityObjects.TransformToVicinityObjects(filteredObjects);
564 int numObstructed = 0;
565 int mCount = m_VicinityObjects.Count();
570 for (
int i = mCount; i >= 0; --i )
572 Object object = m_VicinityObjects.GetObject(i);
573 Object parent = m_VicinityObjects.GetParent(i);
576 if (
object && !parent)
582 m_VicinityObjects.Remove(
object);
589 m_VicinityObjects.Remove(
object);
605 void ShowDebugActionTargets(
bool enabled)
621 float util =
m_Targets.Get(i).GetUtility();
622 int compIdx =
m_Targets.Get(i).GetComponentIndex();
625 compName = obj.GetActionComponentName(compIdx);
626 obj.GetActionComponentNameList(compIdx, compNames);
628 if ( compNames.Count() > 0 )
630 for (
int c = 0; c < compNames.Count(); c++ )
632 DbgUI.
Text(obj.GetDisplayName() +
" :: " + obj +
" | util: " + util +
" | compIdx: " + compIdx +
" | compName: " + compNames[c] +
"| wPos: " + obj.GetWorldPosition() );
637 DbgUI.Text(obj.GetDisplayName() +
" :: " + obj +
" | util: " + util +
" | compIdx: " + compIdx +
" | compName: " + compName +
"| wPos: " + obj.GetWorldPosition() );
645 DbgUI.EndCleanupScope();
648 void DrawDebugActionTargets(
bool enabled)
665 w_pos = obj.GetPosition();
668 w_pos_sphr[1] = w_pos_sphr[1] + 0.5;
671 w_pos_lend[1] = w_pos_lend[1] + 0.5;
690 private void DrawDebugCone(
bool enabled)
693 vector start, end, endL, endR;
702 playerAngle = MiscGameplayFunctions.GetHeadingAngle(
m_Player);
705 start[1] = start[1] + 0.2;
713 endL[0] = endL[0] + xL;
714 endL[2] = endL[2] + zL;
715 endR[0] = endR[0] + xR;
716 endR[2] = endR[2] + zR;
726 private void DrawSelectionPos(
bool enabled)
736 string compName = at.GetObject().GetActionComponentName(at.GetComponentIndex());
737 vector modelPos = at.GetObject().GetSelectionPositionMS(compName);
738 vector worldPos = at.GetObject().ModelToWorld(modelPos);
747 private void DrawDebugRay(
bool enabled)
761 for (
int it = 0; it < shapesArr.Count(); ++it )
763 Debug.RemoveShape( shapesArr[it] );
eBleedingSourceType GetType()
int GetSurfaceLiquidType()
void DbgPrintTargetDump()
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
void SetCursorHitPos(vector cursor_position)
proto native int GetComponentIndex()
void DayZPlayerUtils()
cannot be instantiated
void CleanupDebugShapes(array< Shape > shapesArr)
DEPRECATED.
void IsObjectObstructedCache(vector rayCastStart, int totalObjects)
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
override bool CanBeActionTarget()
SurfaceInfo m_SurfaceInfo
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
float ComputeUtility(Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos, SurfaceInfo surfaceInfo)
computes utility of target
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
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()
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)
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
SurfaceInfo surface
surface material info handle
vector pos
position of collision (in world coord)
Object parent
if hierLevel > 0 most parent of the proxy object
bool includeWater
Include water in the surface detection, will return the water if it is higher than the surface.
SurfaceDetectionType type
Type of surface to detect.
RoadSurfaceDetection rsd
See RoadSurfaceDetection, SurfaceTraceType.Roadway only.
vector position
3D position to trace the surface from
UseObjectsMode syncMode
See UseObjectsMode, SurfaceTraceType.Roadway only.
SurfaceInfo surface
Returned SurfaceInfo, plain pointer.
proto int GetLiquidType()
See 'LiquidTypes' in 'constants.c'.
static proto SurfaceInfo GetByFile(string name)
proto string GetSurfaceType()
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()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.