DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Hologram.c
См. документацию.
2{
3 #ifdef SERVER
4 protected const int SPAWN_FLAGS = ECE_CREATEPHYSICS;
5 #else
6 protected const int SPAWN_FLAGS = ECE_LOCAL;
7 #endif
8
9
10 #ifdef DIAG_DEVELOPER
11 string m_CollisionDetails;
12 #endif
13
14 protected const string SUFFIX_MATERIAL_DEPLOYABLE = "_deployable.rvmat";
15 protected const string SUFFIX_MATERIAL_UNDEPLOYABLE = "_undeployable.rvmat";
16 protected const string SUFFIX_MATERIAL_POWERED = "_powered.rvmat";
17
18 protected const vector PLACEMENT_RC_START_OFFSET = "0 1 0";
19 protected const vector PLACEMENT_RC_END_OFFSET = "0 -2 0";
20
21 protected ItemBase m_Parent;
24 protected ProjectionTrigger m_ProjectionTrigger;
25 protected string m_ProjectionTypename;
26
27 protected bool m_IsColliding;
28 protected bool m_IsCollidingGPlot;
29 protected bool m_IsSlope;
30 protected bool m_IsCollidingPlayer;
31 protected bool m_IsFloating;
32 protected bool m_UpdatePosition;
33 protected bool m_IsHidden;
34
36 protected vector m_Rotation;
40 protected const string ANIMATION_PLACING = "Placing";
41 protected const string ANIMATION_INVENTORY = "Inventory";
42 protected const string SELECTION_PLACING = "placing";
43 protected const string SELECTION_INVENTORY = "inventory";
44
45 protected const float SMALL_PROJECTION_RADIUS = 1;
46 protected const float SMALL_PROJECTION_GROUND = 2;
47 protected const float DISTANCE_SMALL_PROJECTION = 1;
48 protected const float LARGE_PROJECTION_DISTANCE_LIMIT = 6;
49 protected const float PROJECTION_TRANSITION_MIN = 1;
50 protected const float PROJECTION_TRANSITION_MAX = 0.25;
51 protected const float LOOKING_TO_SKY = 0.75;
52 static const float DEFAULT_MAX_PLACEMENT_HEIGHT_DIFF = 1.5;
53
54 protected float m_SlopeTolerance;
55 protected bool m_AlignToTerrain;
57 protected int m_ContactComponent;
58
59 protected ref set<string> m_SelectionsToRefresh = new set<string>;
60
61 // Watchtower correction variables
62 // These watchtower component names should be corrected when colliding with them as they are supposed to be "trigger boxes", not colliders
64
65 // These watchtower components are supposed to be trigger boxes, but should block placement on them (currently only the boxes above the stairs)
67
68 void Hologram(PlayerBase player, vector pos, ItemBase item)
69 {
70 m_Player = player;
71 m_Parent = item;
72 m_Projection = null;
73
75 m_UpdatePosition = true;
77
78 m_Rotation = "0 0 0";
79 m_FromAdjusted = "0 0 0";
80
81 // If the static names are empty, generate the needed names
82 // Refer to their definitions to see why these are required
83 if (m_WatchtowerIgnoreComponentNames.Count() == 0)
84 {
85 string baseStringBegin = Watchtower.BASE_VIEW_NAME;
86 string baseIgnoreStringEnd = Watchtower.BASE_WALL_NAME;
87
88 int floors = Watchtower.MAX_WATCHTOWER_FLOORS;
89 int walls = Watchtower.MAX_WATCHTOWER_WALLS;
90
91 string compName;
92 for (int i = 1; i < floors + 1; ++i)
93 {
94 compName = baseStringBegin + i.ToString();
95 for (int j = 1; j < walls + 1; ++j)
96 m_WatchtowerIgnoreComponentNames.Insert(compName + baseIgnoreStringEnd + j.ToString());
97
98 if (i != 1)
99 m_WatchtowerBlockedComponentNames.Insert(compName);
100 else
101 m_WatchtowerIgnoreComponentNames.Insert(compName);
102 }
103 }
104
105 string configPathProjectionTypename = string.Format("CfgVehicles %1 projectionTypename", m_Parent.GetType());
106 if (g_Game.ConfigIsExisting(configPathProjectionTypename))
107 {
108 m_ProjectionTypename = g_Game.ConfigGetTextOut(configPathProjectionTypename);
109 }
110
111 EntityAI projectionEntity;
112 if (g_Game.IsMultiplayer() && g_Game.IsServer())
113 {
114 projectionEntity = EntityAI.Cast(g_Game.CreateObjectEx(ProjectionBasedOnParent(), pos, ECE_PLACE_ON_SURFACE));
115 projectionEntity.SetAllowDamage(false);
116 SetProjectionEntity(projectionEntity);
118 }
119 else
120 {
121 projectionEntity = EntityAI.Cast(g_Game.CreateObjectEx(ProjectionBasedOnParent(), pos, ECE_TRACE|ECE_LOCAL));
122 if (projectionEntity == null)
123 {
124 ErrorEx(string.Format("Cannot create hologram entity from config class %1", ProjectionBasedOnParent()), ErrorExSeverity.WARNING);
125 return;
126 }
127
128 SetProjectionEntity(projectionEntity);
132 }
133
134 if (ItemBase.Cast(projectionEntity))
135 {
136 ItemBase.Cast(GetProjectionEntity()).SetIsHologram(true);
137 }
138
139 string configPathSlope = string.Format("CfgVehicles %1 slopeTolerance", GetProjectionEntity().GetType());
140 if (g_Game.ConfigIsExisting(configPathSlope))
141 {
142 m_SlopeTolerance = g_Game.ConfigGetFloat(configPathSlope);
143 }
144
145 string configPathAlign = string.Format("CfgVehicles %1 alignHologramToTerain", GetProjectionEntity().GetType());
146 if (g_Game.ConfigIsExisting(configPathAlign))
147 {
148 m_AlignToTerrain = g_Game.ConfigGetInt(configPathAlign);
149 }
150
151 string configPathOrientationLimit = string.Format("CfgVehicles %1 yawPitchRollLimit", GetProjectionEntity().GetType());
152 if (g_Game.ConfigIsExisting(configPathOrientationLimit))
153 {
154 m_YawPitchRollLimit = g_Game.ConfigGetVector(configPathOrientationLimit);
155 }
156 }
157
159 {
160 if (g_Game)
161 {
162 if (m_Projection)
163 {
164 g_Game.ObjectDelete(m_Projection);
165 }
166
168 {
169 g_Game.ObjectDelete(m_ProjectionTrigger);
170 }
171 }
172
173 #ifdef DIAG_DEVELOPER
175 #endif
176 }
177
179 {
180 if ( m_Projection.HasAnimation( ANIMATION_PLACING ) )
181 {
182 m_Projection.SetAnimationPhase( ANIMATION_PLACING, 0 );
184
185 if ( m_Projection.HasAnimation( ANIMATION_INVENTORY ) )
186 {
187 m_Projection.SetAnimationPhase( ANIMATION_INVENTORY, 1 );
188 }
189 }
190 else
191 {
194 }
195 }
196
197 // Updates selections on hologram object so they reflect the state of the parent object's selections.
199 {
200 string cfg_access = "CfgVehicles " + m_Projection.GetType() + " AnimationSources ";
201
202 if ( g_Game.ConfigIsExisting(cfg_access) )
203 {
204 int cfg_access_count = g_Game.ConfigGetChildrenCount(cfg_access);
205
206 for ( int i = 0; i < cfg_access_count; ++i )
207 {
208 string found_anim;
209 g_Game.ConfigGetChildName(cfg_access, i, found_anim);
210
211 float anim_phase = m_Parent.GetAnimationPhase(found_anim);
212 m_Projection.SetAnimationPhase(found_anim, anim_phase);
213 }
214 }
215 }
216
218 {
220 }
221
223 {
225 if (m_ProjectionTypename != "")
226 {
228 }
229
230 if (!item)
231 {
232 return "";
233 }
234
235 if (item.CanMakeGardenplot())
236 {
237 return "GardenPlotPlacing";
238 }
239
240 //Camping & Base building
241 if (item.IsInherited( TentBase ) || item.IsBasebuildingKit())
242 {
243 return item.GetType() + "Placing";
244 }
245
246 return item.GetType();
247 }
248
250 static bool DoesHaveProjection(ItemBase item)
251 {
252 return item && (item.IsDeployable() || item.CanMakeGardenplot() || item.IsInherited(DeployableContainer_Base));
253 }
254
255 // update loop for visuals and collisions of the hologram
256 void UpdateHologram(float timeslice)
257 {
258 if (!m_Parent)
259 {
260 m_Player.TogglePlacingLocal();
261
262 return;
263 }
264
266 {
267 m_Player.TogglePlacingLocal();
268
269 return;
270 }
271
272 if (!GetUpdatePosition())
273 return;
274
275
276 #ifdef DIAG_DEVELOPER
277 DebugConfigValues();
279 #endif
280
281 // update hologram position
284
289
290 m_Projection.OnHologramBeingPlaced(m_Player);
291 }
292
294 {
295 vector y_p_r;
296
297 if ( m_AlignToTerrain )
298 {
299 vector projection_orientation_angles = GetDefaultOrientation() + GetProjectionRotation();
300 vector mat0[3];
301 vector mat1[3];
302 vector mat2[3];
303 vector projection_position = m_Projection.GetPosition();
304 vector normal;
305
306 if ( m_ContactDir.Length() > 0 )
307 {
308 normal = m_ContactDir;
309 }
310 else
311 {
312 normal = g_Game.SurfaceGetNormal( projection_position[0], projection_position[2] );
313 }
314
315 vector angles = normal.VectorToAngles();
316 angles[1] = angles[1] + 270;
317
318 angles[0] = Math.Clamp( angles[0], 0, 360 );
319 angles[1] = Math.Clamp( angles[1], 0, 360 );
320 angles[2] = Math.Clamp( angles[2], 0, 360 );
321
322 projection_orientation_angles[0] = projection_orientation_angles[0] + ( 360 - angles[0] );
323
324 Math3D.YawPitchRollMatrix( projection_orientation_angles, mat0 );
325 Math3D.YawPitchRollMatrix( angles, mat1 );
326 Math3D.MatrixMultiply3( mat1, mat0, mat2 );
327
328 y_p_r = Math3D.MatrixToAngles( mat2 );
329 }
330 else
331 {
333
334 if ( y_p_r[0] > 180 )
335 {
336 y_p_r[0] = y_p_r[0] - 360;
337 }
338
339 if ( y_p_r[0] < -180 )
340 {
341 y_p_r[0] = y_p_r[0] + 360;
342 }
343 }
344
345 return SmoothProjectionMovement( y_p_r, timeslice );
346 }
347
348 vector SmoothProjectionMovement( vector y_p_r, float timeslice )
349 {
350 if ( m_y_p_r_previous )
351 {
352 if ( Math.AbsFloat( y_p_r[0] - m_y_p_r_previous[0] ) > 100 )
353 {
354 if ( y_p_r[0] > 0 )
355 {
356 m_y_p_r_previous[0] = m_y_p_r_previous[0] + 360;
357 }
358
359 if ( y_p_r[0] < 0 )
360 {
362 }
363 }
364
365 y_p_r[0] = Math.Lerp( m_y_p_r_previous[0], y_p_r[0], 15 * timeslice );
366 y_p_r[1] = Math.Lerp( m_y_p_r_previous[1], y_p_r[1], 15 * timeslice );
367 y_p_r[2] = Math.Lerp( m_y_p_r_previous[2], y_p_r[2], 15 * timeslice );
368 }
369
370 m_y_p_r_previous = y_p_r;
371
372 return y_p_r;
373 }
374
376 {
377 Class.CastTo(m_ProjectionTrigger, g_Game.CreateObjectEx("ProjectionTrigger", GetProjectionPosition(), SPAWN_FLAGS));
378
380 m_ProjectionTrigger.SetParentObject(this);
381 m_ProjectionTrigger.SetParentOwner(m_Player);
382
384 }
385
387 {
388 vector min_max[2];
389 GetProjectionCollisionBox( min_max );
390
393 m_ProjectionTrigger.SetExtents(min_max[0], min_max[1]);
394 }
395
396 #ifdef DIAG_DEVELOPER
397 void DebugLog(string header, bool mustBeTrue = false, bool condition = true, string info = "")
398 {
399 if ( DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM) )
400 {
401 int color = 0xFFFFFFFF;
402
403 if (mustBeTrue && !condition || !mustBeTrue && condition)
404 color = COLOR_RED;
405
406 string text = header + condition + info;
407 DbgUI.ColoredText(color, text);
408 }
409 }
410
411 protected float m_PitchOverride;
412 protected float m_RollOverride;
413 void DebugConfigValues()
414 {
415 if ( DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM) )
416 {
417 m_PitchOverride = m_YawPitchRollLimit[1];
418 m_RollOverride = m_YawPitchRollLimit[2];
419
420 DbgUI.InputFloat("slopeTolerance override", m_SlopeTolerance);
421 DbgUI.SameLine();
422 DbgUI.InputFloat("pitch limit override", m_PitchOverride);
423 DbgUI.SameLine();
424 DbgUI.InputFloat("roll limit override", m_RollOverride);
425
426 m_YawPitchRollLimit[1] = m_PitchOverride;
427 m_YawPitchRollLimit[2] = m_RollOverride;
428 }
429 }
430 #endif
431
432 void EvaluateCollision(ItemBase action_item = null)
433 {
434 #ifdef DIAG_DEVELOPER
435 m_CollisionDetails = "";
436 #endif
437
438 if (!m_Player.CanPlaceItem(m_Projection))
439 {
440 #ifdef DIAG_DEVELOPER
441 m_CollisionDetails += "[Player]";
442 #endif
443 SetIsColliding(true);
444
445 }
447 {
448 SetIsColliding(true);
449 }
450 else if ( m_Projection.IsInherited( TrapSpawnBase ))
451 {
452 #ifdef DIAG_DEVELOPER
453 DebugLog("Inherits from TrapSpawnBase, checking IsPlaceableAtposition", true);
454 #endif
455
456 TrapSpawnBase trapSpawnBase;
457 Class.CastTo(trapSpawnBase, m_Projection);
458 SetIsColliding(!trapSpawnBase.IsPlaceableAtPosition(m_Projection.GetPosition()));
459 }
460 else if (m_Projection.IsInherited(TrapBase))
461 {
462 #ifdef DIAG_DEVELOPER
463 DebugLog("Inherits from TrapBase, checking IsPlaceableAtposition", true);
464 #endif
465 TrapBase trapBase;
466 Class.CastTo(trapBase, m_Projection);
467 SetIsColliding(!trapBase.IsPlaceableAtPosition(m_Projection.GetPosition()));
468 }
469 else
470 {
471 SetIsColliding(false);
472 }
473 }
474
476 {
478 return false;
479 if (g_Game.IsServer() && g_Game.IsMultiplayer())
480 return false;
481
482 //Some locations allow you to look up and attempt placing the hologram on the bottom side of a floor - most notably the floors of a watchtower
483 //This check also prevents some very unnatural placements
484
485 bool b1 = m_Projection.GetPosition()[1] > g_Game.GetCurrentCameraPosition()[1];
486 bool b2 = false;
487 #ifdef DIAG_DEVELOPER
488 vector from, to;
489 #endif
490 if (m_Projection.DoPlacingHeightCheck())
491 {
492 b2 = MiscGameplayFunctions.IsUnderRoofEx(m_Projection, GameConstants.ROOF_CHECK_RAYCAST_DIST, ObjIntersectFire);
493 #ifdef DIAG_DEVELOPER
494 MiscGameplayFunctions.IsUnderRoofFromToCalculation(m_Projection, from, to);
495 DrawArrow(from, to, !b2);
496 #endif
497 }
498
499 #ifdef DIAG_DEVELOPER
500 DebugLog("IsClippingRoof: ", false, b1, " | (projection height) " + m_Projection.GetPosition()[1] + " > (camera height) " + g_Game.GetCurrentCameraPosition()[1]);
501 DebugLog("IsClippingRoof: ", false, b2, " | (DoPlacingHeightCheck) " + m_Projection.DoPlacingHeightCheck() + " && (IsUnderRoof) " + MiscGameplayFunctions.IsUnderRoof(m_Projection) + " | from: " + from[1] + " | to: " + to[1]);
502 #endif
503
504 return b1 || b2;
505 }
506
508 {
510 return false;
511 vector projection_orientation = m_Projection.GetOrientation();
512 bool isTrue = Math.AbsFloat( projection_orientation[1] ) > m_YawPitchRollLimit[1] || Math.AbsFloat( projection_orientation[2] ) > m_YawPitchRollLimit[2];
513 #ifdef DIAG_DEVELOPER
514 DebugLog("IsCollidingAngle: ", false, isTrue, " | (proj pitch) " + Math.AbsFloat( projection_orientation[1] ) + " > (pitch limit) " + m_YawPitchRollLimit[1] + " | (proj roll) " + Math.AbsFloat( projection_orientation[2] ) + " > (roll limit) " + m_YawPitchRollLimit[2]);
515 #endif
516
517 return isTrue;
518 }
519
520 #ifdef DIAG_DEVELOPER
521 protected Shape m_CollisionBox;
522 protected void DrawDebugCollisionBox( vector min_max[2], int color )
523 {
524 vector mat[4];
525 m_Projection.GetTransform( mat );
526 m_CollisionBox = Debug.DrawBox( min_max[0], min_max[1], color );
527 m_CollisionBox.SetMatrix( mat );
528 }
529
530 protected void DestroyDebugCollisionBox()
531 {
532 if ( m_CollisionBox )
533 {
534 m_CollisionBox.Destroy();
535 m_CollisionBox = NULL;
536 }
537 }
538 #endif
539
540 bool IsCollidingBBox(ItemBase action_item = null)
541 {
543 return false;
544
545 vector center;
546 vector relativeOffset; //we need to lift BBox, because it is calculated from the bottom of projection, and not from the middle
547 vector absoluteOffset = "0 0.05 0"; //we need to lift BBox even more, because it colliddes with house floors due to various reasons (probably geometry or float imperfections)
548 vector orientation = GetProjectionOrientation();
549 vector edgeLength;
550 vector minMax[2];
551 array<Object> excludedObjects = new array<Object>();
552 array<Object> collidedObjects = new array<Object>();
553
555 relativeOffset[1] = (minMax[1][1] - minMax[0][1]) * 0.5;
556 center = m_Projection.GetPosition() + relativeOffset + absoluteOffset;
557 edgeLength = GetCollisionBoxSize(minMax);
558 excludedObjects.Insert(m_Projection);
559 excludedObjects.Insert(m_Player);
560
561 if (action_item)
562 excludedObjects.Insert(action_item);
563
564 //add is construction check
565 // Base building objects behave in a way that causes this test to generate false positives
566 bool isTrue = g_Game.IsBoxCollidingGeometry(center, orientation, edgeLength, ObjIntersectFire, ObjIntersectGeom, excludedObjects, collidedObjects);
567 #ifdef DIAG_DEVELOPER
568 if ( DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM) )
569 {
570 string text = "";
571 foreach (Object object: collidedObjects)
572 text += " | " + Object.GetDebugName(object);
573
574 DebugLog("IsCollidingBBox: ", false, isTrue, text);
575
576 int color = 0x01FFFFFF;
577 if (isTrue)
578 color = 0x33F22613;
579
580 if (m_CollisionBox)
582 DrawDebugCollisionBox(minMax, color);
583 }
584 #endif
585
586 return isTrue;
587 }
588
589 bool IsCollidingGeometryProxy(ItemBase action_item = null)
590 {
592 return false;
593
594 vector center;
595 vector relativeOffset; //we need to lift BBox, because it is calculated from the bottom of projection, and not from the middle
596 vector absoluteOffset = "0 0.05 0"; //we need to lift BBox even more, because it colliddes with house floors due to various reasons (probably geometry or float imperfections)
597 vector orientation = GetProjectionOrientation();
598 vector edgeLength;
599 vector minMax[2];
600 array<Object> excludedObjects = new array<Object>();
602
604 relativeOffset[1] = (minMax[1][1] - minMax[0][1]) * 0.5;
605 center = m_Projection.GetPosition() + relativeOffset + absoluteOffset;
606 edgeLength = GetCollisionBoxSize(minMax);
607 excludedObjects.Insert(m_Projection);
608 excludedObjects.Insert(m_Player);
609
610 if (action_item)
611 excludedObjects.Insert(action_item);
612
614 params.SetParams(center, orientation, edgeLength, ObjIntersect.View, ObjIntersect.Geom, false);
615 bool isTrue = g_Game.IsBoxCollidingGeometryProxy(params, excludedObjects, collidedObjects);
616 #ifdef DIAG_DEVELOPER
617 if (DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM))
618 {
619 string text = "";
620 foreach (BoxCollidingResult object: collidedObjects)
621 text += " | " + Object.GetDebugName(object.obj);
622
623 DebugLog("IsCollidingGeometryProxy: ", false, isTrue, text);
624
625 int color = 0x01FFFFFF;
626 if (isTrue)
627 color = 0x33F22613;
628
629 if (m_CollisionBox)
631 DrawDebugCollisionBox(minMax, color);
632 }
633 #endif
634
635 return isTrue;
636 }
637
639 {
640 //This function is not required to solve server-side fixes for clipping, saves calculations and potential false negatives
641 if (g_Game.IsServer() && g_Game.IsMultiplayer())
642 return true;
643
645 return true;
646
647
648
650 vector to_left_close_down = from_left_close + PLACEMENT_RC_END_OFFSET;
651
653 vector to_right_close_down = from_right_close + PLACEMENT_RC_END_OFFSET;
654
656 vector to_left_far_down = from_left_far + PLACEMENT_RC_END_OFFSET;
657
659 vector to_right_far_down = from_right_far + PLACEMENT_RC_END_OFFSET;
660
661 vector contact_pos_left_close;
662 vector contact_pos_right_close;
663 vector contact_pos_left_far;
664 vector contact_pos_right_far;
665 vector contact_dir_left_close;
666 vector contact_dir_right_close;
667 vector contact_dir_left_far;
668 vector contact_dir_right_far;
669 int contact_component_left_close;
670 int contact_component_right_close;
671 int contact_component_left_far;
672 int contact_component_right_far;
673 set<Object> results_left_close = new set<Object>;
674 set<Object> results_right_close = new set<Object>;
675 set<Object> results_left_far = new set<Object>;
676 set<Object> results_right_far = new set<Object>;
677 Object obj_left_close;
678 Object obj_right_close;
679 Object obj_left_far;
680 Object obj_right_far;
681
682 //Not sure what the intention here was before, but it boiled down to a very bloated version of what you see here right now
683 DayZPhysics.RaycastRV(from_left_close, to_left_close_down, contact_pos_left_close, contact_dir_left_close, contact_component_left_close, results_left_close, null, m_Projection, false, false, ObjIntersectFire);
684 if (results_left_close.Count() > 0)
685 obj_left_close = results_left_close[results_left_close.Count() - 1];
686
687 DayZPhysics.RaycastRV(from_right_close, to_right_close_down, contact_pos_right_close, contact_dir_right_close, contact_component_right_close, results_right_close, null, m_Projection, false, false, ObjIntersectFire);
688 if (results_right_close.Count() > 0)
689 obj_right_close = results_right_close[results_right_close.Count() - 1];
690
691 DayZPhysics.RaycastRV(from_left_far, to_left_far_down, contact_pos_left_far, contact_dir_left_far, contact_component_left_far, results_left_far, null, m_Projection, false, false, ObjIntersectFire);
692 if (results_left_far.Count() > 0)
693 obj_left_far = results_left_far[results_left_far.Count() - 1];
694
695 DayZPhysics.RaycastRV(from_right_far, to_right_far_down, contact_pos_right_far, contact_dir_right_far, contact_component_right_far, results_right_far, null, m_Projection, false, false, ObjIntersectFire);
696 if (results_right_far.Count() > 0)
697 obj_right_far = results_right_far[results_right_far.Count() - 1];
698
699 return IsBaseIntact(obj_left_close, obj_right_close, obj_left_far, obj_right_far ) && IsBaseStatic( obj_left_close ) && IsBaseFlat( contact_pos_left_close, contact_pos_right_close, contact_pos_left_far, contact_pos_right_far);
700 }
701
703 {
705 return false;
706
707 #ifdef DIAG_DEVELOPER
708 DebugLog("IsCollidingGPlot: ", false, m_IsCollidingGPlot);
709 #endif
710
711 return m_IsCollidingGPlot;
712 }
713
715 {
716 vector origin = Vector(0, 0, 0);
717 bool isTrue = GetProjectionPosition() == origin;
718 #ifdef DIAG_DEVELOPER
719 DebugLog("IsCollidingZeroPos: ", false, isTrue);
720 #endif
721
722 return isTrue;
723 }
724
727 {
728 ErrorEx("Deprecated check - do not use", ErrorExSeverity.WARNING);
729 return false;
730 }
731
732 //This function only takes one of the found objects since IsBaseIntact already verifies that all of them are either null or the same object
733 bool IsBaseStatic( Object objectToCheck )
734 {
735 //check if the object below hologram is dynamic object. Dynamic objects like barrels can be taken to hands
736 //and item which had been placed on top of them, would stay floating in the air
737 #ifdef DIAG_DEVELOPER
738 if (objectToCheck == null)
739 DebugLog("IsBaseStatic(must be true): ", true, true, " | objectToCheck is null (this is good)");
740 else
741 DebugLog("IsBaseStatic(must be true): ", true, IsObjectStatic(objectToCheck));
742 #endif
743 return objectToCheck == null || IsObjectStatic(objectToCheck);
744 }
745
747 {
748 return obj.IsBuilding() || obj.IsPlainObject() || (!m_Parent.IsInherited(KitBase) && obj.IsInherited(BaseBuildingBase) && (m_WatchtowerBlockedComponentNames.Find(obj.GetActionComponentName(m_ContactComponent, LOD.NAME_VIEW)) == -1));
749 }
750
751 bool IsBaseIntact( Object under_left_close, Object under_right_close, Object under_left_far, Object under_right_far )
752 {
753 bool isTrue = (under_left_close == under_right_close && under_right_close == under_left_far && under_left_far == under_right_far);
754 #ifdef DIAG_DEVELOPER
755 DebugLog("IsBaseIntact(must be true and all equal): ", true, isTrue, " | ulc: " + Object.GetDebugName(under_left_close) + " | urc: " + Object.GetDebugName(under_right_close) + " | ulf: " + Object.GetDebugName(under_left_far) + " | urf: " + Object.GetDebugName(under_right_far));
756 if (!isTrue)
757 {
758 array<bool> conditions = new array<bool>();
759 conditions.Insert(under_left_close == null);
760 conditions.Insert(under_right_close == null);
761 conditions.Insert(under_left_far == null);
762 conditions.Insert(under_right_far == null);
763
764 int amountOfNull = 0;
765 if (!under_left_close)
766 ++amountOfNull;
767 if (!under_right_close)
768 ++amountOfNull;
769 if (!under_left_far)
770 ++amountOfNull;
771 if (!under_right_far)
772 ++amountOfNull;
773
774 if ( amountOfNull < 3 )
775 for ( int i = 0; i < conditions.Count(); ++i)
776 conditions[i] = !conditions[i];
777
778 DrawBaseSpheres(conditions);
779 }
780 #endif
781
782 return isTrue;
783 }
784
785 #ifdef DIAG_DEVELOPER
786 void DrawArrow(vector from, vector to, bool condition)
787 {
788 if ( DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM) )
789 {
790 int color = 0xFFFFFFFF;
791 if (!condition)
792 color = COLOR_RED;
793
794 Debug.DrawArrow(from, to, 1, color, ShapeFlags.ONCE);
795 }
796 }
797
798 void DrawSphere(vector pos, bool condition)
799 {
800 if ( DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM) )
801 {
802 int color = 0x01FFFFFF;
803 if (!condition)
804 color = 0x99F22613;
805
806 Debug.DrawSphere(pos, 1, color, ShapeFlags.ONCE|ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE);
807 }
808 }
809
810 void DrawBaseSpheres(array<bool> conditions)
811 {
812 if ( DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM) )
813 {
814 array<vector> positions = new array<vector>();
815 positions.Insert(m_Projection.CoordToParent( GetLeftCloseProjectionVector() ));
816 positions.Insert(m_Projection.CoordToParent( GetRightCloseProjectionVector() ));
817 positions.Insert(m_Projection.CoordToParent( GetLeftFarProjectionVector() ));
818 positions.Insert(m_Projection.CoordToParent( GetRightFarProjectionVector() ));
819
820 for (int i = 0; i < positions.Count(); ++i)
821 DrawSphere(positions[i], conditions[i]);
822 }
823 }
824
825 void DrawDebugArrow(float start, float dist, int color = 0xFF1FFFFF)
826 {
827 if ( DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM) )
828 {
829 vector from = m_Player.GetPosition() + start * MiscGameplayFunctions.GetHeadingVector(m_Player);
830 vector to = m_Player.GetPosition() + dist * MiscGameplayFunctions.GetHeadingVector(m_Player);
831
832 Debug.DrawArrow(from, to, 0.5, 0xFF1FFFFF, ShapeFlags.ONCE|ShapeFlags.TRANSP);
833 }
834 }
835 #endif
836
837 bool IsBaseFlat( vector contact_pos_left_close, vector contact_pos_right_close, vector contact_pos_left_far, vector contact_pos_right_far )
838 {
839 vector projection_pos = GetProjectionPosition();
840 float slope_pos_left_close = Math.AbsFloat(projection_pos[1] - contact_pos_left_close[1]);
841 float slope_pos_right_close = Math.AbsFloat(projection_pos[1] - contact_pos_right_close[1]);
842 float slope_pos_left_far = Math.AbsFloat(projection_pos[1] - contact_pos_left_far[1]);
843 float slope_pos_right_far = Math.AbsFloat(projection_pos[1] - contact_pos_right_far[1]);
844
845 bool isTrue = slope_pos_left_close < m_SlopeTolerance && slope_pos_right_close < m_SlopeTolerance && slope_pos_left_far < m_SlopeTolerance && slope_pos_right_far < m_SlopeTolerance;
846 #ifdef DIAG_DEVELOPER
847 DebugLog("IsBaseFlat(must be true): ", true, isTrue, " (slope < slopeTolerance) | slopeTolerance: " + m_SlopeTolerance + " | lc: " + slope_pos_left_close + " | rc: " + slope_pos_right_close + " | lf: " + slope_pos_left_far + " | rf: " + slope_pos_right_far);
848 DrawArrow(projection_pos, contact_pos_left_close, slope_pos_left_close < m_SlopeTolerance);
849 DrawArrow(projection_pos, contact_pos_right_close, slope_pos_right_close < m_SlopeTolerance);
850 DrawArrow(projection_pos, contact_pos_left_far, slope_pos_left_far < m_SlopeTolerance);
851 DrawArrow(projection_pos, contact_pos_right_far, slope_pos_right_far < m_SlopeTolerance);
852 #endif
853
854 return isTrue;
855 }
856
859 {
861 return true;
862
863 bool isTrue = m_Parent && m_Parent.CanBePlaced(m_Player, GetProjectionPosition());
864
865 #ifdef DIAG_DEVELOPER
866 DebugLog("IsPlacementPermitted(must be true): ", true, isTrue, " (Note: ItemBase::CanBePlaced() return value)");
867 #endif
868 return isTrue;
869 }
870
873 {
875 return true;
876 if ( GetProjectionEntity() ) //simple height check
877 {
878 vector playerpos = m_Player.GetPosition();
879 vector projectionpos = GetProjectionPosition();
880 float delta1 = playerpos[1] - projectionpos[1];
881
883 {
884 #ifdef DIAG_DEVELOPER
885 DebugLog("HeightPlacementCheck(must be true): ", true, false, " | Height difference between item and player is larger than " + DEFAULT_MAX_PLACEMENT_HEIGHT_DIFF);
886 #endif
887 return false;
888 }
889 }
890 #ifdef DIAG_DEVELOPER
891 DebugLog("HeightPlacementCheck(must be true): ", true, true);
892 #endif
893 return true;
894 }
895
897 {
899 return false;
900 // Fast check middle of object
901 string type;
902 int liquid;
903 g_Game.SurfaceUnderObjectCorrectedLiquid(m_Projection, type, liquid);
904
905 if (liquid & (LIQUID_GROUP_WATER - LIQUID_SNOW))
906 {
907 #ifdef DIAG_DEVELOPER
908 DebugLog("IsUnderwater: ", false, true, " | Surface under object is water");
909 #endif
910 return true;
911 }
912
913 // Check every corner of the object
914 vector left_close = m_Projection.CoordToParent( GetLeftCloseProjectionVector() );
915 vector right_close = m_Projection.CoordToParent( GetRightCloseProjectionVector() );
916 vector left_far = m_Projection.CoordToParent( GetLeftFarProjectionVector() );
917 vector right_far = m_Projection.CoordToParent( GetRightFarProjectionVector() );
918 float maxSea = g_Game.SurfaceGetSeaLevelMax() + 0.03;
919 bool belowMaxSea = left_close[1] < maxSea || right_close[1] < maxSea || left_far[1] < maxSea || right_far[1] < maxSea;
920
921 #ifdef DIAG_DEVELOPER
922 // I'd rather duplicate this on internal than introduce (even) more raycasts than needed on retail..
923 float lc = g_Game.GetWaterDepth(left_close);
924 float rc = g_Game.GetWaterDepth(right_close);
925 float lf = g_Game.GetWaterDepth(left_far);
926 float rf = g_Game.GetWaterDepth(right_far);
927 bool isTrue = (lc > 0 || rc > 0 || lf > 0 || rf > 0 || belowMaxSea);
928 DebugLog("IsUnderwater: ", false, isTrue, " belowMaxSea: " + belowMaxSea + " | (all must be less than zero) | lc: " + lc + " | rc: " + rc + " | lf: " + lf + " | rf: " + rf);
929 //DebugLog("Corner Height: ", false, true, " lc: " + left_close[1] + " | rc: " + right_close[1] + " | lf: " + left_far[1] + " | rf: " + right_far[1]);
930 if (isTrue)
931 {
932 array<bool> conditions = {lc <= 0, rc <= 0, lf <= 0, rf <= 0};
933 DrawBaseSpheres(conditions);
934 }
935 #endif
936
937 return (belowMaxSea || g_Game.GetWaterDepth(left_close) > 0 || g_Game.GetWaterDepth(right_close) > 0 || g_Game.GetWaterDepth(left_far) > 0 || g_Game.GetWaterDepth(right_far) > 0);
938 }
939
941 {
943 return false;
944 vector fromHeightOffset = "0 0.3 0";
945 vector toHeightOffset = "0 1 0";
946
947 vector from_left_close = m_Projection.CoordToParent( GetLeftCloseProjectionVector() ) + fromHeightOffset;
948 vector to_left_close_down = from_left_close + toHeightOffset;
949
950 vector from_right_close = m_Projection.CoordToParent( GetRightCloseProjectionVector() ) + fromHeightOffset;
951 vector to_right_close_down = from_right_close + toHeightOffset;
952
953 vector from_left_far = m_Projection.CoordToParent( GetLeftFarProjectionVector() ) + fromHeightOffset;
954 vector to_left_far_down = from_left_far + toHeightOffset;
955
956 vector from_right_far = m_Projection.CoordToParent( GetRightFarProjectionVector() ) + fromHeightOffset;
957 vector to_right_far_down = from_right_far + toHeightOffset;
958
959 vector contact_pos_left_close;
960 vector contact_pos_right_close;
961 vector contact_pos_left_far;
962 vector contact_pos_right_far;
963
964 vector contact_dir_left_close;
965 vector contact_dir_right_close;
966 vector contact_dir_left_far;
967 vector contact_dir_right_far;
968
969 int contact_component_left_close;
970 int contact_component_right_close;
971 int contact_component_left_far;
972 int contact_component_right_far;
973
974 #ifdef DIAG_DEVELOPER
975 // I'd rather duplicate this on internal than introduce (even) more raycasts than needed on retail..
976 set<Object> lcO = new set<Object>();
977 set<Object> rcO = new set<Object>();
978 set<Object> lfO = new set<Object>();
979 set<Object> rfO = new set<Object>();
980 bool lc = DayZPhysics.RaycastRV( from_left_close, to_left_close_down, contact_pos_left_close, contact_dir_left_close, contact_component_left_close, lcO, m_Projection, m_Projection, false, true, ObjIntersectFire );
981 bool rc = DayZPhysics.RaycastRV( from_right_close, to_right_close_down, contact_pos_right_close, contact_dir_right_close, contact_component_right_close, rcO, m_Projection, m_Projection, false, true, ObjIntersectFire );
982 bool lf = DayZPhysics.RaycastRV( from_left_far, to_left_far_down, contact_pos_left_far, contact_dir_left_far, contact_component_left_far, lfO, m_Projection, m_Projection, false, true, ObjIntersectFire );
983 bool rf = DayZPhysics.RaycastRV( from_right_far, to_right_far_down, contact_pos_right_far, contact_dir_right_far, contact_component_right_far, rfO, m_Projection, m_Projection, false, true, ObjIntersectFire );
984 bool isTrue = ( lc || rc || lf || rf );
985 string text = "";
986 if (isTrue)
987 {
988 if (lc)
989 text += " | lc";
990 if (rc)
991 text += " | rc";
992 if (lf)
993 text += " | lf";
994 if (rf)
995 text += " | rf";
996
997 if (lcO.Count() > 0)
998 text += " | lcO: " + lcO[0];
999 if (rcO.Count() > 0)
1000 text += " | rcO: " + rcO[0];
1001 if (lfO.Count() > 0)
1002 text += " | lfO: " + lfO[0];
1003 if (rfO.Count() > 0)
1004 text += " | rfO: " + rfO[0];
1005
1006 array<bool> conditions = {!lc, !rc, !lf, !rf};
1007 DrawBaseSpheres(conditions);
1008 }
1009 DebugLog("IsInTerrain: ", false, isTrue, text);
1010 #endif
1011
1012 if (DayZPhysics.RaycastRV( from_left_close, to_left_close_down, contact_pos_left_close, contact_dir_left_close, contact_component_left_close, NULL, m_Projection, m_Projection, false, true, ObjIntersectFire ))
1013 return true;
1014
1015 if (DayZPhysics.RaycastRV( from_right_close, to_right_close_down, contact_pos_right_close, contact_dir_right_close, contact_component_right_close, NULL,m_Projection, m_Projection, false, true, ObjIntersectFire ))
1016 return true;
1017
1018 if (DayZPhysics.RaycastRV( from_left_far, to_left_far_down, contact_pos_left_far, contact_dir_left_far, contact_component_left_far, NULL, m_Projection, m_Projection, false, true, ObjIntersectFire ))
1019 return true;
1020
1021 if (DayZPhysics.RaycastRV( from_right_far, to_right_far_down, contact_pos_right_far, contact_dir_right_far, contact_component_right_far, NULL, m_Projection, m_Projection, false, true, ObjIntersectFire ))
1022 return true;
1023
1024 return false;
1025 }
1026
1028 {
1029 //in range of its power source.
1030 if (m_Player && m_Parent && m_Parent.HasEnergyManager() && m_Parent.GetCompEM().IsPlugged())
1031 {
1032 // Unplug the device when the player is too far from the power source.
1033 m_Parent.GetCompEM().UpdatePlugState();
1034
1035 // Delete local hologram when plug is rippled out and advanced placement is active
1036 if (g_Game.IsMultiplayer() && g_Game.IsClient())
1037 {
1038 if (!m_Parent.GetCompEM().IsPlugged())
1039 m_Player.TogglePlacingLocal();
1040 }
1041 }
1042 }
1043
1044 EntityAI PlaceEntity( EntityAI entity_for_placing )
1045 {
1046 //string-based comparison
1047 if (entity_for_placing.IsInherited(TentBase) || entity_for_placing.IsBasebuildingKit() )
1048 {
1049 return entity_for_placing;
1050 }
1051
1052 if (m_Projection.IsInherited(GardenPlotPlacing))
1053 {
1054 Class.CastTo(entity_for_placing, g_Game.CreateObjectEx( "GardenPlot", m_Projection.GetPosition(), ECE_OBJECT_SWAP ));
1055 return entity_for_placing;
1056 }
1057
1058 //inheritance comparison
1059 if( !GetProjectionEntity().IsKindOf( m_Parent.GetType() ))
1060 {
1061 Class.CastTo(entity_for_placing, g_Game.CreateObjectEx( m_Projection.GetType(), m_Projection.GetPosition(), ECE_OBJECT_SWAP ));
1062 }
1063
1064 return entity_for_placing;
1065 }
1066
1067 protected void GetProjectionCollisionBox( out vector min_max[2] )
1068 {
1069 if (!m_Projection.GetCollisionBox( min_max ) && m_Projection.MemoryPointExists("box_placing_min"))
1070 {
1071 min_max[0] = m_Projection.GetMemoryPointPos( "box_placing_min" );
1072 min_max[1] = m_Projection.GetMemoryPointPos( "box_placing_max" );
1073 //Debug.DrawSphere(m_Projection.ModelToWorld(min_max[0]) , 0.8,Colors.RED, ShapeFlags.ONCE);
1074 //Debug.DrawSphere(m_Projection.ModelToWorld(min_max[1]), 0.8,Colors.RED, ShapeFlags.ONCE);
1075 }
1076 }
1077
1078 protected vector GetCollisionBoxSize( vector min_max[2] )
1079 {
1080 vector box_size = Vector(1,1,1);
1081
1082 box_size[0] = min_max[1][0] - min_max[0][0];
1083 box_size[2] = min_max[1][2] - min_max[0][2];
1084 box_size[1] = min_max[1][1] - min_max[0][1];
1085
1086 return box_size;
1087 }
1088
1090 {
1091 vector min_max[2];
1092 GetProjectionCollisionBox( min_max );
1093
1094 return min_max[0];
1095 }
1096
1098 {
1099 vector min_max[2];
1100 GetProjectionCollisionBox( min_max );
1101 min_max[1][1] = min_max[0][1];
1102 min_max[1][2] = min_max[0][2];
1103
1104 return min_max[1];
1105 }
1106
1108 {
1109 vector min_max[2];
1110 GetProjectionCollisionBox( min_max );
1111 min_max[0][2] = min_max[1][2];
1112
1113 return min_max[0];
1114 }
1115
1117 {
1118 vector min_max[2];
1119 GetProjectionCollisionBox( min_max );
1120 min_max[1][1] = min_max[0][1];
1121
1122 return min_max[1];
1123 }
1124
1125 // Replaced by IsUnderwater, currently unused
1126 bool IsSurfaceWater( vector position )
1127 {
1128 return g_Game.SurfaceIsSea( position[0], position[2] ) || g_Game.SurfaceIsPond( position[0], position[2] );
1129 }
1130
1131 bool IsSurfaceSea( vector position )
1132 {
1133 return g_Game.SurfaceIsSea( position[0], position[2] );
1134 }
1135
1137 {
1138 float minProjectionDistance;
1139 float maxProjectionDistance;
1141 vector minMax[2];
1142 float projectionRadius = GetProjectionRadius();
1143 float cameraToPlayerDistance = vector.Distance(g_Game.GetCurrentCameraPosition(), player.GetPosition());
1144
1145 if (projectionRadius < SMALL_PROJECTION_RADIUS) // objects with radius smaller than 1m
1146 {
1147 minProjectionDistance = SMALL_PROJECTION_RADIUS;
1148 maxProjectionDistance = SMALL_PROJECTION_RADIUS * 2;
1149 }
1150 else
1151 {
1152 minProjectionDistance = projectionRadius;
1153 maxProjectionDistance = projectionRadius * 2;
1154 maxProjectionDistance = Math.Clamp(maxProjectionDistance, SMALL_PROJECTION_RADIUS, LARGE_PROJECTION_DISTANCE_LIMIT);
1155 }
1156
1157 vector from = g_Game.GetCurrentCameraPosition();
1158 vector to = from + (g_Game.GetCurrentCameraDirection() * (maxProjectionDistance + cameraToPlayerDistance));
1159 vector contactPosition;
1160 set<Object> hitObjects = new set<Object>();
1161
1162 DayZPhysics.RaycastRV(from, to, contactPosition, m_ContactDir, m_ContactComponent, hitObjects, player, m_Projection, false, false, ObjIntersectFire);
1163
1164 bool contactHitProcessed = false;
1167 {
1168 if (hitObjects.Count() > 0)
1169 {
1170 if (hitObjects[0].IsInherited(Watchtower))
1171 {
1172 contactHitProcessed = true;
1173 contactPosition = CorrectForWatchtower(m_ContactComponent, contactPosition, player, hitObjects[0]);
1174 }
1175
1176 if (!contactHitProcessed && hitObjects[0].IsInherited(InventoryItem))
1177 contactPosition = hitObjects[0].GetPosition();
1178 }
1179 }
1180
1181 static const float raycastOriginOffsetOnFail = 0.25;
1182 static const float minDistFromStart = 0.01;
1183 // Camera isn't correctly positioned in some cases, leading to raycasts hitting the object directly behind the camera
1184 if ((hitObjects.Count() > 0) && (vector.DistanceSq(from, contactPosition) < minDistFromStart))
1185 {
1186 from = contactPosition + g_Game.GetCurrentCameraDirection() * raycastOriginOffsetOnFail;
1187 DayZPhysics.RaycastRV(from, to, contactPosition, m_ContactDir, m_ContactComponent, hitObjects, player, m_Projection, false, false, ObjIntersectFire);
1188 }
1189
1190 bool isFloating = SetHologramPosition(player.GetPosition(), minProjectionDistance, maxProjectionDistance, contactPosition);
1191 SetIsFloating(isFloating);
1192
1193 #ifdef DIAG_DEVELOPER
1194 DrawDebugArrow(minProjectionDistance, maxProjectionDistance);
1195 if (DiagMenu.GetBool(DiagMenuIDs.MISC_HOLOGRAM))
1196 {
1197 Debug.DrawSphere(GetProjectionPosition(), 0.1, 0x99FF0000, ShapeFlags.ONCE|ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE);
1198 }
1199 #endif
1200
1201 m_FromAdjusted = from;
1202
1203 return contactPosition;
1204 }
1205
1214 protected bool SetHologramPosition(vector startPosition, float minProjectionDistance, float maxProjectionDistance, inout vector contactPosition)
1215 {
1216 float playerToProjectionDistance = vector.Distance(startPosition, contactPosition);
1217 vector playerToProjection;
1218
1219 #ifdef DIAG_DEVELOPER
1220 DebugLog("SetHologramPosition::startPosition: ", false, m_IsHidden, string.Format(" | %1", startPosition));
1221 DebugLog("SetHologramPosition::contactPosition [in]: ", false, m_IsHidden, string.Format(" | %1", contactPosition));
1222 DebugLog("SetHologramPosition::minProjectionDistance: ", false, m_IsHidden, string.Format(" | %1", minProjectionDistance));
1223 DebugLog("SetHologramPosition::maxProjectionDistance: ", false, m_IsHidden, string.Format(" | %1", maxProjectionDistance));
1224 DebugLog("SetHologramPosition::playerToProjectionDistance: ", false, m_IsHidden, string.Format(" | %1", playerToProjectionDistance));
1225 #endif
1226
1227 //hologram is at min distance from player
1228 if (playerToProjectionDistance <= minProjectionDistance)
1229 {
1230 playerToProjection = contactPosition - startPosition;
1231 playerToProjection.Normalize();
1232 //prevents the hologram to go underground/floor while hologram exceeds minProjectionDistance
1233 playerToProjection[1] = playerToProjection[1] + PROJECTION_TRANSITION_MIN;
1234
1235 contactPosition = startPosition + (playerToProjection * minProjectionDistance);
1236
1237 #ifdef DIAG_DEVELOPER
1238 DebugLog("SetHologramPosition::contactPosition[out] (< minProjectDistance): ", false, m_IsHidden, string.Format(" | %1", contactPosition));
1239 #endif
1240
1241 return true;
1242 }
1243 //hologram is at max distance from player
1244 else if (playerToProjectionDistance >= maxProjectionDistance)
1245 {
1246 playerToProjection = contactPosition - startPosition;
1247 playerToProjection.Normalize();
1248 //prevents the hologram to go underground/floor while hologram exceeds maxProjectionDistance
1249 playerToProjection[1] = playerToProjection[1] + PROJECTION_TRANSITION_MAX;
1250
1251 contactPosition = startPosition + (playerToProjection * maxProjectionDistance);
1252
1253 #ifdef DIAG_DEVELOPER
1254 DebugLog("SetHologramPosition::contactPosition[out] (< maxProjectionDistance): ", false, m_IsHidden, string.Format(" | %1", contactPosition));
1255 #endif
1256
1257 return true;
1258 }
1259
1260 return false;
1261 }
1262
1264 {
1265 return m_Parent.IsBasebuildingKit() || m_Parent.IsInherited(TentBase);
1266 }
1267
1268 vector CorrectForWatchtower(int contactComponent, vector contactPos, PlayerBase player, Object hitObject)
1269 {
1270 // Raycast has hit one of the trigger boxes that show construction prompts, so projection would be floating in the air without this correction
1271 if (m_WatchtowerIgnoreComponentNames.Find(hitObject.GetActionComponentName(contactComponent, LOD.NAME_VIEW)) != -1 )
1272 contactPos[1] = hitObject.GetActionComponentPosition(contactComponent, LOD.NAME_VIEW)[1];
1273
1274 return contactPos;
1275 }
1276
1277 //This function is currently unused
1279 {
1280 return m_Projection.IsInherited( TrapBase ) || m_Projection.IsInherited( TrapSpawnBase );
1281 }
1282
1284 {
1285 float diameter;
1286 float radius;
1287 vector diagonal;
1288 vector min_max[2];
1289
1290 GetProjectionCollisionBox( min_max );
1291 diagonal = GetCollisionBoxSize( min_max );
1292 diameter = diagonal.Length();
1293
1294 return diameter;
1295 }
1296
1298 {
1299 float diameter;
1300 float radius;
1301 vector diagonal;
1302 vector min_max[2];
1303
1304 GetProjectionCollisionBox( min_max );
1305 diagonal = GetCollisionBoxSize( min_max );
1306 diameter = diagonal.Length();
1307 radius = diameter / 2;
1308
1309 return radius;
1310 }
1311
1312 void SetUpdatePosition( bool state )
1313 {
1314 m_UpdatePosition = state;
1315 }
1316
1318 {
1319 return m_UpdatePosition;
1320 }
1321
1323 {
1324 return m_Parent;
1325 }
1326
1328 {
1329 m_Projection = projection;
1330 }
1331
1333 {
1334 return m_Projection;
1335 }
1336
1337 void SetIsFloating( bool is_floating )
1338 {
1339 m_IsFloating = is_floating;
1340 }
1341
1342 void SetIsColliding( bool is_colliding )
1343 {
1344 #ifdef DIAG_DEVELOPER
1345 DebugLog("Is colliding: ", false, is_colliding, m_CollisionDetails);
1346 #endif
1347 m_IsColliding = is_colliding;
1348 }
1349
1350 void SetIsHidden( bool is_hidden )
1351 {
1352 m_IsHidden = is_hidden;
1353 }
1354
1355 void SetIsCollidingPlayer( bool is_colliding )
1356 {
1357 m_IsCollidingPlayer = is_colliding;
1358 }
1359
1360 void SetIsCollidingGPlot( bool is_colliding_gplot )
1361 {
1362 m_IsCollidingGPlot = is_colliding_gplot;
1363 }
1364
1366 {
1367 #ifdef DIAG_DEVELOPER
1368 DebugLog("IsFloating: ", false, m_IsFloating);
1369 #endif
1370 return m_IsFloating;
1371 }
1372
1374 {
1375 return m_IsColliding;
1376 }
1377
1379 {
1380 #ifdef DIAG_DEVELOPER
1381 DebugLog("IsHidden: ", false, m_IsHidden);
1382 #endif
1383 return m_IsHidden;
1384 }
1385
1387 {
1389 return false;
1390 #ifdef DIAG_DEVELOPER
1391 DebugLog("IsCollidingPlayer: ", false, m_IsCollidingPlayer);
1392 #endif
1393 return m_IsCollidingPlayer;
1394 }
1395
1397 {
1398 m_Projection.SetPosition( position );
1399
1400 if (IsFloating())
1401 {
1402 m_Projection.SetPosition(SetOnGround(position));
1403 }
1404 }
1405
1407 {
1408 m_Projection.SetOrientation(orientation);
1409 }
1410
1412 {
1413 return m_Rotation;
1414 }
1415
1416 void AddProjectionRotation( float addition )
1417 {
1418 m_Rotation[0] = m_Rotation[0] + addition;
1419 }
1420
1421 void SubtractProjectionRotation( float subtraction )
1422 {
1423 m_Rotation[0] = m_Rotation[0] - subtraction;
1424 }
1425
1427 {
1428 vector from = position;
1429 vector ground;
1430 vector player_to_projection_vector;
1431 float projection_diameter = GetProjectionDiameter();
1432
1433 ground = Vector(0, -Math.Max(projection_diameter, SMALL_PROJECTION_GROUND), 0);
1434
1435 vector to = from + ground;
1436 vector contact_pos = to;
1437
1438 RaycastRVParams rayInput = new RaycastRVParams(from, to, m_Projection);
1439 rayInput.flags = CollisionFlags.ALLOBJECTS;
1441
1442 if (DayZPhysics.RaycastRVProxy(rayInput, results))
1443 {
1444 RaycastRVResult res;
1445 for (int i = 0; i < results.Count(); i++)
1446 {
1447 res = results.Get(i);
1448 if (res.entry || (!res.obj && !res.parent))
1449 {
1450 contact_pos = res.pos;
1451 break;
1452 }
1453 }
1454 }
1455
1456 //LOS check
1457 if (contact_pos != "0 0 0")
1458 {
1459 vector check_pos;
1460 vector check_dir;
1461 int check_component = -1;
1462 set<Object> hit_object = new set<Object>;
1463 to = contact_pos;
1464 to[1] = to[1] + 0.1;
1465 from = m_FromAdjusted;
1466
1467 if (DayZPhysics.RaycastRV(from, to, check_pos, check_dir, check_component, hit_object, null, m_Player, false, false, ObjIntersectFire))
1468 {
1469 if ((hit_object.Count() > 0)&& (!hit_object[0].IsInherited(Watchtower) || (hit_object[0].IsInherited(Watchtower) && (m_WatchtowerIgnoreComponentNames.Find(hit_object[0].GetActionComponentName(check_component, LOD.NAME_VIEW)) == -1))))
1470 {
1471 contact_pos = "0 0 0";
1472 }
1473 }
1474 }
1475
1476 HideWhenClose(contact_pos);
1477
1478 return contact_pos;
1479 }
1480
1482 {
1483 //if the hologram is too close to player when he looks to the sky, send the projection to away
1484 vector cam_dir = g_Game.GetCurrentCameraDirection();
1485
1486 if( cam_dir[1] > LOOKING_TO_SKY )
1487 {
1488 pos = "0 0 0";
1489 }
1490
1491 return pos;
1492 }
1493
1495 {
1496 if (m_Projection)
1497 return m_Projection.GetPosition();
1498
1499 return vector.Zero;
1500 }
1501
1503 {
1504 if (m_Projection)
1505 return m_Projection.GetOrientation();
1506
1507 return vector.Zero;
1508 }
1509
1511 {
1512 m_DefaultOrientation = g_Game.GetCurrentCameraDirection().VectorToAngles();
1513 m_DefaultOrientation[1] = 0;
1514
1515 if (!GetParentEntity().PlacementCanBeRotated())
1516 {
1518 }
1519
1520 return m_DefaultOrientation;
1521 }
1522
1523 int GetHiddenSelection( string selection )
1524 {
1525 int idx = m_Projection.GetHiddenSelectionIndex(selection);
1526
1527 if ( idx != -1 )
1528 return idx;
1529 else
1530 return 0;
1531 }
1532
1533 // the function accepts string
1534 void SetSelectionToRefresh( string selection )
1535 {
1536 m_SelectionsToRefresh.Insert( selection );
1537 }
1538
1539 //overloaded function to accept array of strings
1541 {
1542 foreach (string s : selection)
1543 m_SelectionsToRefresh.Insert(s);
1544 }
1545
1547 {
1548 if (m_Projection)
1549 {
1550 static const string textureName = "#(argb,8,8,3)color(0.5,0.5,0.5,0.75,ca)";
1551
1552 int hidden_selection = 0;
1553 string selection_to_refresh;
1554 string config_material = string.Format("CfgVehicles %1 hologramMaterial", m_Projection.GetType());
1555 string hologram_material = g_Game.ConfigGetTextOut(config_material);
1556 string config_model = string.Format("CfgVehicles %1 hologramMaterialPath", m_Projection.GetType());
1557 string hologram_material_path = string.Format("%1\\%2%3", g_Game.ConfigGetTextOut(config_model), hologram_material, CorrectMaterialPathName());
1558
1559 for (int i = 0; i < m_SelectionsToRefresh.Count(); ++i)
1560 {
1561 selection_to_refresh = m_SelectionsToRefresh.Get(i);
1562 hidden_selection = GetHiddenSelection(selection_to_refresh);
1563 m_Projection.SetObjectTexture(hidden_selection, textureName);
1564 m_Projection.SetObjectMaterial(hidden_selection, hologram_material_path);
1565 }
1566 }
1567 }
1568
1569 // Returns correct string to append to material path name
1571 {
1572 if (IsColliding() || IsFloating())
1573 {
1575 }
1576 else if (m_Parent.HasEnergyManager())
1577 {
1578 ComponentEnergyManager comp_em = m_Parent.GetCompEM();
1579 string SEL_CORD_PLUGGED = m_Parent.GetCompEM().SEL_CORD_PLUGGED;
1580 string SEL_CORD_FOLDED = m_Parent.GetCompEM().SEL_CORD_FOLDED;
1581
1582 if (comp_em.IsPlugged() && comp_em.IsEnergySourceAtReach(GetProjectionPosition()))
1583 {
1584 m_Projection.SetAnimationPhase(SEL_CORD_PLUGGED, 0);
1585 m_Projection.SetAnimationPhase(SEL_CORD_FOLDED, 1);
1587 }
1588 else
1589 {
1590 m_Projection.SetAnimationPhase(SEL_CORD_PLUGGED, 1);
1591 m_Projection.SetAnimationPhase(SEL_CORD_FOLDED, 0);
1592 }
1593 }
1594
1596 }
1597
1599 {
1600 if (m_Player.IsJumpInProgress())
1601 return true;
1602 if (m_Player.IsSwimming())
1603 return true;
1604 if (m_Player.IsClimbingLadder())
1605 return true;
1606 if (m_Player.IsRaised())
1607 return true;
1608 if (m_Player.IsClimbing())
1609 return true;
1610 if (m_Player.IsRestrained())
1611 return true;
1612 if (m_Player.IsUnconscious())
1613 return true;
1614
1615 return false;
1616 }
1617};
1618
1619class ProjectionTrigger extends Trigger
1620{
1621 protected int m_TriggerUpdateMs;
1624
1625 override void OnEnter( Object obj )
1626 {
1627 //Print("OnEnter");
1628 if ( m_ParentObj )
1629 {
1630 m_ParentObj.SetIsCollidingPlayer( true );
1631 m_TriggerUpdateMs = 50;
1632 }
1633 }
1634
1635 override void OnLeave( Object obj )
1636 {
1637 //Print("OnLeave");
1638 if ( m_ParentObj )
1639 {
1640 m_ParentObj.SetIsCollidingPlayer( false );
1641 }
1642 }
1643
1644 override protected void UpdateInsiders(int timeout)
1645 {
1646 super.UpdateInsiders(m_TriggerUpdateMs);
1647 }
1648
1649 void SetParentObject( Hologram projection )
1650 {
1651 m_ParentObj = projection;
1652 }
1653
1655 {
1656 m_Player = player;
1657 }
1658}
eBleedingSourceType GetType()
string Debug()
Определения CachedEquipmentStorageBase.c:29
const int ECE_OBJECT_SWAP
Определения CentralEconomy.c:38
const int ECE_LOCAL
Определения CentralEconomy.c:24
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
const int ECE_TRACE
Определения CentralEconomy.c:10
const int ECE_CREATEPHYSICS
Определения CentralEconomy.c:16
void DrawDebugCollisionBox(vector min_max[2], int color)
Определения Construction.c:1170
Shape m_CollisionBox
Определения Construction.c:19
void DestroyDebugCollisionBox()
Определения Construction.c:1181
void DeployableContainer_Base()
Определения Container_Base.c:36
DayZGame g_Game
Определения DayZGame.c:3942
DiagMenuIDs
Определения EDiagMenuIDs.c:2
Определения Fence.c:2
proto native void SetParams(vector center, vector orientation, vector edgeLength, ObjIntersect primaryType, ObjIntersect secondaryType, bool fullComponentInfo)
Set the parameters.
Class that holds parameters to feed into CGame.IsBoxCollidingGeometryProxy.
static bool GetDisableIsInTerrainCheck()
Определения CfgGameplayHandler.c:297
static bool GetDisableIsClippingRoofCheck()
Определения CfgGameplayHandler.c:287
static bool GetDisableIsUnderwaterCheck()
Определения CfgGameplayHandler.c:302
static bool GetDisableIsCollidingBBoxCheck()
Определения CfgGameplayHandler.c:277
static bool GetDisableHeightPlacementCheck()
Определения CfgGameplayHandler.c:307
static bool GetDisableIsPlacementPermittedCheck()
Определения CfgGameplayHandler.c:312
static bool GetDisableIsCollidingPlayerCheck()
Определения CfgGameplayHandler.c:282
static bool GetDisableIsCollidingGPlotCheck()
Определения CfgGameplayHandler.c:322
static bool GetDisableIsCollidingAngleCheck()
Определения CfgGameplayHandler.c:317
static bool GetDisableIsBaseViableCheck()
Определения CfgGameplayHandler.c:292
Super root of all classes in Enforce script.
Определения EnScript.c:11
bool IsEnergySourceAtReach(vector from_position, float add_tolerance=0, vector override_source_position="-1 -1 -1")
Energy manager: Returns true if this device's virtual power cord can reach its energy source at the g...
Определения ComponentEnergyManager.c:1076
bool IsPlugged()
Energy manager: Returns true if this device is plugged into some other device (even if they are OFF o...
Определения ComponentEnergyManager.c:918
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
Определения DayZPhysics.c:124
Определения DbgUI.c:60
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Определения 3_Game/DayZ/tools/Debug.c:349
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Определения 3_Game/DayZ/tools/Debug.c:382
static Shape DrawArrow(vector from, vector to, float size=0.5, int color=0xFFFFFFFF, int flags=0)
Определения 3_Game/DayZ/tools/Debug.c:483
Определения 3_Game/DayZ/tools/Debug.c:2
Определения EnDebug.c:241
bool m_IsFloating
Определения Hologram.c:31
vector m_DefaultOrientation
Определения Hologram.c:35
const string ANIMATION_PLACING
Определения Hologram.c:40
vector GetCollisionBoxSize(vector min_max[2])
Определения Hologram.c:1078
string CorrectMaterialPathName()
Определения Hologram.c:1570
void SetProjectionEntity(EntityAI projection)
Определения Hologram.c:1327
bool IsBaseIntact(Object under_left_close, Object under_right_close, Object under_left_far, Object under_right_far)
Определения Hologram.c:751
void SetAnimations()
Определения Hologram.c:178
string GetProjectionName(ItemBase item)
Определения Hologram.c:222
const string SELECTION_PLACING
Определения Hologram.c:42
bool m_IsHidden
Определения Hologram.c:33
const float LARGE_PROJECTION_DISTANCE_LIMIT
Deprecated.
Определения Hologram.c:48
void SetSelectionToRefresh(array< string > selection)
Определения Hologram.c:1540
bool IsCollidingZeroPos()
Определения Hologram.c:714
vector m_ContactDir
Определения Hologram.c:38
void SetSelectionToRefresh(string selection)
Определения Hologram.c:1534
void SetIsCollidingGPlot(bool is_colliding_gplot)
Определения Hologram.c:1360
const string SUFFIX_MATERIAL_DEPLOYABLE
Определения Hologram.c:14
bool IsInTerrain()
Определения Hologram.c:940
vector GetLeftFarProjectionVector()
Определения Hologram.c:1107
EntityAI m_Projection
Определения Hologram.c:22
const float PROJECTION_TRANSITION_MAX
Определения Hologram.c:50
bool GetUpdatePosition()
Определения Hologram.c:1317
void EvaluateCollision(ItemBase action_item=null)
Определения Hologram.c:432
vector m_YawPitchRollLimit
Определения Hologram.c:56
void SetUpdatePosition(bool state)
Определения Hologram.c:1312
bool HeightPlacementCheck()
Checks height relative to player's position.
Определения Hologram.c:872
EntityAI GetParentEntity()
Определения Hologram.c:1322
const float SMALL_PROJECTION_RADIUS
Определения Hologram.c:45
void CheckPowerSource()
Определения Hologram.c:1027
vector m_y_p_r_previous
Определения Hologram.c:37
void Hologram(PlayerBase player, vector pos, ItemBase item)
Определения Hologram.c:68
void SetProjectionOrientation(vector orientation)
Определения Hologram.c:1406
void AddProjectionRotation(float addition)
Определения Hologram.c:1416
ItemBase m_Parent
Определения Hologram.c:21
vector HideWhenClose(vector pos)
Определения Hologram.c:1481
void CreateTrigger()
Определения Hologram.c:375
float m_SlopeTolerance
Определения Hologram.c:54
int m_ContactComponent
Определения Hologram.c:57
vector SetOnGround(vector position)
Определения Hologram.c:1426
bool IsObjectStatic(Object obj)
Определения Hologram.c:746
void ~Hologram()
Определения Hologram.c:158
const vector PLACEMENT_RC_START_OFFSET
Определения Hologram.c:18
void RefreshVisual()
Определения Hologram.c:1546
bool IsUnderwater()
Определения Hologram.c:896
bool IsCollidingGeometryProxy(ItemBase action_item=null)
Определения Hologram.c:589
bool IsCollidingAngle()
Определения Hologram.c:507
void UpdateHologram(float timeslice)
Определения Hologram.c:256
ref array< string > m_WatchtowerBlockedComponentNames
Определения Hologram.c:66
vector GetRightFarProjectionVector()
Определения Hologram.c:1116
void SetIsHidden(bool is_hidden)
Определения Hologram.c:1350
string m_ProjectionTypename
Определения Hologram.c:25
vector m_Rotation
Определения Hologram.c:36
const vector PLACEMENT_RC_END_OFFSET
Определения Hologram.c:19
ref set< string > m_SelectionsToRefresh
Определения Hologram.c:59
bool IsCollidingGPlot()
Определения Hologram.c:702
PlayerBase m_Player
Определения Hologram.c:23
const float DISTANCE_SMALL_PROJECTION
Определения Hologram.c:47
void RefreshTrigger()
Определения Hologram.c:386
bool IsPlacementPermitted()
Checks if the item can be legally placed (usually checked by action as well)
Определения Hologram.c:858
bool IsCollidingBBox(ItemBase action_item=null)
Определения Hologram.c:540
bool IsColliding()
Определения Hologram.c:1373
static bool DoesHaveProjection(ItemBase item)
DEPRECATED.
Определения Hologram.c:250
vector SmoothProjectionMovement(vector y_p_r, float timeslice)
Определения Hologram.c:348
bool m_UpdatePosition
Определения Hologram.c:32
bool IsSurfaceWater(vector position)
Определения Hologram.c:1126
vector m_FromAdjusted
Определения Hologram.c:39
bool IsBaseViable()
Определения Hologram.c:638
bool m_AlignToTerrain
Определения Hologram.c:55
bool SetHologramPosition(vector startPosition, float minProjectionDistance, float maxProjectionDistance, inout vector contactPosition)
Sets hologram position based on player and projection distance.
Определения Hologram.c:1214
vector GetLeftCloseProjectionVector()
Определения Hologram.c:1089
void SetIsColliding(bool is_colliding)
Определения Hologram.c:1342
vector GetProjectionOrientation()
Определения Hologram.c:1502
bool IsSurfaceSea(vector position)
Определения Hologram.c:1131
void SubtractProjectionRotation(float subtraction)
Определения Hologram.c:1421
vector GetRightCloseProjectionVector()
Определения Hologram.c:1097
int GetHiddenSelection(string selection)
Определения Hologram.c:1523
bool IsCollidingPlayer()
Определения Hologram.c:1386
const string SUFFIX_MATERIAL_UNDEPLOYABLE
Определения Hologram.c:15
bool m_IsColliding
Определения Hologram.c:27
vector AlignProjectionOnTerrain(float timeslice)
Определения Hologram.c:293
vector GetProjectionEntityPosition(PlayerBase player)
Определения Hologram.c:1136
ProjectionTrigger m_ProjectionTrigger
Определения Hologram.c:24
bool IsFenceOrWatchtowerKit()
Определения Hologram.c:1263
EntityAI GetProjectionEntity()
Определения Hologram.c:1332
bool IsProjectionTrap()
Определения Hologram.c:1278
static const float DEFAULT_MAX_PLACEMENT_HEIGHT_DIFF
Определения Hologram.c:52
bool IsBaseFlat(vector contact_pos_left_close, vector contact_pos_right_close, vector contact_pos_left_far, vector contact_pos_right_far)
Определения Hologram.c:837
void SetIsCollidingPlayer(bool is_colliding)
Определения Hologram.c:1355
void SetIsFloating(bool is_floating)
Определения Hologram.c:1337
const float SMALL_PROJECTION_GROUND
Определения Hologram.c:46
vector CorrectForWatchtower(int contactComponent, vector contactPos, PlayerBase player, Object hitObject)
Определения Hologram.c:1268
float GetProjectionRadius()
Определения Hologram.c:1297
vector GetProjectionRotation()
Определения Hologram.c:1411
bool m_IsCollidingGPlot
Определения Hologram.c:28
bool IsClippingRoof()
Определения Hologram.c:475
bool IsBehindObstacle()
DEPRECATED.
Определения Hologram.c:726
const int SPAWN_FLAGS
Определения Hologram.c:6
void GetProjectionCollisionBox(out vector min_max[2])
Определения Hologram.c:1067
float GetProjectionDiameter()
Определения Hologram.c:1283
const float LOOKING_TO_SKY
Определения Hologram.c:51
string ProjectionBasedOnParent()
Определения Hologram.c:217
ref array< string > m_WatchtowerIgnoreComponentNames
Определения Hologram.c:63
void UpdateSelections()
Определения Hologram.c:198
bool m_IsCollidingPlayer
Определения Hologram.c:30
vector GetProjectionPosition()
Определения Hologram.c:1494
bool m_IsSlope
Определения Hologram.c:29
bool IsHidden()
Определения Hologram.c:1378
void SetProjectionPosition(vector position)
Определения Hologram.c:1396
vector GetDefaultOrientation()
Определения Hologram.c:1510
const float PROJECTION_TRANSITION_MIN
Определения Hologram.c:49
const string SELECTION_INVENTORY
Определения Hologram.c:43
const string ANIMATION_INVENTORY
Определения Hologram.c:41
EntityAI PlaceEntity(EntityAI entity_for_placing)
Определения Hologram.c:1044
bool IsFloating()
Определения Hologram.c:1365
bool IsBaseStatic(Object objectToCheck)
Определения Hologram.c:733
const string SUFFIX_MATERIAL_POWERED
Определения Hologram.c:16
bool IsRestrictedFromAdvancedPlacing()
Определения Hologram.c:1598
Определения Hologram.c:2
Определения ItemBase.c:21
override bool IsBasebuildingKit()
Определения KitBase.c:5
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override bool IsDeployable()
Определения BaseBuildingBase.c:365
Определения FenceKit.c:2
static const string NAME_VIEW
Определения gameplay.c:207
LOD class.
Определения gameplay.c:204
Определения EnMath3D.c:28
Определения EnMath.c:7
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
CollisionFlags flags
Определения DayZPhysics.c:63
Определения DayZPhysics.c:50
Object obj
object,that we collide with (NULL if none), If hierLevel > 0 object is the proxy object
Определения DayZPhysics.c:100
bool entry
is false if begining point was TriggerInsider
Определения DayZPhysics.c:111
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
Определения CarTent.c:2
Определения Trap_Bear.c:2
override bool IsPlaceableAtPosition(vector position)
Определения Trap_FishNet.c:39
Определения Trap_FishNet.c:2
override void OnLeave(Object obj)
Определения Hologram.c:1635
override void OnEnter(Object obj)
Определения Hologram.c:1625
void SetParentOwner(PlayerBase player)
Определения Hologram.c:1654
void Trigger()
ctor
Определения Trigger.c:53
void UpdateInsiders(int timeout)
Определения Hologram.c:1644
Hologram m_ParentObj
Определения Hologram.c:1622
PlayerBase m_Player
Определения Hologram.c:1623
void SetParentObject(Hologram projection)
Определения Hologram.c:1649
int m_TriggerUpdateMs
Определения Hologram.c:1621
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.
proto native float Length()
Returns length of vector (magnitude)
static const vector Zero
Определения EnConvert.c:123
proto float Normalize()
Normalizes vector. Returns length.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
Определения EnConvert.c:119
const int COLOR_RED
Определения 1_Core/DayZ/constants.c:64
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx
CollisionFlags
Определения EnDebug.c:141
ShapeFlags
Определения EnDebug.c:126
static proto native void ColoredText(int color, string label)
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 float ROOF_CHECK_RAYCAST_DIST
Определения 3_Game/DayZ/constants.c:1014
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int LIQUID_GROUP_WATER
Определения 3_Game/DayZ/constants.c:560
const int LIQUID_SNOW
Определения 3_Game/DayZ/constants.c:552
static proto vector MatrixToAngles(vector mat[3])
Returns angles of rotation matrix.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
static proto void MatrixMultiply3(vector mat0[3], vector mat1[3], out vector res[3])
Transforms rotation matrix.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float AbsFloat(float f)
Returns absolute value.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.