Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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()]
11  protected ref array<ref SCR_CallsignInfo> m_aCompanyNames;
12 
13  [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")]
14  protected int m_iCompanyOverflowIndex;
15 
16  [Attribute()]
17  protected ref array<ref SCR_CallsignInfo> m_aPlatoonNames;
18 
19  [Attribute()]
20  protected ref array<ref SCR_CallsignInfo> m_aSquadNames;
21 
22  [Attribute(desc: "Used to show callsigns of groups. %1 = Company, %2 = Platoon, %3 = Squad")]
23  protected LocalizedString m_sCallsignGroupFormat;
24 
25  [Attribute(desc: "Used when showing callsign of character that has no specific role. %1 = Company, %2 = Platoon, %3 = Squad, %4 = CharacterNumber")]
26  protected LocalizedString m_sCallsignCharacterFormat;
27 
28  [Attribute(desc: "If character has a specific role this formating will be used instead. %1 = Company, %2 = Platoon, %3 = Squad, %4 = CharacterRole")]
29  protected LocalizedString m_sCallsignCharacterWithRoleFormat;
30 
31  [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.")]
32  protected ref array<ref SCR_BaseRoleCallsign> m_aCharacterRoleCallsigns;
33 
38  string GetCallsignFormat(bool includeCharacter, int characterRole = -1)
39  {
40  if (!includeCharacter)
41  return m_sCallsignGroupFormat;
42  else if (characterRole < 0)
43  return m_sCallsignCharacterFormat;
44  else
45  return m_sCallsignCharacterWithRoleFormat;
46  }
47 
52  bool GetIsAssignedRandomly()
53  {
54  return m_bIsAssignedRandomly;
55  }
56 
61  void GetCompanyArray(notnull array<ref SCR_CallsignInfo> companyArray)
62  {
63  companyArray.Clear();
64 
65  foreach (SCR_CallsignInfo info: m_aCompanyNames)
66  companyArray.Insert(info);
67  }
68 
73  void GetPlatoonArray(notnull array<ref SCR_CallsignInfo> platoonArray)
74  {
75  platoonArray.Clear();
76 
77  foreach (SCR_CallsignInfo info: m_aPlatoonNames)
78  platoonArray.Insert(info);
79  }
80 
85  void GetSquadArray(notnull array<ref SCR_CallsignInfo> squadArray)
86  {
87  squadArray.Clear();
88 
89  foreach (SCR_CallsignInfo info: m_aSquadNames)
90  squadArray.Insert(info);
91  }
92 
98  string GetCompanyCallsignName(int index)
99  {
100  if (index < 0 || index >= m_aCompanyNames.Count())
101  return index.ToString();
102 
103  return m_aCompanyNames[index].GetCallsign();
104  }
105 
110  int GetCompanyOverflowIndex()
111  {
112  return m_iCompanyOverflowIndex;
113  }
114 
120  string GetPlatoonCallsignName(int index)
121  {
122  if (index < 0 || index >= m_aPlatoonNames.Count())
123  return index.ToString();
124 
125  return m_aPlatoonNames[index].GetCallsign();
126  }
127 
133  string GetSquadCallsignName(int index)
134  {
135  if (index < 0 || index >= m_aSquadNames.Count())
136  return index.ToString();
137 
138  return m_aSquadNames[index].GetCallsign();
139  }
140 
146  string GetCharacterRoleCallsignName(int index)
147  {
148  if (!m_aCharacterRoleCallsigns.IsEmpty())
149  {
150  foreach (SCR_BaseRoleCallsign callsign: m_aCharacterRoleCallsigns)
151  {
152  if (callsign.GetRoleIndex() == index)
153  return callsign.GetRoleName();
154  }
155  }
156 
157  Print(string.Format("Given Role index: '%1' does not exist in role data!", index.ToString()), LogLevel.ERROR);
158  return index.ToString();
159  }
160 
167  bool GetRandomCallsign(out int company, out int platoon, out int squad)
168  {
169  company = -1;
170  platoon = -1;
171  squad = -1;
172 
173  if (!m_aCompanyNames || m_aCompanyNames.Count() == 0 || !m_aPlatoonNames || m_aPlatoonNames.Count() == 0 || !m_aSquadNames || m_aSquadNames.Count() == 0)
174  return false;
175 
176  //TODO: Make sure the same callsigns are never assigned twice
177  Math.Randomize(-1);
178  company = Math.RandomInt(0, m_aCompanyNames.Count());
179  platoon = Math.RandomInt(0, m_aPlatoonNames.Count());
180  squad = Math.RandomInt(0, m_aSquadNames.Count());
181 
182  return true;
183  }
184 
196  bool GetCharacterRoleCallsign(IEntity character, int playerID, SCR_AIGroup group, inout int roleCallsignIndex, out bool isUnique)
197  {
198  foreach (SCR_BaseRoleCallsign roleCallsign: m_aCharacterRoleCallsigns)
199  {
200  if (roleCallsign.IsValidRole(character, playerID, group, roleCallsignIndex, isUnique))
201  return true;
202  }
203 
204  return false;
205  }
206 };
SCR_BaseRoleCallsign
Definition: SCR_BaseRoleCallsign.c:2
SCR_FactionCallsignInfo
Definition: SCR_FactionCallsignInfo.c:5
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_CallsignInfo
Definition: SCR_CallsignInfo.c:5
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_AIGroup
Definition: SCR_AIGroup.c:68
LocalizedString
Definition: LocalizedString.c:21
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468