Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actiontargets.c
Go to the documentation of this file.
1
3{
4 private ref map<Object, Object> m_VicinityObjects;
5
6 void VicinityObjects()
7 {
8 m_VicinityObjects = new map<Object, Object>;
9 }
10
12 void StoreVicinityObject(Object object, Object parent = null)
13 {
15 ItemBase ib = ItemBase.Cast(object);
16 if (ib && (ib.IsBeingPlaced() || ib.IsHologram()))
17 return;
18
20 /*if(object && object.IsPlainObject())
21 {
22 Print("ERROR: VicinityObjects | StoreVicinityObject | IsPlainObject check fail");
23 return;
24 }*/
25
26 if ( !m_VicinityObjects.Contains(object) )
27 {
29 m_VicinityObjects.Set(object, parent);
30 }
31 }
32
34 void TransformToVicinityObjects(array<Object> objects)
35 {
36 for (int i = 0; i < objects.Count(); i++)
37 {
38 if (objects[i].GetType() != "" && objects[i].CanBeActionTarget())
39 {
40 StoreVicinityObject(objects[i]);
41 //Print("storing, 2nd pass: " + objects[i]);
42 }
43 }
44 }
45
46 void ClearVicinityObjects()
47 {
48 m_VicinityObjects.Clear();
49 }
50
52 array< Object > GetVicinityObjects()
53 {
54 ref array<Object> vicinityObjects = new array<Object>;
55 for (int i = 0; i < m_VicinityObjects.Count(); i++)
56 {
58 ItemBase ib = ItemBase.Cast(GetObject(i));
59 if (ib && !ib.IsTakeable())
60 continue;
61
62 vicinityObjects.Insert(GetObject(i));
63 }
64
65 return vicinityObjects;
66 }
67
69 array< Object > GetRawVicinityObjects()
70 {
71 ref array<Object> vicinityObjects = new array<Object>;
72 for (int i = 0; i < m_VicinityObjects.Count(); i++)
73 {
74 vicinityObjects.Insert(GetObject(i));
75 }
76
77 return vicinityObjects;
78 }
79
81 Object GetObject(int i)
82 {
83 return m_VicinityObjects.GetKey(i);
84 }
85
87 Object GetParent(int i)
88 {
89 return m_VicinityObjects.GetElement(i);
90 }
91
92 int Count()
93 {
94 return m_VicinityObjects.Count();
95 }
96
97 void Remove(Object object)
98 {
99 m_VicinityObjects.Remove(object);
100 }
101
102 void Remove(array<Object> objects)
103 {
104 for (int i = 0; i < objects.Count(); i++)
105 {
106 m_VicinityObjects.Remove(objects[i]);
107 }
108 }
109}
110
111class ActionTarget
112{
113 private Object m_Object; // object itself
114 private Object m_Parent; // null or parent of m_Object
115 private int m_ComponentIndex; // p3d Component ID or -1
116 private vector m_CursorHitPos;
117 private float m_Utility;
118 private string m_SurfaceName;
119 private int m_SurfaceLiquidType = LIQUID_NONE;
120
121 void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName = "")
122 {
123 m_Object = object;
124 m_Parent = parent;
125 m_ComponentIndex = componentIndex;
126 m_CursorHitPos = cursorHitPos;
127 m_Utility = utility;
128
129 m_SurfaceName = surfaceName;
130 if (m_SurfaceName != "")
131 {
132 SurfaceInfo surfaceInfo = SurfaceInfo.GetByFile(surfaceName);
133 if (surfaceInfo && surfaceInfo.GetLiquidType() != LIQUID_NONE)
134 m_SurfaceLiquidType = surfaceInfo.GetLiquidType();
135 }
136 }
137
139 {
140 return m_Object;
141 }
142
143 Object GetParent()
144 {
145 return m_Parent;
146 }
147
148 bool IsProxy()
149 {
150 if (m_Parent)
151 return true;
152 return false;
153 }
154
156 {
157 return m_ComponentIndex;
158 }
159
160 float GetUtility()
161 {
162 return m_Utility;
163 }
164
165 vector GetCursorHitPos()
166 {
167 return m_CursorHitPos;
168 }
169
170 void SetCursorHitPos(vector cursor_position)
171 {
172 m_CursorHitPos = cursor_position;
173 }
174
175 string GetSurfaceName()
176 {
177 return m_SurfaceName;
178 }
179
180 int GetSurfaceLiquidType()
181 {
182 return m_SurfaceLiquidType;
183 }
184
185 void DbgPrintTargetDump()
186 {
188 }
189
190 string DumpToString()
191 {
192 string res = "ActionTarget dump = {";
193 res = res + "m_Object: " + Object.GetDebugName(m_Object);
194 res = res + "; m_Parent: " + Object.GetDebugName(m_Parent);
195 res = res + "; m_ComponentIndex: " + m_ComponentIndex.ToString();
196 res = res + "; m_CursorHitPos: " + m_CursorHitPos.ToString();
197 res = res + "; m_Utility: " + m_Utility.ToString();
198 res = res + "}";
199 return res;
200 }
201};
202
203class ActionTargets
204{
205 void ActionTargets(PlayerBase player)
206 {
207 m_Player = player;
208 m_VicinityObjects = new VicinityObjects;
209 m_Targets = new array<ref ActionTarget>;
210
211 m_Debug = false;
212 }
213
214 static array<Object> GetVicinityObjects()
215 {
216 return m_VicinityObjects.GetVicinityObjects();
217 }
218
219 void Clear()
220 {
221 m_Targets.Clear();
222 }
223
224 void Update()
225 {
226 int i;
227
229 m_VicinityObjects.ClearVicinityObjects();
230 Clear();
231
232 Object cursorTarget = null;
233 EntityAI cursorTargetEntity = null;
234 array<Object> vicinityObjects = new array<Object>;
235
237 int hitComponentIndex;
238 vector playerPos = m_Player.GetPosition();
239 vector headingDirection = MiscGameplayFunctions.GetHeadingVector(m_Player);
240
241 m_RayStart = GetGame().GetCurrentCameraPosition();
242 m_RayEnd = m_RayStart + GetGame().GetCurrentCameraDirection() * c_RayDistance;
243
244 RaycastRVParams rayInput = new RaycastRVParams(m_RayStart, m_RayEnd, m_Player);
245 rayInput.flags = CollisionFlags.ALLOBJECTS;
246 //rayInput.sorted = true;
248
249 if ( DayZPhysics.RaycastRVProxy(rayInput, results) )
250 {
251 if ( results.Count() > 0 )
252 {
253 array<float> distance_helper = new array<float>;
254 array<float> distance_helper_unsorted = new array<float>;
255 float distance;
256
257 for (i = 0; i < results.Count(); i++)
258 {
259 distance = vector.DistanceSq(results[i].pos, m_RayStart);
260 distance_helper.Insert(distance);
261 //Print("#" + i + " " + results.Get(i).obj);
262 }
263 //Print("--------------");
264 distance_helper_unsorted.Copy(distance_helper);
265 distance_helper.Sort();
266
267 RaycastRVResult res;
268
269 for (i = 0; i < results.Count(); i++)
270 {
271 res = results.Get(distance_helper_unsorted.Find(distance_helper[i])); //closest object
272
273 cursorTarget = res.obj;
274 Class.CastTo(cursorTargetEntity,cursorTarget);
275 if (cursorTarget && !cursorTarget.CanBeActionTarget())
276 continue;
278 if (res.hierLevel > 0)
279 {
281 if (!res.parent.IsMan())
282 {
283 m_VicinityObjects.StoreVicinityObject(res.obj, res.parent);
284 //Print("storing, 1st pass (hier > 0): " + res.obj);
285 }
286 else
287 continue;
288 }
289 else
290 {
291 m_VicinityObjects.StoreVicinityObject(res.obj, null);
292 //Print("storing, 1st pass: " + res.obj);
293 }
294
295 m_HitPos = res.pos;
296 hitComponentIndex = res.component;
297
298 if (res.surface && res.surface.GetSurfaceType() != "")
299 {
300 m_SurfaceInfo = res.surface;
301 }
302 else
303 {
306 surfaceParams.type = SurfaceDetectionType.Roadway;
307 surfaceParams.position = m_HitPos;
308 surfaceParams.includeWater = true;
309 surfaceParams.syncMode = UseObjectsMode.NoWait;
310 surfaceParams.rsd = RoadSurfaceDetection.ABOVE;
311
314 if (g_Game.GetSurface(surfaceParams, surfaceResult))
315 {
316 if (surfaceResult && surfaceResult.surface)
317 {
318 m_SurfaceInfo = surfaceResult.surface;
319 }
320 }
321 }
322 break;
323 }
324 }
325 //else
326 //Print("NO RESULTS FOUND!");
327 }
328 else
329 {
330 //Print("CAST UNSUCCESFUL");
331 cursorTarget = null;
332 m_HitPos = vector.Zero;
333 m_SurfaceInfo = null;
334 hitComponentIndex = -1;
335 }
336
337 //Print(cursorTarget);
338
340 DayZPlayerCamera camera = m_Player.GetCurrentCamera();
341 if (camera && camera.GetCurrentPitch() <= -45) // Spatial search is a contributor to very heavy searching, limit it to when we are at least looking down
342 DayZPlayerUtils.GetEntitiesInCone(playerPos, headingDirection, c_ConeAngle, c_MaxTargetDistance, c_ConeHeightMin, c_ConeHeightMax, vicinityObjects);
343
345 vicinityObjects.RemoveItem(m_Player);
346
348 //Print("m_VicinityObjects before" + m_VicinityObjects.Count());
349 m_VicinityObjects.TransformToVicinityObjects(vicinityObjects);
350 //Print("m_VicinityObjects after" + m_VicinityObjects.Count());
351
353 FilterObstructedObjectsEx(cursorTarget, vicinityObjects);
354
356 for (i = 0; i < m_VicinityObjects.Count(); i++)
357 {
358 Object object = m_VicinityObjects.GetObject(i);
359 Object parent = m_VicinityObjects.GetParent(i);
360
361 float utility = ComputeUtility(object, m_RayStart, m_RayEnd, cursorTarget, m_HitPos, m_SurfaceInfo);
362 if (utility > 0)
363 {
364 int targetComponent = -1;
365 targetComponent = hitComponentIndex;
366
367 string surfaceName;
368 if (m_SurfaceInfo && m_SurfaceInfo.GetEntryName() != "")
369 surfaceName = m_SurfaceInfo.GetEntryName();
370
371 ActionTarget at = new ActionTarget(object, parent, targetComponent, m_HitPos, utility, surfaceName);
372 StoreTarget(at);
373 }
374 /*else
375 Print("utility < 0; object: " + object + " | parent: " + parent);*/
376 }
377
379 if (m_HitPos == vector.Zero)
380 {
381 vector contact_pos, contact_dir, hitNormal;
382 int contactComponent;
383 float hitFraction;
384 Object hitObject;
385
386 m_RayEnd = m_RayStart + GetGame().GetCurrentCameraDirection() * c_RayDistance * 3;
387
388 PhxInteractionLayers collisionLayerMask = PhxInteractionLayers.ROADWAY|PhxInteractionLayers.TERRAIN|PhxInteractionLayers.WATERLAYER;
389 DayZPhysics.RayCastBullet(m_RayStart,m_RayEnd,collisionLayerMask,null,hitObject,contact_pos,hitNormal,hitFraction);
390 m_HitPos = contact_pos;
391 }
392
393 m_Targets.Insert(new ActionTarget(null, null, -1, m_HitPos, 0));
394
395#ifdef DIAG_DEVELOPER
396 if (DiagMenu.GetBool(DiagMenuIDs.MISC_ACTION_TARGETS_DEBUG))
397 {
398 ShowDebugActionTargets(true);
399 DrawDebugActionTargets(true);
400 DrawDebugCone(true);
401 DrawDebugRay(true);
402 DrawSelectionPos(DiagMenu.GetBool(DiagMenuIDs.MISC_ACTION_TARGETS_SELPOS_DEBUG));
403 }
404 else
405 {
406 ShowDebugActionTargets(false);
407 DrawDebugActionTargets(false);
408 DrawDebugCone(false);
409 DrawDebugRay(false);
410 DrawSelectionPos(false);
411 }
412#endif
413 //Print("--------------");
414 }
415
416 private bool IsObstructed(Object object)
417 {
418 IsObjectObstructedCache cache = new IsObjectObstructedCache(m_RayStart, 1);
419 return IsObstructedEx(object, cache);
420 }
421
422 private bool IsObstructedEx(Object object, IsObjectObstructedCache cache)
423 {
424 return MiscGameplayFunctions.IsObjectObstructedEx(object, cache);
425 }
426
428 int GetTargetsCount()
429 { return m_Targets.Count(); }
430
432 ActionTarget GetTarget(int index)
433 { return m_Targets.Get(index); }
434
436 private void StoreTarget(ActionTarget pActionTarget)
437 {
438 int index = FindIndexForStoring(pActionTarget.GetUtility());
439 m_Targets.InsertAt(pActionTarget, index);
440 //Print("StoreTarget; object: " + pActionTarget.GetObject() + " | parent: " + pActionTarget.GetParent() + " | idx: " + index);
441 }
442
444 private int FindIndexForStoring(float value)
445 {
446 int left = 0;
447 int right = m_Targets.Count() - 1;
448 while ( left <= right )
449 {
450 int middle = (left + right) / 2;
451 float middleValue = m_Targets.Get(middle).GetUtility();
452
453 if ( middleValue == value )
454 return middle;
455 else if ( middleValue < value )
456 right = middle - 1;
457 else
458 left = middle + 1;
459 }
460
461 return left;
462 }
463
465 private float ComputeUtility(Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos, SurfaceInfo surfaceInfo)
466 {
468 if (vector.DistanceSq(hitPos, m_Player.GetPosition()) > c_MaxTargetDistance * c_MaxTargetDistance)
469 return -1;
470
471 if (pTarget)
472 {
473 if (pTarget == cursorTarget)
474 {
476 if (pTarget.GetType() == string.Empty)
477 return 0.01;
478
479 if (pTarget.IsBuilding())
480 return 0.25;
481
482 if (pTarget.IsTransport())
483 return 0.25;
484
486 if (pTarget.CanUseConstruction())
487 return 0.85;
488
489 if (pTarget.IsWell())
490 return 0.9;
491
492 vector playerPosXZ = m_Player.GetPosition();
493 vector hitPosXZ = hitPos;
494 playerPosXZ[1] = 0;
495 hitPosXZ[1] = 0;
496 if (vector.DistanceSq(playerPosXZ, hitPosXZ) <= c_MaxTargetDistance * c_MaxTargetDistance)
497 return c_UtilityMaxValue;
498 }
499
500 if ( PlayerBase.Cast(pTarget) && PlayerBase.Cast(pTarget).IsInVehicle() ) // utility in vehicle should be below base vehicle val
501 return 0.20;
502
503 float distSqr = DistSqrPoint2Line(pTarget.GetPosition(), pRayStart, pRayEnd);
504 return (c_UtilityMaxDistFromRaySqr - distSqr) / c_UtilityMaxDistFromRaySqr;
505 }
506
508 if (surfaceInfo && surfaceInfo.GetLiquidType() != LIQUID_NONE)
509 return 0.01;
510
511 return -1;
512 }
513
515 private float DistSqrPoint2Line(vector pPoint, vector pL1, vector pL2)
516 {
517 vector v = pL2 - pL1;
518 vector w = pPoint - pL1;
519
520 float c1 = vector.Dot(w,v);
521 float c2 = vector.Dot(v,v);
522
523 if ( c1 <= 0 || c2 == 0 )
524 return vector.DistanceSq(pPoint, pL1);
525
526 float b = c1 / c2;
527 vector nearestPoint = pL1 + (v * b);
528 return vector.DistanceSq(pPoint, nearestPoint);
529 }
530
531 private void FilterObstructedObjectsEx(Object cursor_target, array<Object> vicinityObjects)
532 {
533 #ifdef DIAG_DEVELOPER
534 if (DiagMenu.GetBool(DiagMenuIDs.MISC_ACTION_TARGETS_DEBUG))
535 CleanupDebugShapes(obstruction);
536 #endif
537
538 array<Object> obstructingObjects = new array<Object>;
539 MiscGameplayFunctions.FilterObstructingObjects(vicinityObjects, obstructingObjects);
540
541 if ( obstructingObjects.Count() > 0 )
542 {
543 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
544
545 int numObstructed = 0;
546 int mCount = m_VicinityObjects.Count();
547
548 if (mCount > GROUPING_COUNT_THRESHOLD)
549 {
550 array<Object> filteredObjects = new array<Object>;
551 MiscGameplayFunctions.FilterObstructedObjectsByGrouping(m_RayStart, c_MaxTargetDistance, c_DistanceDelta, m_VicinityObjects.GetRawVicinityObjects(), vicinityObjects, filteredObjects);
552 m_VicinityObjects.ClearVicinityObjects();
553 m_VicinityObjects.TransformToVicinityObjects(filteredObjects);
554 }
555 else
556 {
557 FilterObstructedObjects(cursor_target);
558 }
559 }
560 }
561
562 private void FilterObstructedObjects(Object cursor_target)
563 {
564 int numObstructed = 0;
565 int mCount = m_VicinityObjects.Count();
566 IsObjectObstructedCache cache = new IsObjectObstructedCache(m_RayStart, mCount);
567 mCount--;
568
570 for ( int i = mCount; i >= 0; --i )
571 {
572 Object object = m_VicinityObjects.GetObject(i);
573 Object parent = m_VicinityObjects.GetParent(i);
574
576 if (object && !parent)
577 {
580 if (numObstructed > OBSTRUCTED_COUNT_THRESHOLD && object != cursor_target)
581 {
582 m_VicinityObjects.Remove(object);
583 continue;
584 }
585
587 if (object != cursor_target && IsObstructedEx(object, cache))
588 {
589 m_VicinityObjects.Remove(object);
590 numObstructed++;
591 }
592
593 cache.ClearCache();
594 }
595 }
596 }
597
598#ifdef DIAG_DEVELOPER
599 ref array<Shape> shapes = new array<Shape>();
600 ref array<Shape> dbgConeShapes = new array<Shape>();
601 ref array<Shape> rayShapes = new array<Shape>();
602 ref array<Shape> obstruction = new array<Shape>();
603 ref array<Shape> dbgPosShapes = new array<Shape>();
604
605 void ShowDebugActionTargets(bool enabled)
606 {
607 int windowPosX = 0;
608 int windowPosY = 50;
609
610 Object obj;
611
612 DbgUI.BeginCleanupScope();
613 DbgUI.Begin("Action Targets", windowPosX, windowPosY);
614 if ( enabled )
615 {
616 for ( int i = 0; i < GetTargetsCount(); i++ )
617 {
618 obj = m_Targets.Get(i).GetObject();
619 if ( obj )
620 {
621 float util = m_Targets.Get(i).GetUtility();
622 int compIdx = m_Targets.Get(i).GetComponentIndex();
623 string compName;
624 array<string> compNames = new array<string>;
625 compName = obj.GetActionComponentName(compIdx);
626 obj.GetActionComponentNameList(compIdx, compNames);
627
628 if ( compNames.Count() > 0 )
629 {
630 for ( int c = 0; c < compNames.Count(); c++ )
631 {
632 DbgUI.Text(obj.GetDisplayName() + " :: " + obj + " | util: " + util + " | compIdx: " + compIdx + " | compName: " + compNames[c] + "| wPos: " + obj.GetWorldPosition() );
633 }
634 }
635 else
636 {
637 DbgUI.Text(obj.GetDisplayName() + " :: " + obj + " | util: " + util + " | compIdx: " + compIdx + " | compName: " + compName + "| wPos: " + obj.GetWorldPosition() );
638 }
639 }
640 else
641 continue;
642 }
643 }
644 DbgUI.End();
645 DbgUI.EndCleanupScope();
646 }
647
648 void DrawDebugActionTargets(bool enabled)
649 {
650 int s_id;
651 vector w_pos;
652 vector w_pos_sphr;
653 vector w_pos_lend;
654 Object obj;
655
656 if ( enabled )
657 {
658 CleanupDebugShapes(shapes);
659
660 for ( int i = 0; i < GetTargetsCount(); i++ )
661 {
662 obj = m_Targets.Get(i).GetObject();
663 if ( obj )
664 {
665 w_pos = obj.GetPosition();
666 // sphere pos tweaks
667 w_pos_sphr = w_pos;
668 w_pos_sphr[1] = w_pos_sphr[1] + 0.5;
669 // line pos tweaks
670 w_pos_lend = w_pos;
671 w_pos_lend[1] = w_pos_lend[1] + 0.5;
672
673 if ( i == 0 )
674 {
675 shapes.Insert( Debug.DrawSphere(w_pos_sphr, 0.03, COLOR_RED) );
676 shapes.Insert( Debug.DrawLine(w_pos, w_pos_lend, COLOR_RED) );
677 }
678 else
679 {
680 shapes.Insert( Debug.DrawSphere(w_pos_sphr, 0.03, COLOR_YELLOW) );
681 shapes.Insert( Debug.DrawLine(w_pos, w_pos_lend, COLOR_YELLOW) );
682 }
683 }
684 }
685 }
686 else
687 CleanupDebugShapes(shapes);
688 }
689
690 private void DrawDebugCone(bool enabled)
691 {
692 // "cone" settings
693 vector start, end, endL, endR;
694 float playerAngle;
695 float xL,xR,zL,zR;
696
697 if (enabled)
698 {
699 CleanupDebugShapes(dbgConeShapes);
700
701 start = m_Player.GetPosition();
702 playerAngle = MiscGameplayFunctions.GetHeadingAngle(m_Player);
703
704 // offset position of the shape in height
705 start[1] = start[1] + 0.2;
706
707 endL = start;
708 endR = start;
709 xL = c_MaxTargetDistance * Math.Cos(playerAngle + Math.PI_HALF + c_ConeAngle * Math.DEG2RAD); // x
710 zL = c_MaxTargetDistance * Math.Sin(playerAngle + Math.PI_HALF + c_ConeAngle * Math.DEG2RAD); // z
711 xR = c_MaxTargetDistance * Math.Cos(playerAngle + Math.PI_HALF - c_ConeAngle * Math.DEG2RAD); // x
712 zR = c_MaxTargetDistance * Math.Sin(playerAngle + Math.PI_HALF - c_ConeAngle * Math.DEG2RAD); // z
713 endL[0] = endL[0] + xL;
714 endL[2] = endL[2] + zL;
715 endR[0] = endR[0] + xR;
716 endR[2] = endR[2] + zR;
717
718 dbgConeShapes.Insert( Debug.DrawLine(start, endL, COLOR_BLUE) );
719 dbgConeShapes.Insert( Debug.DrawLine(start, endR, COLOR_BLUE) ) ;
720 dbgConeShapes.Insert( Debug.DrawLine(endL, endR, COLOR_BLUE) );
721 }
722 else
723 CleanupDebugShapes(dbgConeShapes);
724 }
725
726 private void DrawSelectionPos(bool enabled)
727 {
728 if (enabled)
729 {
730 CleanupDebugShapes(dbgPosShapes);
731 if (GetTargetsCount() > 0 && GetTarget(0).GetUtility() > -1 )
732 {
733 ActionTarget at = GetTarget(0);
734 if (at.GetObject())
735 {
736 string compName = at.GetObject().GetActionComponentName(at.GetComponentIndex());
737 vector modelPos = at.GetObject().GetSelectionPositionMS(compName);
738 vector worldPos = at.GetObject().ModelToWorld(modelPos);
739 dbgPosShapes.Insert( Debug.DrawSphere(worldPos, 0.25, Colors.PURPLE, ShapeFlags.NOZBUFFER) );
740 }
741 }
742 }
743 else
744 CleanupDebugShapes(dbgPosShapes);
745 }
746
747 private void DrawDebugRay(bool enabled)
748 {
749 if (enabled)
750 {
751 CleanupDebugShapes(rayShapes);
752 rayShapes.Insert( Debug.DrawSphere(m_HitPos, Math.Sqrt(c_UtilityMaxDistFromRaySqr), COLOR_BLUE_A, ShapeFlags.TRANSP) );
753 rayShapes.Insert( Debug.DrawLine(m_RayStart, m_RayEnd, COLOR_BLUE) );
754 }
755 else
756 CleanupDebugShapes(rayShapes);
757 }
758
759 private void CleanupDebugShapes(array<Shape> shapesArr)
760 {
761 for ( int it = 0; it < shapesArr.Count(); ++it )
762 {
763 Debug.RemoveShape( shapesArr[it] );
764 }
765
766 shapesArr.Clear();
767 }
768#endif
769
770 //--------------------------------------------------------
771 // Members
772 //--------------------------------------------------------
774 private PlayerBase m_Player;
775
777 private ref array<ref ActionTarget> m_Targets;
778
780 static private ref VicinityObjects m_VicinityObjects
781
782 private bool m_Debug
783
784 private vector m_RayStart;
785 private vector m_RayEnd;
786 private vector m_HitPos;
787
788 private SurfaceInfo m_SurfaceInfo;
789
790 //--------------------------------------------------------
791 // Constants
792 //--------------------------------------------------------
794 private const float c_RayDistance = 5.0;
795 private const float c_MaxTargetDistance = 3.0;
796 private const float c_MaxActionDistance = UAMaxDistances.DEFAULT;
797 private const float c_ConeAngle = 30.0;
798 private const float c_ConeHeightMin = -0.5;
799 private const float c_ConeHeightMax = 2.0;
800 private const float c_DistanceDelta = 0.3;
801
803 private const float c_UtilityMaxValue = 10000;
804 private const float c_UtilityMaxDistFromRaySqr = 0.8 * 0.8;
805
807 private const string CE_CENTER = "ce_center";
808 private const float HEIGHT_OFFSET = 0.2;
809
811 private const int OBSTRUCTED_COUNT_THRESHOLD = 3;
812 private const int GROUPING_COUNT_THRESHOLD = 10;
813
815 vector CalculateRayStart();
816};
817
818class ObjectGroup
819{
820 ref array<Object> Objects = new array<Object>;
821}
eBleedingSourceType GetType()
Object m_Object
Super root of all classes in Enforce script.
Definition enscript.c:11
Definition colors.c:4
Definition dbgui.c:60
Definition debug.c:2
override bool IsTakeable()
Definition enmath.c:7
proto int GetLiquidType()
See 'LiquidTypes' in 'constants.c'.
static proto SurfaceInfo GetByFile(string name)
proto string GetSurfaceType()
proto string GetEntryName()
objects in vicinity - extended with secondary object which is parent of that Object
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3868
proto native int GetComponentIndex()
PhxInteractionLayers
Definition dayzphysics.c:2
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Definition dayzplayer.c:56
DiagMenuIDs
Definition ediagmenuids.c:2
proto native CGame GetGame()
const int COLOR_BLUE
Definition constants.c:66
const int COLOR_BLUE_A
Definition constants.c:71
const int COLOR_RED
Definition constants.c:64
const int COLOR_YELLOW
Definition constants.c:67
proto void Print(void var)
Prints content of variable to console/log.
CollisionFlags
Definition endebug.c:141
ShapeFlags
Definition endebug.c:126
const int LIQUID_NONE
Definition constants.c:529
proto native vobject GetObject(string name)
Loads object from data, or gets it from cache. Object must be released when not used.
string DumpToString()
bool IsProxy()
Definition hand_events.c:65
int m_ComponentIndex
void IsObjectObstructedCache(vector rayCastStart, int totalObjects)
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
const int windowPosY
Widget m_Parent
Definition sizetochild.c:92
SurfaceDetectionType
Definition surfaceinfo.c:66
UseObjectsMode
Definition surfaceinfo.c:54
override bool CanBeActionTarget()
Definition woodbase.c:256