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_AIGetSmartActionComponent.c
Go to the documentation of this file.
1
class
SCR_AIGetSmartActionComponent
:
AITaskScripted
2
{
3
static
const
string
WAYPOINT_PORT =
"WaypointIn"
;
4
static
const
string
COMPONENT_PORT =
"SmartActionComponent"
;
5
6
//------------------------------------------------------------------------------------------
7
protected
static
override
bool
VisibleInPalette
()
8
{
9
return
true
;
10
}
11
12
//------------------------------------------------------------------------------------------
13
protected
static
ref
TStringArray
s_aVarsIn
= {
14
WAYPOINT_PORT
15
};
16
override
TStringArray
GetVariablesIn
()
17
{
18
return
s_aVarsIn
;
19
}
20
21
//------------------------------------------------------------------------------------------
22
protected
static
ref
TStringArray
s_aVarsOut
= {
23
COMPONENT_PORT
24
};
25
override
TStringArray
GetVariablesOut
()
26
{
27
return
s_aVarsOut
;
28
}
29
30
//------------------------------------------------------------------------------------------
31
override
ENodeResult
EOnTaskSimulate
(AIAgent owner,
float
dt)
32
{
33
AIGroup group = AIGroup.Cast(owner);
34
if
(!group)
35
{
36
SCR_AgentMustBeAIGroup
(
this
, owner);
37
return
ENodeResult
.FAIL;
38
}
39
40
AIWaypoint wp;
41
if
(!
GetVariableIn
(WAYPOINT_PORT,wp))
42
wp = group.GetCurrentWaypoint();
43
if
(!wp)
44
return
ENodeResult
.FAIL;
45
46
SCR_SmartActionWaypoint
SAWP =
SCR_SmartActionWaypoint
.Cast(wp);
47
48
if
(!SAWP)
49
return
ENodeResult
.FAIL;
50
51
IEntity
SAEntity;
52
string
SATag;
53
54
SAWP.GetSmartActionEntity(SAEntity, SATag);
55
56
if
(!SAEntity || SATag.IsEmpty())
57
return
ENodeResult
.FAIL;
58
59
if
(SAEntity)
60
{
61
array<Managed> outComponents = {};
62
SCR_AISmartActionComponent
component;
63
array<string> outTags = {};
64
SAEntity.
FindComponents
(
SCR_AISmartActionComponent
, outComponents);
65
// searching in hierarchy of SAEntity for SmartActionComponents
66
IEntity
child = SAEntity.
GetChildren
();
67
while
(child)
68
{
69
array<Managed> entityComponents = {};
70
child.
FindComponents
(
SCR_AISmartActionComponent
,entityComponents);
71
outComponents.InsertAll(entityComponents);
72
child = child.
GetSibling
();
73
}
74
// searching SmartActionComponents of smartactions with correct TAG
75
foreach
(Managed outComponent : outComponents)
76
{
77
component =
SCR_AISmartActionComponent
.Cast(outComponent);
78
if
(!component)
79
continue
;
80
component.GetTags(outTags);
81
if
(outTags.Contains(SATag) && component.IsActionAccessible())
82
{
83
SetVariableOut
(COMPONENT_PORT, component);
84
return
ENodeResult
.SUCCESS;
85
}
86
}
87
}
88
return
ENodeResult
.FAIL;
89
}
90
91
//------------------------------------------------------------------------------------------
92
protected
static
override
string
GetOnHoverDescription
()
93
{
94
return
"Returns SmartActionComponent set on waypoint, fails if waypoint is not set properly (entity or tag is missing)."
;
95
}
96
};
SCR_AgentMustBeAIGroup
void SCR_AgentMustBeAIGroup(Node node, AIAgent owner)
Definition
NodeError.c:14
AITaskScripted
Definition
AITaskScripted.c:13
IEntity
Definition
IEntity.c:13
IEntity::GetChildren
proto external IEntity GetChildren()
IEntity::FindComponents
proto external int FindComponents(typename typeName, notnull array< Managed > outComponents)
IEntity::GetSibling
proto external IEntity GetSibling()
Node::SetVariableOut
proto void SetVariableOut(string name, void val)
Node::GetVariableIn
proto bool GetVariableIn(string name, out void val)
SCR_AIGetSmartActionComponent
Definition
SCR_AIGetSmartActionComponent.c:2
SCR_AIGetSmartActionComponent::GetOnHoverDescription
static override string GetOnHoverDescription()
Definition
SCR_AIGetSmartActionComponent.c:92
SCR_AIGetSmartActionComponent::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AIGetSmartActionComponent.c:7
SCR_AIGetSmartActionComponent::GetVariablesOut
override TStringArray GetVariablesOut()
Definition
SCR_AIGetSmartActionComponent.c:25
SCR_AIGetSmartActionComponent::GetVariablesIn
override TStringArray GetVariablesIn()
Definition
SCR_AIGetSmartActionComponent.c:16
SCR_AIGetSmartActionComponent::s_aVarsIn
static ref TStringArray s_aVarsIn
Definition
SCR_AIGetSmartActionComponent.c:13
SCR_AIGetSmartActionComponent::s_aVarsOut
static ref TStringArray s_aVarsOut
Definition
SCR_AIGetSmartActionComponent.c:22
SCR_AIGetSmartActionComponent::EOnTaskSimulate
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
Definition
SCR_AIGetSmartActionComponent.c:31
SCR_AISmartActionComponent
Definition
SCR_AISmartActionComponent.c:10
SCR_SmartActionWaypoint
Definition
SCR_SmartActionWaypoint.c:5
ENodeResult
ENodeResult
Definition
ENodeResult.c:13
TStringArray
array< string > TStringArray
Definition
Types.c:385
scripts
Game
AI
ScriptedNodes
Waypoints
SCR_AIGetSmartActionComponent.c
Generated by
1.17.0