Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FactionCallsignInfo.c
Go to the documentation of this file.
1
6{
7 [Attribute(defvalue: "1", desc: "If true then callsigns will be assigned at random rather then trying to keep callsigns close")]
8 protected bool m_bIsAssignedRandomly;
9
10 [Attribute(defvalue: "0", desc: "Assign the group callsigns based on group roles")]
12
13 [Attribute()]
14 protected ref array<ref SCR_CallsignInfo> m_aCompanyNames;
15
16 [Attribute(defvalue: "4", desc: "Index of overflow companies. Starting with the given index, these companies will only be assigned if all company indexes above are taken")]
18
19 [Attribute()]
20 protected ref array<ref SCR_CallsignInfo> m_aPlatoonNames;
21
22 [Attribute()]
23 protected ref array<ref SCR_CallsignInfo> m_aSquadNames;
24
25 [Attribute(desc: "Used to show callsigns of groups. %1 = Company, %2 = Platoon, %3 = Squad")]
27
28 [Attribute(desc: "Used when showing callsign of character that has no specific role. %1 = Company, %2 = Platoon, %3 = Squad, %4 = CharacterNumber")]
30
31 [Attribute(desc: "If character has a specific role this formating will be used instead. %1 = Company, %2 = Platoon, %3 = Squad, %4 = CharacterRole")]
33
34 [Attribute(desc: "A character can have one role at the time and a group can only have one of each role. Note that roles are assigned in order, so make sure important roles (Such as leader) are on top of the list.")]
35 protected ref array<ref SCR_BaseRoleCallsign> m_aCharacterRoleCallsigns;
36
37 [Attribute(desc: "List of group roles with specific callsigns. Note that inputted callsigns need to match the companies/platoons/squads callsigns.")]
38 protected ref array<ref SCR_FactionGroupRoleSpecificCallsignInfo> m_aGroupRoleSpecificCallsigns;
39
44 string GetCallsignFormat(bool includeCharacter, int characterRole = -1)
45 {
46 if (!includeCharacter)
48 else if (characterRole < 0)
50 else
52 }
53
59 {
61 }
62
63 //------------------------------------------------------------------------------------------------
68
73 void GetCompanyArray(notnull array<ref SCR_CallsignInfo> companyArray)
74 {
75 companyArray.Clear();
76
77 foreach (SCR_CallsignInfo info: m_aCompanyNames)
78 companyArray.Insert(info);
79 }
80
85 void GetPlatoonArray(notnull array<ref SCR_CallsignInfo> platoonArray)
86 {
87 platoonArray.Clear();
88
89 foreach (SCR_CallsignInfo info: m_aPlatoonNames)
90 platoonArray.Insert(info);
91 }
92
97 void GetSquadArray(notnull array<ref SCR_CallsignInfo> squadArray)
98 {
99 squadArray.Clear();
100
101 foreach (SCR_CallsignInfo info: m_aSquadNames)
102 squadArray.Insert(info);
103 }
104
111 {
113 return index.ToString();
114
115 return m_aCompanyNames[index].GetCallsign();
116 }
117
126
133 {
135 return index.ToString();
136
137 return m_aPlatoonNames[index].GetCallsign();
138 }
139
146 {
148 return index.ToString();
149
150 return m_aSquadNames[index].GetCallsign();
151 }
152
159 {
160 if (!m_aCharacterRoleCallsigns.IsEmpty())
161 {
163 {
164 if (callsign.GetRoleIndex() == index)
165 return callsign.GetRoleName();
166 }
167 }
168
169 Print(string.Format("Given Role index: '%1' does not exist in role data!", index.ToString()), LogLevel.ERROR);
170 return index.ToString();
171 }
172
179 bool GetRandomCallsign(out int company, out int platoon, out int squad)
180 {
181 company = -1;
182 platoon = -1;
183 squad = -1;
184
185 if (!m_aCompanyNames || m_aCompanyNames.Count() == 0 || !m_aPlatoonNames || m_aPlatoonNames.Count() == 0 || !m_aSquadNames || m_aSquadNames.Count() == 0)
186 return false;
187
188 //TODO: Make sure the same callsigns are never assigned twice
189 company = Math.RandomInt(0, m_aCompanyNames.Count());
190 platoon = Math.RandomInt(0, m_aPlatoonNames.Count());
191 squad = Math.RandomInt(0, m_aSquadNames.Count());
192
193 return true;
194 }
195
207 bool GetCharacterRoleCallsign(IEntity character, int playerID, SCR_AIGroup group, inout int roleCallsignIndex, out bool isUnique)
208 {
209 foreach (SCR_BaseRoleCallsign roleCallsign: m_aCharacterRoleCallsigns)
210 {
211 if (roleCallsign.IsValidRole(character, playerID, group, roleCallsignIndex, isUnique))
212 return true;
213 }
214
215 return false;
216 }
217
218 //------------------------------------------------------------------------------------------------
223 bool GetGroupRoleSpecificCompanies(SCR_EGroupRole groupRole, notnull out array<int> companyIndexes)
224 {
225 array<string> groupRoleCompanyNames = {};
226
228 {
229 if (groupRoleCallsignInfo.GetGroupRole() != groupRole)
230 continue;
231
232 groupRoleCompanyNames = groupRoleCallsignInfo.GetCallsignNames();
233 break;
234 }
235
236 if (groupRoleCompanyNames.IsEmpty())
237 return false;
238
239 string callsignInfoName;
240 foreach (int i, SCR_CallsignInfo callsignInfo : m_aCompanyNames)
241 {
242 callsignInfoName = callsignInfo.GetCallsign();
243 if (groupRoleCompanyNames.Contains(callsignInfoName))
244 companyIndexes.Insert(i);
245 }
246
247 return !companyIndexes.IsEmpty();
248 }
249};
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
SCR_EGroupRole
Group roles.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Math.c:13
ref array< ref SCR_CallsignInfo > m_aCompanyNames
bool GetCharacterRoleCallsign(IEntity character, int playerID, SCR_AIGroup group, inout int roleCallsignIndex, out bool isUnique)
ref array< ref SCR_BaseRoleCallsign > m_aCharacterRoleCallsigns
void GetSquadArray(notnull array< ref SCR_CallsignInfo > squadArray)
string GetCallsignFormat(bool includeCharacter, int characterRole=-1)
string GetCompanyCallsignName(int index)
void GetPlatoonArray(notnull array< ref SCR_CallsignInfo > platoonArray)
bool GetGroupRoleSpecificCompanies(SCR_EGroupRole groupRole, notnull out array< int > companyIndexes)
ref array< ref SCR_CallsignInfo > m_aSquadNames
ref array< ref SCR_FactionGroupRoleSpecificCallsignInfo > m_aGroupRoleSpecificCallsigns
LocalizedString m_sCallsignCharacterWithRoleFormat
void GetCompanyArray(notnull array< ref SCR_CallsignInfo > companyArray)
string GetCharacterRoleCallsignName(int index)
bool GetRandomCallsign(out int company, out int platoon, out int squad)
LocalizedString m_sCallsignCharacterFormat
string GetPlatoonCallsignName(int index)
ref array< ref SCR_CallsignInfo > m_aPlatoonNames
Stores info about possible callsigns for a specific group role.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute