DayZ
1.24
Loading...
Searching...
No Matches
CCTObject.c
Go to the documentation of this file.
1
class
CCTObject
:
CCTBase
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
26
class
CCTParent
:
CCTBase
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
};
CCTBase
Definition
CCTBase.c:2
CCTObject
Definition
CCTObject.c:2
CCTObject::Can
override bool Can(PlayerBase player, ActionTarget target)
Definition
CCTObject.c:10
CCTObject::CCTObject
void CCTObject(float maximal_target_distance=UAMaxDistances.DEFAULT)
Definition
CCTObject.c:5
CCTObject::m_MaximalActionDistanceSq
float m_MaximalActionDistanceSq
Definition
CCTObject.c:3
CCTParent
Definition
CCTObject.c:27
CCTParent::Can
override bool Can(PlayerBase player, ActionTarget target)
Definition
CCTObject.c:35
CCTParent::CCTParent
void CCTParent(float maximal_target_distance=UAMaxDistances.DEFAULT)
Definition
CCTObject.c:30
CCTParent::m_MaximalActionDistanceSq
float m_MaximalActionDistanceSq
Definition
CCTObject.c:28
Object
Definition
ObjectTyped.c:2
Param3
Definition
EntityAI.c:95
PlayerBase
Definition
PlayerBaseClient.c:2
UAMaxDistances
Definition
ActionConstants.c:105
UAMaxDistances::DEFAULT
const float DEFAULT
Definition
ActionConstants.c:107
vector
Definition
EnConvert.c:106
vector::DistanceSq
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
scripts
4_World
Classes
UserActionsComponent
TargetConditionsComponents
CCTObject.c
Generated by
1.10.0