Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
cctcursornoruincheck.c
Go to the documentation of this file.
2 {
3  protected float m_MaximalActionDistanceSq;
4 
5  //approximate head heights
6  const float HEIGHT_ERECT = 1.6;
7  const float HEIGHT_CROUCH = 1.05;
8  const float HEIGHT_PRONE = 0.66;
9 
10  void CCTCursorNoRuinCheck( float maximal_target_distance = UAMaxDistances.DEFAULT )
11  {
12  m_MaximalActionDistanceSq = maximal_target_distance * maximal_target_distance;
13  }
14 
15  override bool Can( PlayerBase player, ActionTarget target )
16  {
17  if (!target)
18  return false;
19 
20  Object targetObject = target.GetObject();
21  if (!targetObject)
22  targetObject = target.GetParent();
23 
24  if (!player || !targetObject)
25  return false;
26 
27  vector playerHeadPos;
28  MiscGameplayFunctions.GetHeadBonePos(player, playerHeadPos);
29 
30  float distanceRoot = vector.DistanceSq(target.GetCursorHitPos(), player.GetPosition());
31  float distanceHead = vector.DistanceSq(target.GetCursorHitPos(), playerHeadPos);
32 
33  return (distanceRoot <= m_MaximalActionDistanceSq || distanceHead <= m_MaximalActionDistanceSq);
34  }
35 };
CCTBase
Definition: cctbase.c:1
UAMaxDistances
Definition: actionconstants.c:104
CCTCursorNoRuinCheck
Definition: cctcursornoruincheck.c:1
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
ActionTarget
class ActionTargets ActionTarget
Object
Definition: objecttyped.c:1