Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
cctobject.c
Go to the documentation of this file.
2 {
3  protected float m_MaximalActionDistanceSq;
4 
5  void CCTObject ( float maximal_target_distance = UAMaxDistances.DEFAULT )
6  {
7  m_MaximalActionDistanceSq = maximal_target_distance * maximal_target_distance;
8  }
9 
10  override bool Can( PlayerBase player, ActionTarget target )
11  {
12  Object targetObject = target.GetObject();
13  if ( !targetObject || !player )
14  return false;
15 
16  vector playerHeadPos;
17  MiscGameplayFunctions.GetHeadBonePos(player, playerHeadPos);
18 
19  float distanceRoot = vector.DistanceSq(targetObject.GetPosition(), player.GetPosition());
20  float distanceHead = vector.DistanceSq(targetObject.GetPosition(), playerHeadPos);
21 
22  return ( distanceRoot <= m_MaximalActionDistanceSq || distanceHead <= m_MaximalActionDistanceSq );
23  }
24 };
25 
27 {
28  protected float m_MaximalActionDistanceSq;
29 
30  void CCTParent ( float maximal_target_distance = UAMaxDistances.DEFAULT )
31  {
32  m_MaximalActionDistanceSq = maximal_target_distance * maximal_target_distance;
33  }
34 
35  override bool Can( PlayerBase player, ActionTarget target )
36  {
37  Object targetParent = target.GetParent();
38  if ( !targetParent || !player )
39  return false;
40 
41  vector playerHeadPos;
42  MiscGameplayFunctions.GetHeadBonePos(player, playerHeadPos);
43 
44  float distanceRoot = vector.DistanceSq(targetParent.GetPosition(), player.GetPosition());
45  float distanceHead = vector.DistanceSq(targetParent.GetPosition(), playerHeadPos);
46 
47  return ( distanceRoot <= m_MaximalActionDistanceSq || distanceHead <= m_MaximalActionDistanceSq );
48  }
49 };
CCTParent
Definition: cctobject.c:26
CCTObject
Definition: cctobject.c:1
CCTBase
Definition: cctbase.c:1
UAMaxDistances
Definition: actionconstants.c:104
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
ActionTarget
class ActionTargets ActionTarget
Object
Definition: objecttyped.c:1