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_AIDefendFromClusterActivity.c
Go to the documentation of this file.
1
class
SCR_AIDefendFromClusterActivity :
SCR_AIFireteamsClusterActivity
2
{
3
bool
m_bOrdersSent =
false
;
4
5
//------------------------------------------------------------------------------------
6
void
SCR_AIDefendFromClusterActivity(
SCR_AIGroupUtilityComponent
utility, AIWaypoint relatedWaypoint,
7
notnull
SCR_AITargetClusterState
clusterState,
8
notnull
TFireteamLockRefArray
fireteams)
9
{
10
SetPriority(PRIORITY_ACTIVITY_DEFEND_FROM_CLUSTER);
11
SetIsUniqueInActionQueue(
false
);
12
13
foreach
(
auto
ft : fireteams)
14
{
15
RegisterFireteam
(ft);
16
}
17
}
18
19
//------------------------------------------------------------------------------------
20
override
void
OnFireteamRemovedFromGroup(
SCR_AIGroupFireteam
ft)
21
{
22
UnregisterFireteam
(ft);
23
}
24
25
//------------------------------------------------------------------------------------
26
override
void
OnActionSelected
()
27
{
28
super.OnActionSelected();
29
30
if
(!m_bOrdersSent)
31
{
32
SendDefendMessages();
33
m_bOrdersSent =
true
;
34
}
35
36
// !! It runs once and then is suspended, we don't need to run the behavior tree for it.
37
//SetActionIsSuspended(true);
38
}
39
40
//------------------------------------------------------------------------------------
41
override
void
OnActionDeselected
()
42
{
43
super.OnActionDeselected();
44
SendCancelMessages();
45
}
46
47
//------------------------------------------------------------------------------------
48
void
SendDefendMessages()
49
{
50
AICommunicationComponent comms =
m_Utility
.m_Owner.GetCommunicationComponent();
51
if
(!comms)
52
return
;
53
54
array<AIAgent> agents = {};
55
foreach
(
SCR_AIGroupFireteamLock
ft :
m_aAssignedFireteams
)
56
{
57
ft.GetFireteam().
GetMembers
(agents);
58
foreach
(AIAgent agent : agents)
59
{
60
if
(!agent)
61
continue
;
62
63
if
(
SCR_AICompartmentHandling
.IsInCompartment(agent))
64
continue
;
65
66
// Now we send attack message, but forbit investigation there
67
SCR_AIMessage_AttackCluster
msg =
SCR_AIMessage_AttackCluster
.Create(
m_ClusterState
,
false
);
68
msg.m_RelatedGroupActivity =
this
;
69
msg.SetReceiver(agent);
70
comms.RequestBroadcast(msg, agent);
71
}
72
}
73
}
74
75
//------------------------------------------------------------------------------------
76
void
SendCancelMessages()
77
{
78
AICommunicationComponent comms =
m_Utility
.m_Owner.GetCommunicationComponent();
79
if
(!comms)
80
return
;
81
82
array<AIAgent> agents = {};
83
foreach
(
SCR_AIGroupFireteamLock
ft :
m_aAssignedFireteams
)
// Send to all fireteams
84
{
85
ft.GetFireteam().
GetMembers
(agents);
86
foreach
(AIAgent agent : agents)
87
{
88
if
(!agent)
89
continue
;
90
91
SCR_AIMessage_Cancel
msgCancel =
SCR_AIMessage_Cancel
.Create(
this
);
92
msgCancel.SetReceiver(agent);
93
comms.RequestBroadcast(msgCancel, agent);
94
}
95
}
96
}
97
98
//------------------------------------------------------------------------------------------------
99
override
string
GetDebugPanelText
()
100
{
101
// List all assigned fireteams
102
string
str =
"FTs: ("
;
103
foreach
(
SCR_AIGroupFireteamLock
ftLock :
m_aAssignedFireteams
)
104
{
105
str = str +
string
.Format(
"%1, "
,
m_Utility
.m_FireteamMgr.GetFireteamId(ftLock.GetFireteam()));
106
}
107
str = str +
string
.Format(
") => C: %1"
,
m_Utility
.m_Perception.GetTargetClusterStateId(
m_ClusterState
));
108
109
return
str;
110
}
111
}
OnActionDeselected
override void OnActionDeselected()
Definition
SCR_AIAction.c:196
OnActionSelected
override void OnActionSelected()
Definition
SCR_AIAction.c:193
GetDebugPanelText
string GetDebugPanelText()
Definition
SCR_AIAction.c:190
m_Utility
enum SCR_EAIActivityCause m_Utility
TFireteamLockRefArray
array< ref SCR_AIGroupFireteamLock > TFireteamLockRefArray
Definition
SCR_AIGroupFireteamLock.c:6
SCR_AITargetClusterState
void SCR_AITargetClusterState(SCR_AIGroupTargetCluster cluster)
Definition
SCR_AITargetClusterState.c:42
SCR_AICompartmentHandling
Definition
SCR_AIUtils.c:153
SCR_AIFireteamsActivity::m_aAssignedFireteams
ref TFireteamLockRefArray m_aAssignedFireteams
Definition
SCR_AIFireteamsActivity.c:8
SCR_AIFireteamsActivity::UnregisterFireteam
void UnregisterFireteam(notnull SCR_AIGroupFireteamLock ftLock)
Definition
SCR_AIFireteamsActivity.c:54
SCR_AIFireteamsActivity::RegisterFireteam
void RegisterFireteam(notnull SCR_AIGroupFireteamLock ftLock)
Registers fireteam within this activity.
Definition
SCR_AIFireteamsActivity.c:45
SCR_AIFireteamsClusterActivity::SCR_AIFireteamsClusterActivity
void SCR_AIFireteamsClusterActivity(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint, notnull SCR_AITargetClusterState clusterState)
Definition
SCR_AIFireteamsClusterActivity.c:11
SCR_AIFireteamsClusterActivity::m_ClusterState
SCR_AITargetClusterState m_ClusterState
Definition
SCR_AIFireteamsClusterActivity.c:8
SCR_AIGroupFireteam
Definition
SCR_AIGroupFireteam.c:4
SCR_AIGroupFireteam::GetMembers
void GetMembers(notnull array< AIAgent > outAgents)
Definition
SCR_AIGroupFireteam.c:58
SCR_AIGroupFireteamLock
Definition
SCR_AIGroupFireteamLock.c:10
SCR_AIGroupUtilityComponent
Definition
SCR_AIGroupUtilityComponent.c:18
SCR_AIMessage_AttackCluster
Definition
SCR_AIMessage.c:311
SCR_AIMessage_Cancel
Definition
SCR_AIMessage.c:269
scripts
Game
AI
Behavior
ClusterActivities
SCR_AIDefendFromClusterActivity.c
Generated by
1.17.0