Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIDefendFromClusterActivity.c
Go to the documentation of this file.
1class 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 {
16 }
17 }
18
19 //------------------------------------------------------------------------------------
20 override void OnFireteamRemovedFromGroup(SCR_AIGroupFireteam ft)
21 {
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 = {};
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
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: (";
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}
override void OnActionDeselected()
override void OnActionSelected()
string GetDebugPanelText()
enum SCR_EAIActivityCause m_Utility
array< ref SCR_AIGroupFireteamLock > TFireteamLockRefArray
void SCR_AITargetClusterState(SCR_AIGroupTargetCluster cluster)
ref TFireteamLockRefArray m_aAssignedFireteams
void UnregisterFireteam(notnull SCR_AIGroupFireteamLock ftLock)
void RegisterFireteam(notnull SCR_AIGroupFireteamLock ftLock)
Registers fireteam within this activity.
void SCR_AIFireteamsClusterActivity(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint, notnull SCR_AITargetClusterState clusterState)
void GetMembers(notnull array< AIAgent > outAgents)