Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIGroupFireteam.c
Go to the documentation of this file.
1
3class SCR_AIGroupFireteam : Managed
4{
5 protected ref array<AIAgent> m_aAgents = {};
6
7 protected bool m_bLocked = false;
8
9 //--------------------------------------------------------------------------
10 void AddMember(AIAgent agent)
11 {
12 if (!m_aAgents.Contains(agent))
13 m_aAgents.Insert(agent);
14 }
15
16 //--------------------------------------------------------------------------
17 void RemoveMember(AIAgent agent)
18 {
19 int id = m_aAgents.Find(agent);
20 if (id == -1)
21 return;
22 m_aAgents.Remove(id);
23 }
24
25 //--------------------------------------------------------------------------
26 protected void RemoveMember(int id, out AIAgent outAgent)
27 {
28 outAgent = m_aAgents[id];
29
30 m_aAgents.Remove(id);
31 }
32
33 //--------------------------------------------------------------------------
34 AIAgent GetMember(int id)
35 {
36 if (!m_aAgents.IsIndexValid(id))
37 return null;
38
39 return m_aAgents[id];
40 }
41
42 //--------------------------------------------------------------------------
44 {
45 if (m_aAgents.IsEmpty())
46 return null;
47 foreach (AIAgent agent : m_aAgents)
48 {
49 if (!agent)
50 continue;
51 IEntity controlledEntity = agent.GetControlledEntity();
52 return controlledEntity;
53 }
54 return null;
55 }
56
57 //--------------------------------------------------------------------------
58 void GetMembers(notnull array<AIAgent> outAgents)
59 {
60 outAgents.Clear();
61 foreach (auto a : m_aAgents)
62 outAgents.Insert(a);
63 }
64
65 //--------------------------------------------------------------------------
67 void MoveMembersFrom(notnull SCR_AIGroupFireteam otherFt, int count)
68 {
69 // Bail if wrong count
70 if (count <= 0)
71 return;
72
73 // Clamp count
74 count = Math.ClampInt(count, 0, otherFt.m_aAgents.Count());
75
76 // Remove the required amount of members
77 for (int i = 0; i < count; i++)
78 {
79 // Remove last member from other fireteam
80 int lastId = otherFt.m_aAgents.Count() - 1;
81 AIAgent agent;
82 otherFt.RemoveMember(lastId, agent);
83
84 // Add the member to our fireteam
85 AddMember(agent);
86 }
87 }
88
89 //--------------------------------------------------------------------------
90 bool HasMember(AIAgent agent)
91 {
92 return m_aAgents.Find(agent) != -1;
93 }
94
95 //--------------------------------------------------------------------------
97 {
98 return m_aAgents.Count();
99 }
100
101 //--------------------------------------------------------------------------
104 {
105 m_bLocked = false;
106 }
107
108 //------------------------------------------------------------------------------------------------
109 // Acquiring fireteams
110
111 //--------------------------------------------------------------------------
112 bool IsLocked()
113 {
114 return m_bLocked;
115 }
116
117 //--------------------------------------------------------------------------
121 {
122 if (m_bLocked)
123 return null;
124
125 m_bLocked = true;
126
128 return lock;
129 }
130};
131
151
153class SCR_AIGroupFireteamVehicleCrew : SCR_AIGroupFireteamVehicleBase
154{
155
156}
157
159class SCR_AIGroupFireteamVehicleCargo : SCR_AIGroupFireteamVehicleBase
160{
161
162}
AddonBuildInfoTool id
Definition Math.c:13
AIAgent GetMember(int id)
void AddMember(AIAgent agent)
void MoveMembersFrom(notnull SCR_AIGroupFireteam otherFt, int count)
Moves 'count' members from other fireteam to this one.
void GetMembers(notnull array< AIAgent > outAgents)
ref array< AIAgent > m_aAgents
bool HasMember(AIAgent agent)
SCR_AIGroupFireteamLock TryLock()
void RemoveMember(int id, out AIAgent outAgent)
void RemoveMember(AIAgent agent)
void Internal_OnLockDestroyed()
Don't ever try to free a fireteam yourself, use SCR_AIGroupFireteamLock instead.
SCR_AIVehicleUsageComponent GetVehicle()
void SetVehicle(notnull SCR_AIVehicleUsageComponent vehicleComp)
SCR_AIVehicleUsageComponent m_VehicleUsageComponent