Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
cctcursornoobject.c
Go to the documentation of this file.
2 {
3  protected float m_MaximalActionDistanceSq;
4 
5  void CCTCursorNoObject ( float maximal_target_distance )
6  {
7  m_MaximalActionDistanceSq = maximal_target_distance * maximal_target_distance;
8  }
9 
10  override bool Can( PlayerBase player, ActionTarget target )
11  {
12  if ( !target )
13  return false;
14 
15  if ( GetGame().IsServer() && GetGame().IsMultiplayer() )
16  return true;
17 
18  vector playerHeadPos;
19  MiscGameplayFunctions.GetHeadBonePos(player, playerHeadPos);
20 
21  float distanceRoot = vector.DistanceSq(target.GetCursorHitPos(), player.GetPosition());
22  float distanceHead = vector.DistanceSq(target.GetCursorHitPos(), playerHeadPos);
23 
24  return ( distanceRoot <= m_MaximalActionDistanceSq || distanceHead <= m_MaximalActionDistanceSq );
25  }
26 };
GetGame
proto native CGame GetGame()
CCTBase
Definition: cctbase.c:1
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
ActionTarget
class ActionTargets ActionTarget
CCTCursorNoObject
Definition: cctcursornoobject.c:1