DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionTargets.c
См. документацию.
1
3{
5
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
35 {
36 foreach (Object obj : objects)
37 {
38 if (IsValidVicinityObject(obj))
39 {
41 }
42 }
43 }
44
45 protected bool IsValidVicinityObject(notnull Object obj)
46 {
47 return obj.CanBeActionTarget();
48 }
49
51 {
52 m_VicinityObjects.Clear();
53 }
54
57 {
58 array<Object> vicinityObjects = new array<Object>();
59 for (int i = 0; i < m_VicinityObjects.Count(); i++)
60 {
62 ItemBase ib = ItemBase.Cast(GetObject(i));
63 if (ib && !ib.IsTakeable())
64 continue;
65
66 vicinityObjects.Insert(GetObject(i));
67 }
68
69 return vicinityObjects;
70 }
71
74 {
75 array<Object> vicinityObjects = new array<Object>();
76 for (int i = 0; i < m_VicinityObjects.Count(); i++)
77 {
78 vicinityObjects.Insert(GetObject(i));
79 }
80
81 return vicinityObjects;
82 }
83
86 {
87 return m_VicinityObjects.GetKey(i);
88 }
89
92 {
93 return m_VicinityObjects.GetElement(i);
94 }
95
96 int Count()
97 {
98 return m_VicinityObjects.Count();
99 }
100
101 void Remove(Object object)
102 {
103 m_VicinityObjects.Remove(object);
104 }
105
106 void Remove(array<Object> objects)
107 {
108 for (int i = 0; i < objects.Count(); i++)
109 {
110 m_VicinityObjects.Remove(objects[i]);
111 }
112 }
113}
114
115class ActionTarget
116{
117 private Object m_Object; // object itself
118 private Object m_Parent; // null or parent of m_Object
119 private int m_ComponentIndex; // p3d Component ID or -1
121 private float m_Utility;
122 private string m_SurfaceName;
124
125 void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName = "")
126 {
128 m_Parent = parent;
129 m_ComponentIndex = componentIndex;
130 m_CursorHitPos = cursorHitPos;
131 m_Utility = utility;
132
134 if (m_SurfaceName != "")
135 {
137 if (surfaceInfo && surfaceInfo.GetLiquidType() != LIQUID_NONE)
138 m_SurfaceLiquidType = surfaceInfo.GetLiquidType();
139 }
140 }
141
143 {
144 return m_Object;
145 }
146
148 {
149 return m_Parent;
150 }
151
152 bool IsProxy()
153 {
154 if (m_Parent)
155 return true;
156 return false;
157 }
158
160 {
161 return m_ComponentIndex;
162 }
163
165 {
166 return m_Utility;
167 }
168
170 {
171 return m_CursorHitPos;
172 }
173
174 void SetCursorHitPos(vector cursor_position)
175 {
176 m_CursorHitPos = cursor_position;
177 }
178
180 {
181 return m_SurfaceName;
182 }
183
185 {
186 return m_SurfaceLiquidType;
187 }
188
190 {
192 }
193
195 {
196 string res = "ActionTarget dump = {";
197 res = res + "m_Object: " + Object.GetDebugName(m_Object);
198 res = res + "; m_Parent: " + Object.GetDebugName(m_Parent);
199 res = res + "; m_ComponentIndex: " + m_ComponentIndex.ToString();
200 res = res + "; m_CursorHitPos: " + m_CursorHitPos.ToString();
201 res = res + "; m_Utility: " + m_Utility.ToString();
202 res = res + "}";
203 return res;
204 }
205};
206
208{
210
212 {
213 m_Player = player;
214 m_VicinityObjects = new VicinityObjects;
216
217 m_Debug = false;
218 }
219
221 {
222 return m_VicinityObjects.GetVicinityObjects();
223 }
224
225 void Clear()
226 {
227 m_Targets.Clear();
228 m_SortedResults.Clear();
230 }
231
232 void Update()
233 {
235 m_VicinityObjects.ClearVicinityObjects();
236 Clear();
237
238 Object firstValidRaycastedObject = null;
239 array<Object> vicinityObjects = new array<Object>;
240
242 vector playerPos = m_Player.GetPosition();
243 vector headingDirection = MiscGameplayFunctions.GetHeadingVector(m_Player);
244
245 m_RayStart = g_Game.GetCurrentCameraPosition();
246 m_RayEnd = m_RayStart + g_Game.GetCurrentCameraDirection() * c_RayDistance;
247
249 rayInput.flags = CollisionFlags.ALLOBJECTS;
250 //rayInput.sorted = true;
252 array<RaycastRVResult> sortedValidRaycastResults = new array<RaycastRVResult>();
254
255 if (DayZPhysics.RaycastRVProxy(rayInput, results))
256 {
257 array<int> sortedDistanceHelper = SortResultsDistance(results);
258 int sortedResultsCount = m_SortedResults.Count();
259 if (sortedResultsCount > 0 )
260 {
261 foreach (int sortedDist : sortedDistanceHelper) //distances already sorted
262 {
263 array<RaycastRVResult> sameDistResults = m_SortedResults.Get(sortedDist);
264
265 foreach (RaycastRVResult res : sameDistResults)
266 {
267 if (res.obj && !res.obj.CanBeActionTarget())
268 continue;
269
271 if (res.hierLevel > 0)
272 {
274 if (res.parent.IsMan() || (res.obj.GetID() < 1 && !IsRaycastResultException(res)))
275 continue;
276 }
277
278 sortedValidRaycastResults.Insert(res);
279 resultMap.Insert(res.obj, res);
280 if (!firstValidRaycastedObject)
281 firstValidRaycastedObject = res.obj;
282
283 if (m_HitPos == vector.Zero)
284 m_HitPos = res.pos;
285
286 if (res.surface && res.surface.GetSurfaceType() != "")
287 {
288 m_SurfaceInfo = res.surface;
289 }
290 else
291 {
294 surfaceParams.type = SurfaceDetectionType.Roadway;
295 surfaceParams.position = m_HitPos;
296 surfaceParams.includeWater = true;
297 surfaceParams.syncMode = UseObjectsMode.NoWait;
298 surfaceParams.rsd = RoadSurfaceDetection.ABOVE;
299
302 if (g_Game.GetSurface(surfaceParams, surfaceResult))
303 {
304 if (surfaceResult && surfaceResult.surface)
305 {
306 m_SurfaceInfo = surfaceResult.surface;
307 }
308 }
309 }
310 break;
311 }
312 }
313 }
314 }
315 else
316 {
317 firstValidRaycastedObject = null;
319 m_SurfaceInfo = null;
320 }
321
323 DayZPlayerCamera camera = m_Player.GetCurrentCamera();
324 if (camera && camera.GetCurrentPitch() <= -45) // Spatial search is a contributor to very heavy searching, limit it to when we are at least looking down
325 DayZPlayerUtils.GetEntitiesInCone(playerPos, headingDirection, c_ConeAngle, c_MaxTargetDistance, c_ConeHeightMin, c_ConeHeightMax, vicinityObjects);
326
328 vicinityObjects.RemoveItem(m_Player);
329
330 FilterDuplicateVicinityObjects(vicinityObjects, sortedValidRaycastResults);
331
333 m_VicinityObjects.TransformToVicinityObjects(vicinityObjects);
334
336 FilterObstructedObjectsEx(firstValidRaycastedObject, vicinityObjects);
337
339 int vicinityObjCount = m_VicinityObjects.Count();
340 for (int i = 0; i < vicinityObjCount; ++i)
341 {
342 Object object = m_VicinityObjects.GetObject(i);
343 Object parent;
344 RaycastRVResult result;
345 int targetComponent;
346 vector hitpos;
347 //proper raycast results will use their own data
348 if (resultMap.Find(object, result))
349 {
350 parent = result.parent;
351 hitpos = result.pos;
352 targetComponent = result.component;
353 }
354 else
355 {
356 parent = m_VicinityObjects.GetParent(i);
357 hitpos = m_HitPos; //substitute raycast hitpos as reference for the utility check
358 targetComponent = -1; //invalid component
359 }
360
361 float utility = ComputeUtility(object, m_RayStart, m_RayEnd, firstValidRaycastedObject, hitpos);
362 if (utility > 0)
363 {
364 string surfaceName;
365 if (m_SurfaceInfo && m_SurfaceInfo.GetEntryName() != "")
366 surfaceName = m_SurfaceInfo.GetEntryName();
367
368 ActionTarget at = new ActionTarget(object, parent, targetComponent, m_HitPos, utility, surfaceName);
369 StoreTarget(at);
370 }
371 }
372
374 if (m_HitPos == vector.Zero)
375 {
376 vector contact_pos, contact_dir, hitNormal;
377 int contactComponent;
378 float hitFraction;
379 Object hitObject;
380
381 m_RayEnd = m_RayStart + g_Game.GetCurrentCameraDirection() * c_RayDistance * 3;
382
383 PhxInteractionLayers collisionLayerMask = PhxInteractionLayers.ROADWAY|PhxInteractionLayers.TERRAIN|PhxInteractionLayers.WATERLAYER;
384 DayZPhysics.RayCastBullet(m_RayStart,m_RayEnd,collisionLayerMask,null,hitObject,contact_pos,hitNormal,hitFraction);
385 m_HitPos = contact_pos;
386 }
387
388 m_Targets.Insert(new ActionTarget(null, null, -1, m_HitPos, 0));
389
390#ifdef DIAG_DEVELOPER
391 if (DiagMenu.GetBool(DiagMenuIDs.MISC_ACTION_TARGETS_DEBUG))
392 {
393 ShowDebugActionTargets(true);
394 DrawDebugActionTargets(true);
395 DrawDebugCone(true);
396 DrawDebugRay(true);
397 DrawSelectionPos(DiagMenu.GetBool(DiagMenuIDs.MISC_ACTION_TARGETS_SELPOS_DEBUG));
398 }
399 else
400 {
401 ShowDebugActionTargets(false);
402 DrawDebugActionTargets(false);
403 DrawDebugCone(false);
404 DrawDebugRay(false);
405 DrawSelectionPos(false);
406 }
407#endif
408 }
409
412 {
413 if (TentBase.Cast(res.parent))
414 return true;
415
416 return false;
417 }
418
419 //distance sorting, returns sorted unique distance tiers as ints (float*1000)
421 {
422 array<int> distHelper = new array<int>();
423 foreach (RaycastRVResult res : results)
424 {
425 int distance = (int)(vector.DistanceSq(res.pos, m_RayStart) * 1000);
426 array<RaycastRVResult> arr = m_SortedResults.Get(distance);
427 if (!arr)
428 arr = new array<RaycastRVResult>();
429
430 arr.Insert(res);
431 m_SortedResults.Set(distance, arr);
432
433 if (distHelper.Find(distance) == -1)
434 distHelper.Insert(distance);
435 }
436
437 distHelper.Sort();
438 return distHelper;
439 }
440
441 private bool IsObstructed(Object object)
442 {
444 return IsObstructedEx(object, cache);
445 }
446
448 {
449 return MiscGameplayFunctions.IsObjectObstructedEx(object, cache);
450 }
451
454 { return m_Targets.Count(); }
455
458 { return m_Targets.Get(index); }
459
461 private void StoreTarget(ActionTarget pActionTarget)
462 {
463 int index = FindIndexForStoring(pActionTarget.GetUtility());
464 m_Targets.InsertAt(pActionTarget, index);
465 //Print("StoreTarget; object: " + pActionTarget.GetObject() + " | parent: " + pActionTarget.GetParent() + " | idx: " + index);
466 }
467
469 private int FindIndexForStoring(float value)
470 {
471 int left = 0;
472 int right = m_Targets.Count() - 1;
473 while ( left <= right )
474 {
475 int middle = (left + right) / 2;
476 float middleValue = m_Targets.Get(middle).GetUtility();
477
478 if ( middleValue == value )
479 return middle;
480 else if ( middleValue < value )
481 right = middle - 1;
482 else
483 left = middle + 1;
484 }
485
486 return left;
487 }
488
490 private float ComputeUtility(Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos)
491 {
494 return -1;
495
496 if (pTarget)
497 {
498 if (pTarget == cursorTarget)
499 {
501 if (pTarget.GetType() == string.Empty)
502 return 0.01;
503
504 if (pTarget.IsBuilding())
505 return 0.25;
506
507 if (pTarget.IsTransport())
508 return 0.25;
509
511 if (pTarget.CanUseConstruction())
512 return 0.85;
513
514 if (pTarget.IsWell())
515 return 0.9;
516
517 vector playerPosXZ = m_Player.GetPosition();
518 vector hitPosXZ = hitPos;
519 playerPosXZ[1] = 0;
520 hitPosXZ[1] = 0;
521 if (vector.DistanceSq(playerPosXZ, hitPosXZ) <= c_MaxTargetDistance * c_MaxTargetDistance)
522 return c_UtilityMaxValue;
523 }
524
525 if ( PlayerBase.Cast(pTarget) && PlayerBase.Cast(pTarget).IsInVehicle() ) // utility in vehicle should be below base vehicle val
526 return 0.20;
527
528 float distSqr = DistSqrPoint2Line(pTarget.GetPosition(), pRayStart, pRayEnd);
530 }
531
533 if (m_SurfaceInfo && m_SurfaceInfo.GetLiquidType() != LIQUID_NONE)
534 return 0.01;
535
536 return -1;
537 }
538
540 private float DistSqrPoint2Line(vector pPoint, vector pL1, vector pL2)
541 {
542 vector v = pL2 - pL1;
543 vector w = pPoint - pL1;
544
545 float c1 = vector.Dot(w,v);
546 float c2 = vector.Dot(v,v);
547
548 if ( c1 <= 0 || c2 == 0 )
549 return vector.DistanceSq(pPoint, pL1);
550
551 float b = c1 / c2;
552 vector nearestPoint = pL1 + (v * b);
553 return vector.DistanceSq(pPoint, nearestPoint);
554 }
555
556 private void FilterDuplicateVicinityObjects(inout array<Object> vicinityObjectsOutput, array<RaycastRVResult> sortedRaycastResults)
557 {
558 //remove duplicates
559 array<Object> tmp = new array<Object>();
560 tmp.Copy(vicinityObjectsOutput);
561 vicinityObjectsOutput.Clear();
562 foreach (Object obj : tmp)
563 {
564 if (obj && vicinityObjectsOutput.Find(obj) == -1)
565 vicinityObjectsOutput.Insert(obj);
566 }
567
568 //next append the raycast result objects
569 foreach (RaycastRVResult raycastResult : sortedRaycastResults)
570 {
571 if (raycastResult.obj && vicinityObjectsOutput.Find(raycastResult.obj) == -1)
572 vicinityObjectsOutput.Insert(raycastResult.obj);
573 }
574 }
575
576 private void FilterObstructedObjectsEx(Object cursor_target, array<Object> vicinityObjects)
577 {
578 #ifdef DIAG_DEVELOPER
579 if (DiagMenu.GetBool(DiagMenuIDs.MISC_ACTION_TARGETS_DEBUG))
580 CleanupDebugShapes(obstruction);
581 #endif
582
583 array<Object> obstructingObjects = new array<Object>;
584 MiscGameplayFunctions.FilterObstructingObjects(vicinityObjects, obstructingObjects);
585
586 if ( obstructingObjects.Count() > 0 )
587 {
588 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
589
590 int numObstructed = 0;
591 int mCount = m_VicinityObjects.Count();
592
593 if (mCount > GROUPING_COUNT_THRESHOLD)
594 {
595 array<Object> filteredObjects = new array<Object>;
596 MiscGameplayFunctions.FilterObstructedObjectsByGrouping(m_RayStart, c_MaxTargetDistance, c_DistanceDelta, m_VicinityObjects.GetRawVicinityObjects(), vicinityObjects, filteredObjects);
597 m_VicinityObjects.ClearVicinityObjects();
598 m_VicinityObjects.TransformToVicinityObjects(filteredObjects);
599 }
600 else
601 {
602 FilterObstructedObjects(cursor_target);
603 }
604 }
605 }
606
607 private void FilterObstructedObjects(Object cursor_target)
608 {
609 int numObstructed = 0;
610 int mCount = m_VicinityObjects.Count();
612 mCount--;
613
615 for ( int i = mCount; i >= 0; --i )
616 {
617 Object object = m_VicinityObjects.GetObject(i);
618 Object parent = m_VicinityObjects.GetParent(i);
619
621 if (object && !parent)
622 {
625 if (numObstructed > OBSTRUCTED_COUNT_THRESHOLD && object != cursor_target)
626 {
627 m_VicinityObjects.Remove(object);
628 continue;
629 }
630
632 if (object != cursor_target && IsObstructedEx(object, cache))
633 {
634 m_VicinityObjects.Remove(object);
635 numObstructed++;
636 }
637
638 cache.ClearCache();
639 }
640 }
641 }
642
643#ifdef DIAG_DEVELOPER
644 ref array<Shape> shapes = new array<Shape>();
645 ref array<Shape> dbgConeShapes = new array<Shape>();
646 ref array<Shape> rayShapes = new array<Shape>();
647 ref array<Shape> obstruction = new array<Shape>();
648 ref array<Shape> dbgPosShapes = new array<Shape>();
649
650 void ShowDebugActionTargets(bool enabled)
651 {
652 int windowPosX = 0;
653 int windowPosY = 50;
654
655 Object obj;
656
658 DbgUI.Begin("Action Targets", windowPosX, windowPosY);
659 if ( enabled )
660 {
661 for ( int i = 0; i < GetTargetsCount(); i++ )
662 {
663 obj = m_Targets.Get(i).GetObject();
664 if ( obj )
665 {
666 float util = m_Targets.Get(i).GetUtility();
667 int compIdx = m_Targets.Get(i).GetComponentIndex();
668 string compName;
669 array<string> compNames = new array<string>;
670 compName = obj.GetActionComponentName(compIdx);
671 obj.GetActionComponentNameList(compIdx, compNames);
672
673 if ( compNames.Count() > 0 )
674 {
675 for ( int c = 0; c < compNames.Count(); c++ )
676 {
677 DbgUI.Text(obj.GetDisplayName() + " :: " + obj + " | util: " + util + " | compIdx: " + compIdx + " | compName: " + compNames[c] + "| wPos: " + obj.GetWorldPosition() );
678 }
679 }
680 else
681 {
682 DbgUI.Text(obj.GetDisplayName() + " :: " + obj + " | util: " + util + " | compIdx: " + compIdx + " | compName: " + compName + "| wPos: " + obj.GetWorldPosition() );
683 }
684 }
685 else
686 continue;
687 }
688 }
689 DbgUI.End();
690 DbgUI.EndCleanupScope();
691 }
692
693 void DrawDebugActionTargets(bool enabled)
694 {
695 int s_id;
696 vector w_pos;
697 vector w_pos_sphr;
698 vector w_pos_lend;
699 Object obj;
700
701 if ( enabled )
702 {
703 CleanupDebugShapes(shapes);
704
705 for ( int i = 0; i < GetTargetsCount(); i++ )
706 {
707 obj = m_Targets.Get(i).GetObject();
708 if ( obj )
709 {
710 w_pos = obj.GetPosition();
711 // sphere pos tweaks
712 w_pos_sphr = w_pos;
713 w_pos_sphr[1] = w_pos_sphr[1] + 0.5;
714 // line pos tweaks
715 w_pos_lend = w_pos;
716 w_pos_lend[1] = w_pos_lend[1] + 0.5;
717
718 if ( i == 0 )
719 {
720 shapes.Insert( Debug.DrawSphere(w_pos_sphr, 0.03, COLOR_RED) );
721 shapes.Insert( Debug.DrawLine(w_pos, w_pos_lend, COLOR_RED) );
722 }
723 else
724 {
725 shapes.Insert( Debug.DrawSphere(w_pos_sphr, 0.03, COLOR_YELLOW) );
726 shapes.Insert( Debug.DrawLine(w_pos, w_pos_lend, COLOR_YELLOW) );
727 }
728 }
729 }
730 }
731 else
732 CleanupDebugShapes(shapes);
733 }
734
735 private void DrawDebugCone(bool enabled)
736 {
737 // "cone" settings
738 vector start, end, endL, endR;
739 float playerAngle;
740 float xL,xR,zL,zR;
741
742 if (enabled)
743 {
744 CleanupDebugShapes(dbgConeShapes);
745
746 start = m_Player.GetPosition();
747 playerAngle = MiscGameplayFunctions.GetHeadingAngle(m_Player);
748
749 // offset position of the shape in height
750 start[1] = start[1] + 0.2;
751
752 endL = start;
753 endR = start;
754 xL = c_MaxTargetDistance * Math.Cos(playerAngle + Math.PI_HALF + c_ConeAngle * Math.DEG2RAD); // x
755 zL = c_MaxTargetDistance * Math.Sin(playerAngle + Math.PI_HALF + c_ConeAngle * Math.DEG2RAD); // z
756 xR = c_MaxTargetDistance * Math.Cos(playerAngle + Math.PI_HALF - c_ConeAngle * Math.DEG2RAD); // x
757 zR = c_MaxTargetDistance * Math.Sin(playerAngle + Math.PI_HALF - c_ConeAngle * Math.DEG2RAD); // z
758 endL[0] = endL[0] + xL;
759 endL[2] = endL[2] + zL;
760 endR[0] = endR[0] + xR;
761 endR[2] = endR[2] + zR;
762
763 dbgConeShapes.Insert( Debug.DrawLine(start, endL, COLOR_BLUE) );
764 dbgConeShapes.Insert( Debug.DrawLine(start, endR, COLOR_BLUE) ) ;
765 dbgConeShapes.Insert( Debug.DrawLine(endL, endR, COLOR_BLUE) );
766 }
767 else
768 CleanupDebugShapes(dbgConeShapes);
769 }
770
771 private void DrawSelectionPos(bool enabled)
772 {
773 if (enabled)
774 {
775 CleanupDebugShapes(dbgPosShapes);
776 if (GetTargetsCount() > 0 && GetTarget(0).GetUtility() > -1 )
777 {
778 ActionTarget at = GetTarget(0);
779 if (at.GetObject())
780 {
781 string compName = at.GetObject().GetActionComponentName(at.GetComponentIndex());
782 vector modelPos = at.GetObject().GetSelectionPositionMS(compName);
783 vector worldPos = at.GetObject().ModelToWorld(modelPos);
784 dbgPosShapes.Insert( Debug.DrawSphere(worldPos, 0.25, Colors.PURPLE, ShapeFlags.NOZBUFFER) );
785 }
786 }
787 }
788 else
789 CleanupDebugShapes(dbgPosShapes);
790 }
791
792 private void DrawDebugRay(bool enabled)
793 {
794 if (enabled)
795 {
796 CleanupDebugShapes(rayShapes);
797 rayShapes.Insert( Debug.DrawSphere(m_HitPos, Math.Sqrt(c_UtilityMaxDistFromRaySqr), COLOR_BLUE_A, ShapeFlags.TRANSP) );
798 rayShapes.Insert( Debug.DrawLine(m_RayStart, m_RayEnd, COLOR_BLUE) );
799 }
800 else
801 CleanupDebugShapes(rayShapes);
802 }
803
804 private void CleanupDebugShapes(array<Shape> shapesArr)
805 {
806 for ( int it = 0; it < shapesArr.Count(); ++it )
807 {
808 Shape shape = shapesArr[it];
809 Debug.RemoveShape( shape );
810 }
811
812 shapesArr.Clear();
813 }
814#endif
815
816 //--------------------------------------------------------
817 // Members
818 //--------------------------------------------------------
821
824
826 static private ref VicinityObjects m_VicinityObjects
827
828 private bool m_Debug
829
832 private vector m_HitPos;
833
835
836 //--------------------------------------------------------
837 // Constants
838 //--------------------------------------------------------
840 private const float c_RayDistance = 5.0;
841 private const float c_MaxTargetDistance = 3.0;
843 private const float c_ConeAngle = 30.0;
844 private const float c_ConeHeightMin = -0.5;
845 private const float c_ConeHeightMax = 2.0;
846 private const float c_DistanceDelta = 0.3;
847
849 private const float c_UtilityMaxValue = 10000;
850 private const float c_UtilityMaxDistFromRaySqr = 0.65 * 0.65;
851 private const float c_UtilityValueCoef = 0.35;
852
854 private const string CE_CENTER = "ce_center";
855 private const float HEIGHT_OFFSET = 0.2;
856
858 private const int OBSTRUCTED_COUNT_THRESHOLD = 3;
859 private const int GROUPING_COUNT_THRESHOLD = 10;
860
863};
864
ActionOverrideData int
Object m_Object
Определения ActionPushObject.c:12
int m_SurfaceLiquidType
Определения ActionTargets.c:123
int GetSurfaceLiquidType()
Определения ActionTargets.c:184
void DbgPrintTargetDump()
Определения ActionTargets.c:189
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
float m_Utility
Определения ActionTargets.c:121
string m_SurfaceName
Определения ActionTargets.c:122
vector GetCursorHitPos()
Определения ActionTargets.c:169
Object GetObject()
Определения ActionTargets.c:142
string GetSurfaceName()
Определения ActionTargets.c:179
vector m_CursorHitPos
Определения ActionTargets.c:120
float GetUtility()
Определения ActionTargets.c:164
void SetCursorHitPos(vector cursor_position)
Определения ActionTargets.c:174
string Debug()
Определения CachedEquipmentStorageBase.c:26
Entity m_Parent
Определения CachedEquipmentStorageBase.c:17
map
Определения ControlsXboxNew.c:4
DayZGame g_Game
Определения DayZGame.c:4074
proto native int GetComponentIndex()
Определения ActionTargets.c:159
PhxInteractionLayers
Определения DayZPhysics.c:2
void DayZPlayerUtils()
cannot be instantiated
Определения DayZPlayerUtils.c:465
float hitFraction
Определения DustKickupEffects.c:23
string surfaceName
Определения DustKickupEffects.c:19
Object object
Определения DustKickupEffects.c:18
void CleanupDebugShapes(array< Shape > shapesArr)
DEPRECATED.
Определения DynamicMusicPlayer.c:1038
DiagMenuIDs
Определения EDiagMenuIDs.c:2
string DumpToString()
Определения Hand_Events.c:168
bool IsProxy()
Определения Hand_Events.c:65
int m_ComponentIndex
Определения ImpactEffects.c:14
void IsObjectObstructedCache(vector rayCastStart, int totalObjects)
Определения MiscGameplayFunctions.c:2124
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
const int windowPosY
Определения PluginPresenceNotifier.c:77
SurfaceDetectionType
Определения SurfaceInfo.c:86
UseObjectsMode
Определения SurfaceInfo.c:74
SurfaceInfo m_SurfaceInfo
first valid hitpos! Used only as rough reference value for conecasted results.
Определения ActionTargets.c:834
const float c_UtilityMaxDistFromRaySqr
Определения ActionTargets.c:850
const float c_MaxTargetDistance
Определения ActionTargets.c:841
vector m_RayEnd
Определения ActionTargets.c:831
const float c_DistanceDelta
Определения ActionTargets.c:846
int GetTargetsCount()
returns count of founded targets
Определения ActionTargets.c:453
const float c_UtilityValueCoef
Определения ActionTargets.c:851
const string CE_CENTER
p3d
Определения ActionTargets.c:854
const float HEIGHT_OFFSET
Определения ActionTargets.c:855
ref map< int, ref array< RaycastRVResult > > m_SortedResults
Определения ActionTargets.c:209
static array< Object > GetVicinityObjects()
Определения ActionTargets.c:220
const float c_ConeAngle
Определения ActionTargets.c:843
array< int > SortResultsDistance(array< ref RaycastRVResult > results)
Определения ActionTargets.c:420
const int OBSTRUCTED_COUNT_THRESHOLD
misc
Определения ActionTargets.c:858
void Update()
Определения ActionTargets.c:232
void FilterObstructedObjects(Object cursor_target)
Определения ActionTargets.c:607
void FilterDuplicateVicinityObjects(inout array< Object > vicinityObjectsOutput, array< RaycastRVResult > sortedRaycastResults)
Определения ActionTargets.c:556
const float c_MaxActionDistance
Определения ActionTargets.c:842
bool IsObstructedEx(Object object, IsObjectObstructedCache cache)
Определения ActionTargets.c:447
bool IsObstructed(Object object)
Определения ActionTargets.c:441
float DistSqrPoint2Line(vector pPoint, vector pL1, vector pL2)
distance between point and line
Определения ActionTargets.c:540
vector m_HitPos
Определения ActionTargets.c:832
void StoreTarget(ActionTarget pActionTarget)
inserts action into sorted array based on utility
Определения ActionTargets.c:461
bool IsRaycastResultException(RaycastRVResult res)
Initial raycast filtering exceptions (can't ask the entity type, sadly)
Определения ActionTargets.c:411
const float c_RayDistance
searching properties
Определения ActionTargets.c:840
PlayerBase m_Player
player owner
Определения ActionTargets.c:820
ActionTarget GetTarget(int index)
returns action target at index
Определения ActionTargets.c:457
void FilterObstructedObjectsEx(Object cursor_target, array< Object > vicinityObjects)
Определения ActionTargets.c:576
void ActionTargets(PlayerBase player)
Определения ActionTargets.c:211
void Clear()
Определения ActionTargets.c:225
const int GROUPING_COUNT_THRESHOLD
Определения ActionTargets.c:859
vector CalculateRayStart()
DEPRECATED.
vector m_RayStart
objects in vicinity
Определения ActionTargets.c:830
ref array< ref ActionTarget > m_Targets
selected & sorted targets by utility function
Определения ActionTargets.c:823
float ComputeUtility(Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos)
computes utility of target
Определения ActionTargets.c:490
const float c_UtilityMaxValue
utility constants
Определения ActionTargets.c:849
int FindIndexForStoring(float value)
binary search algorithm
Определения ActionTargets.c:469
const float c_ConeHeightMax
Определения ActionTargets.c:845
const float c_ConeHeightMin
Определения ActionTargets.c:844
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)
Определения DayZPhysics.c:124
Определения DbgUI.c:60
Определения EnDebug.c:241
override bool IsTakeable()
Определения BaseBuildingBase.c:909
ref array< Object > Objects
Определения ActionTargets.c:867
Определения ActionTargets.c:866
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
CollisionFlags flags
Определения DayZPhysics.c:63
Определения DayZPhysics.c:50
int component
index of component in corresponding geometry level
Определения DayZPhysics.c:107
vector pos
position of collision (in world coord)
Определения DayZPhysics.c:103
Object parent
if hierLevel > 0 most parent of the proxy object
Определения DayZPhysics.c:101
Определения DayZPhysics.c:99
bool includeWater
Include water in the surface detection, will return the water if it is higher than the surface.
Определения SurfaceInfo.c:103
SurfaceDetectionType type
Type of surface to detect.
Определения SurfaceInfo.c:97
RoadSurfaceDetection rsd
See RoadSurfaceDetection, SurfaceTraceType.Roadway only.
Определения SurfaceInfo.c:112
vector position
3D position to trace the surface from
Определения SurfaceInfo.c:100
UseObjectsMode syncMode
See UseObjectsMode, SurfaceTraceType.Roadway only.
Определения SurfaceInfo.c:106
SurfaceInfo surface
Returned SurfaceInfo, plain pointer.
Определения SurfaceInfo.c:134
proto int GetLiquidType()
See 'LiquidTypes' in 'constants.c'.
static proto SurfaceInfo GetByFile(string name)
Определения SurfaceInfo.c:9
Определения CarTent.c:2
const float DEFAULT
Определения ActionConstants.c:114
void Remove(Object object)
Определения ActionTargets.c:101
bool IsValidVicinityObject(notnull Object obj)
Определения ActionTargets.c:45
int Count()
Определения ActionTargets.c:96
void Remove(array< Object > objects)
Определения ActionTargets.c:106
void ClearVicinityObjects()
Определения ActionTargets.c:50
Object GetObject(int i)
returns VicinityObjects Key
Определения ActionTargets.c:85
void TransformToVicinityObjects(array< Object > objects)
transform simple array of Objects to VicinityObjects hashmap
Определения ActionTargets.c:34
ref map< Object, Object > m_VicinityObjects
Определения ActionTargets.c:4
Object GetParent(int i)
returns VicinityObjects Element
Определения ActionTargets.c:91
void VicinityObjects()
Определения ActionTargets.c:6
void StoreVicinityObject(Object object, Object parent=null)
stores VicinityObject to Hashmap - for storing of parent/child relationship
Определения ActionTargets.c:12
array< Object > GetRawVicinityObjects()
return simple array of Objects in Vicinity
Определения ActionTargets.c:73
array< Object > GetVicinityObjects()
return simple array of Objects in Vicinity
Определения ActionTargets.c:56
objects in vicinity - extended with secondary object which is parent of that Object
Определения ActionTargets.c:3
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения Transport.c:70
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.
Определения EnConvert.c:305
static const vector Zero
Определения EnConvert.c:123
Определения EnConvert.c:119
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Определения dayzplayer.c:56
class LOD Object
@ Colors
Определения EnWorld.c:88
const int COLOR_BLUE
Определения 1_Core/DayZ/constants.c:66
const int COLOR_BLUE_A
Определения 1_Core/DayZ/constants.c:73
const int COLOR_RED
Определения 1_Core/DayZ/constants.c:64
const int COLOR_YELLOW
Определения 1_Core/DayZ/constants.c:67
proto void Print(void var)
Prints content of variable to console/log.
CollisionFlags
Определения EnDebug.c:141
ShapeFlags
Определения EnDebug.c:126
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 GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
const int LIQUID_NONE
Определения 3_Game/DayZ/constants.c:566
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:422