Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AIDecoTimeSinceTargetDetected.c
Go to the documentation of this file.
1
// Script File//------------------------------------------------------------------------------------------------
2
class
SCR_AIDecoTimeSinceTargetDetected
:
DecoratorScripted
3
{
4
static
const
string
BASE_TARGET_PORT =
"BaseTargetIn"
;
5
6
[
Attribute
(
"0.5"
,
UIWidgets
.EditBox,
"Threshold time since target was detected"
,
""
)]
7
float
m_TimeThreshold_S;
8
9
PerceptionComponent m_PerceptionComp;
10
11
//-----------------------------------------------------------------------------------------------------
12
protected
override
bool
TestFunction
(AIAgent owner)
13
{
14
if
(!m_PerceptionComp)
15
m_PerceptionComp = PerceptionComponent.Cast(owner.GetControlledEntity().FindComponent(PerceptionComponent));
16
17
BaseTarget
target;
18
GetVariableIn
(BASE_TARGET_PORT,target);
19
20
if
(!target || !m_PerceptionComp)
21
{
22
return
false
;
23
}
24
25
// When m_TimeThreshold_S value is lower than perception component update interval,
26
// which might be large at higher LOD levels, the decorator might periodically return false,
27
// even when target is still visible.
28
// Therefore we must prevent the threshold from being smaller than update interval of perception component.
29
float
timeMax =
Math
.Max(m_TimeThreshold_S, m_PerceptionComp.GetUpdateInterval()) + 0.02;
30
31
return
target.GetTimeSinceDetected() < timeMax;
32
}
33
34
//-----------------------------------------------------------------------------------------------------
35
protected
static
override
bool
VisibleInPalette
()
36
{
37
return
true
;
38
}
39
40
//-----------------------------------------------------------------------------------------------------
41
protected
static
override
string
GetOnHoverDescription
()
42
{
43
return
"Checks time since target was detected and compares it with threshold. Returns true when time is below the threshold."
;
44
}
45
46
//-----------------------------------------------------------------------------------------------------
47
protected
static
ref
TStringArray
s_aVarsIn
= {
48
BASE_TARGET_PORT
49
};
50
protected
override
TStringArray
GetVariablesIn
()
51
{
52
return
s_aVarsIn
;
53
}
54
};
BaseTarget
Definition
BaseTarget.c:13
DecoratorScripted
Definition
DecoratorScripted.c:13
Math
Definition
Math.c:13
Node::GetVariableIn
proto bool GetVariableIn(string name, out void val)
SCR_AIDecoTimeSinceTargetDetected
Definition
SCR_AIDecoTimeSinceTargetDetected.c:3
SCR_AIDecoTimeSinceTargetDetected::GetVariablesIn
override TStringArray GetVariablesIn()
Definition
SCR_AIDecoTimeSinceTargetDetected.c:50
SCR_AIDecoTimeSinceTargetDetected::s_aVarsIn
static ref TStringArray s_aVarsIn
Definition
SCR_AIDecoTimeSinceTargetDetected.c:47
SCR_AIDecoTimeSinceTargetDetected::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AIDecoTimeSinceTargetDetected.c:35
SCR_AIDecoTimeSinceTargetDetected::TestFunction
override bool TestFunction(AIAgent owner)
Definition
SCR_AIDecoTimeSinceTargetDetected.c:12
SCR_AIDecoTimeSinceTargetDetected::GetOnHoverDescription
static override string GetOnHoverDescription()
Definition
SCR_AIDecoTimeSinceTargetDetected.c:41
UIWidgets
Definition
attributes.c:40
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
TStringArray
array< string > TStringArray
Definition
Types.c:385
scripts
Game
AI
ScriptedNodes
Soldier
SCR_AIDecoTimeSinceTargetDetected.c
Generated by
1.17.0