Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CallsignGroupComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Callsign", description: "")]
3 {
4 }
5 
7 class SCR_CallsignGroupComponent : SCR_CallsignBaseComponent
8 {
9  protected bool m_bGroupInitCalled;
10  protected SCR_AIGroup m_Group;
11 
12  //~ TODO: Investigate why AI leaders need to be group character nr 1 if they become leader
13  protected const int iLEADER_ROLE_CHARACTER_CALLSIGN = 1;
14 
16  protected ref map<int, AIAgent> m_mAICallsigns = new map<int, AIAgent>();
17 
19  protected ref map<int, AIAgent> m_mAIRoleCallsigns = new map<int, AIAgent>();
20 
22  protected ref map<int, int> m_mPlayerCallsigns = new map<int, int>();
23 
25  protected ref map<int, int> m_mPlayerRoleCallsigns = new map<int, int>();
26 
27  //~ If the group is a slave than all logic will be handled by the master rather than the slave
29  protected SCR_CallsignGroupComponent m_MasterGroupCallsignComponent;
30 
31  //------------------------------------------------------------------------------------------------
32  //If server assign callsign
33  override void InitOnServer(IEntity owner)
34  {
35  // Always verify the pointer. The object could be deleted by the time it gets here.
36  if (!owner)
37  return;
38 
39  super.InitOnServer(owner);
40 
41  m_Group = SCR_AIGroup.Cast(owner);
42  if (!m_Group)
43  return;
44 
45  //~ Set master group if group is slave
46  if (m_Group.IsSlave())
47  {
48  m_MasterGroup = m_Group.GetMaster();
49 
50  if (m_MasterGroup)
51  m_MasterGroupCallsignComponent = SCR_CallsignGroupComponent.Cast(m_MasterGroup.FindComponent(SCR_CallsignGroupComponent));
52  }
53 
54  //If leader assigned then init group, else wait until leader is assigned
55  IEntity leader = m_Group.GetLeaderEntity();
56  Faction groupFaction;
57  if (leader)
58  groupFaction = SCR_EditableEntityComponent.GetEditableEntity(leader).GetFaction();
59  else
60  groupFaction = m_Group.GetFaction();
61 
62  if (groupFaction)
63  FactionInit(groupFaction);
64 
65  //~ If AI characters are added/removed from group or leader changed
66  m_Group.GetOnAgentAdded().Insert(OnAIAddedToGroup);
67  m_Group.GetOnAgentRemoved().Insert(OnAIRemovedFromGroup);
68  m_Group.GetOnLeaderChanged().Insert(OnAILeaderAssigned);
69 
70  //~ If players are added or removed from group or leader changed
71  m_Group.GetOnPlayerAdded().Insert(OnPlayerAddedToGroup);
72  m_Group.GetOnPlayerRemoved().Insert(OnPlayerRemovedFromGroup);
73  m_Group.GetOnPlayerLeaderChanged().Insert(OnPlayerLeaderAssigned);
74 
75  //~ On faction changed
76  m_Group.GetOnFactionChanged().Insert(OnFactionChanged);
77  }
78 
79  //------------------------------------------------------------------------------------------------
80  protected void OnPlayerAddedToGroup(SCR_AIGroup aiGroup, int playerID)
81  {
82  if (!m_Group || m_Group != aiGroup)
83  return;
84 
85  if (!m_bGroupInitCalled)
86  return;
87 
88  AssignPlayerCallsign(playerID);
89 
90  //No longer one character in group so update callsigns (This includes squad leader)
91  if (m_Group && m_Group.GetPlayerAndAgentCount(true) == 2)
93  }
94 
95  //------------------------------------------------------------------------------------------------
96  protected void OnPlayerRemovedFromGroup(SCR_AIGroup aiGroup, int playerID)
97  {
98  if (!m_Group || m_Group != aiGroup)
99  return;
100 
101  foreach(int characterCallsignNumber, int mapPlayerID : m_mPlayerCallsigns)
102  {
103  if (playerID == mapPlayerID)
104  {
105  m_mPlayerCallsigns.Remove(characterCallsignNumber);
106  break;
107  }
108  }
109 
110  foreach(int characterUniqueRole, int mapPlayerID : m_mPlayerRoleCallsigns)
111  {
112  if (playerID == mapPlayerID)
113  {
114  m_mPlayerRoleCallsigns.Remove(characterUniqueRole);
115  break;
116  }
117  }
118 
120  }
121 
122  //------------------------------------------------------------------------------------------------
123  protected void OnPlayerLeaderAssigned(int groupID, int playerID)
124  {
125  if (!m_Group || m_Group.GetGroupID() != groupID || playerID <= 0)
126  return;
127 
128  //~ If AI is Squad leader remove it
129  if (m_mAIRoleCallsigns.Contains(ERoleCallsign.SQUAD_LEADER))
130  MakeAIRoleAvailable(ERoleCallsign.SQUAD_LEADER);
131 
133  }
134 
135  //------------------------------------------------------------------------------------------------
136  protected void UpdatePlayerRoles()
137  {
138  m_mPlayerRoleCallsigns.Clear();
139 
140  foreach(int characterNumber, int player : m_mPlayerCallsigns)
141  {
142  AssignPlayerCallsign(player, characterNumber);
143  }
144  }
145 
146  //------------------------------------------------------------------------------------------------
147  protected void AssignPlayerCallsign(int playerID, int characterCallsign = -1)
148  {
149  if (!m_CallsignInfo)
150  return;
151 
152  //Assign first availible callsign
153  if (characterCallsign <= 0)
154  {
155  characterCallsign = 1;
156 
157  while (m_mAICallsigns.Contains(characterCallsign) || m_mPlayerCallsigns.Contains(characterCallsign))
158  {
159  characterCallsign++;
160  }
161  }
162 
163  ERoleCallsign roleIndex = -1;
164  bool roleIsUnique;
165  if (m_CallsignInfo.GetCharacterRoleCallsign(SCR_PossessingManagerComponent.GetPlayerMainEntity(playerID), playerID, m_Group, roleIndex, roleIsUnique) && roleIsUnique)
166  {
167  m_mPlayerRoleCallsigns.Set(roleIndex, playerID);
168  }
169 
170  //~ Assigned callsigns will only replicate if the CallsignCharacterComponent has diffrent values
171  m_CallsignManager.SetPlayerCallsign(playerID, m_iCompanyCallsign, m_iPlatoonCallsign, m_iSquadCallsign, characterCallsign, roleIndex);
172 
173  if (characterCallsign >= 0)
174  m_mPlayerCallsigns.Set(characterCallsign, playerID);
175  }
176 
177  //------------------------------------------------------------------------------------------------
178  //~ Clears and reassigns all Player and AI callsigns
180  {
182 
183  m_mAIRoleCallsigns.Clear();
184  array<AIAgent> agents = {};
185  SCR_CallsignCharacterComponent characterCallsignComponent;
186 
187  if (m_Group)
188  m_Group.GetAgents(agents);
189 
190  foreach (AIAgent agent: agents)
191  {
192  characterCallsignComponent = SCR_CallsignCharacterComponent.Cast(agent.GetControlledEntity().FindComponent(SCR_CallsignCharacterComponent));
193 
194  if (characterCallsignComponent)
195  {
196  int characterCallsign, roleCallsign;
197  characterCallsignComponent.GetCharacterAndRoleCallsign(characterCallsign, roleCallsign);
198  characterCallsignComponent.ClearCharacterRoleCallsign();
199  AssignAICallsign(agent, characterCallsignComponent, characterCallsign);
200  }
201  }
202  }
203 
204  //------------------------------------------------------------------------------------------------
210  bool IsUniqueRoleInUse(int roleToCheck)
211  {
212  if (m_Group.IsSlave())
213  {
214  SCR_AIGroup master = m_Group.GetMaster();
215 
216  if (master)
217  {
218  SCR_CallsignGroupComponent masterCallsignComponent = SCR_CallsignGroupComponent.Cast(master.FindComponent(SCR_CallsignGroupComponent));
219 
220  if (masterCallsignComponent)
221  return masterCallsignComponent.IsUniqueRoleInUse(roleToCheck);
222  }
223  }
224 
225  //~ Was not slave or master group could not be obtained for some reason
226  return m_mAIRoleCallsigns.Contains(roleToCheck) || m_mPlayerRoleCallsigns.Contains(roleToCheck);
227  }
228 
229  //------------------------------------------------------------------------------------------------
230  //Called if group is created by editor to get correct faction
231  protected void OnAILeaderAssigned(AIAgent currentLeader, AIAgent prevLeader)
232  {
233  //~ Player has become leader not AI
234  if (currentLeader && SCR_PossessingManagerComponent.GetPlayerIdFromMainEntity(currentLeader.GetControlledEntity()) > 0)
235  return;
236 
237  //Group init
238  if (!m_bGroupInitCalled)
239  {
240  if (!currentLeader)
241  return;
242 
243  IEntity leader = currentLeader.GetControlledEntity();
244  FactionInit(SCR_EditableEntityComponent.GetEditableEntity(leader).GetFaction());
245  }
246  else
247  {
248  ReplaceAILeaderRole(currentLeader, prevLeader);
249  }
250  }
251 
252  //------------------------------------------------------------------------------------------------
253  //If leader was replaced and both characters are still alive and in the same group
254  //Note this only works if the actual leader is replaced in the SCR_AIGroup component, it will not override the callsign if it is not a leader
255  protected void ReplaceAILeaderRole(AIAgent currentLeader, AIAgent prevLeader)
256  {
257  if (!m_bIsServer)
258  return;
259 
260  //~ Make sure both agents are alive, not the same character and in the same group
261  if (currentLeader == null || prevLeader == null || currentLeader == prevLeader || currentLeader.GetParentGroup() != prevLeader.GetParentGroup())
262  return;
263 
264  SCR_CallsignCharacterComponent prevLeaderCallsignComponent = SCR_CallsignCharacterComponent.Cast(prevLeader.GetControlledEntity().FindComponent(SCR_CallsignCharacterComponent));
265  if (!prevLeaderCallsignComponent)
266  return;
267 
268  int prevLeaderCharacterCallsign, prevLeaderRoleCallsign
269  prevLeaderCallsignComponent.GetCharacterAndRoleCallsign(prevLeaderCharacterCallsign, prevLeaderRoleCallsign);
270 
271  if (prevLeaderRoleCallsign != ERoleCallsign.SQUAD_LEADER)
272  return;
273 
274  //~ Have system assign a new character callsign to the leader. Will change character callsign from 1 and assign a new role if any
275  AssignAICallsign(prevLeader, prevLeaderCallsignComponent);
276 
277  //~ Make leader role availible so it is auto assigned to the new leader
278  MakeAIRoleAvailable(ERoleCallsign.SQUAD_LEADER);
279  }
280 
281  //------------------------------------------------------------------------------------------------
282  protected void OnAIAddedToGroup(notnull AIAgent character)
283  {
284  //~ Player was added to group not AI
285  if (SCR_PossessingManagerComponent.GetPlayerIdFromMainEntity(character.GetControlledEntity()) > 0)
286  return;
287 
288  if (!m_bGroupInitCalled)
289  return;
290 
291  SCR_CallsignCharacterComponent characterCallsignComponent = SCR_CallsignCharacterComponent.Cast(character.GetControlledEntity().FindComponent(SCR_CallsignCharacterComponent));
292 
293  if (characterCallsignComponent)
294  AssignAICallsign(character, characterCallsignComponent);
295 
296  //No longer one character in group so update callsigns (This includes squad leader)
297  if (m_Group && m_Group.GetPlayerAndAgentCount(true) == 2)
299  }
300 
301  //------------------------------------------------------------------------------------------------
302  protected void OnAIRemovedFromGroup(SCR_AIGroup group, AIAgent character)
303  {
304  //~ Player was added to group not AI
305  if (SCR_PossessingManagerComponent.GetPlayerIdFromMainEntity(character.GetControlledEntity()) > 0)
306  return;
307 
308  if (!m_bGroupInitCalled)
309  return;
310 
311  SCR_CallsignCharacterComponent characterCallsignComponent = SCR_CallsignCharacterComponent.Cast(character.GetControlledEntity().FindComponent(SCR_CallsignCharacterComponent));
312 
313  if (!characterCallsignComponent)
314  return;
315 
316  int characterIndex, roleIndex;
317  characterCallsignComponent.GetCharacterAndRoleCallsign(characterIndex, roleIndex);
318 
319  //Make character callsign availible
320  if (m_mAICallsigns.Contains(characterIndex))
321  m_mAICallsigns.Remove(characterIndex);
322 
323  MakeAIRoleAvailable(roleIndex);
324 
325  //Only one character in group so make sure squad leader is not assigned
326  if (m_Group && m_Group.GetPlayerAndAgentCount(true) == 1)
328  }
329 
330  //------------------------------------------------------------------------------------------------
331  protected void AssignAICallsign(AIAgent character, SCR_CallsignCharacterComponent characterCallsignComponent, int characterCallsign = -1)
332  {
333  if (!m_CallsignInfo)
334  return;
335 
336  //Assign first availible callsign
337  if (characterCallsign <= 0)
338  {
339  characterCallsign = 1;
340 
341  while (m_mAICallsigns.Contains(characterCallsign) || m_mPlayerCallsigns.Contains(characterCallsign))
342  {
343  characterCallsign++;
344  }
345  }
346 
347  //Assign specific role callsign
348  int roleIndex = -1;
349  bool isUnique;
350  if (m_CallsignInfo.GetCharacterRoleCallsign(character.GetControlledEntity(), -1, m_Group, roleIndex, isUnique) && isUnique)
351  {
352  m_mAIRoleCallsigns.Set(roleIndex, character);
353  }
354 
355  //Assign callsign
356  characterCallsignComponent.AssignCharacterCallsign(m_Faction, m_iCompanyCallsign, m_iPlatoonCallsign, m_iSquadCallsign, characterCallsign, roleIndex, (!m_Group || m_Group.GetPlayerAndAgentCount(true) <= 1));
357 
358  if (characterCallsign >= 0)
359  m_mAICallsigns.Set(characterCallsign, character);
360  }
361 
362  //------------------------------------------------------------------------------------------------
363  protected void MakeAIRoleAvailable(int roleIndex)
364  {
365  if (roleIndex < 0)
366  return;
367 
368  //Make character role callsign availible
369  if (m_mAIRoleCallsigns.Contains(roleIndex))
370  m_mAIRoleCallsigns.Remove(roleIndex);
371 
372  array<AIAgent> agents = {};
373  SCR_CallsignCharacterComponent characterCallsignComponent;
374 
375  int characterCallsign, currentRoleCallsign;
376  bool roleReassigned = false;
377 
378  m_Group.GetAgents(agents);
379 
380  //Go over each character to check if role can be reassigned to another character
381  foreach (AIAgent agent: agents)
382  {
383  if (SCR_PossessingManagerComponent.GetPlayerIdFromMainEntity(agent.GetControlledEntity()) > 0)
384  continue;
385 
386  characterCallsignComponent = SCR_CallsignCharacterComponent.Cast(agent.GetControlledEntity().FindComponent(SCR_CallsignCharacterComponent));
387  if (!characterCallsignComponent)
388  continue;
389 
390  characterCallsignComponent.GetCharacterAndRoleCallsign(characterCallsign, currentRoleCallsign);
391 
392  //Do not assign roles to characters that already have a role (Unless squad leader)
393  if (currentRoleCallsign >= 0 && roleIndex != ERoleCallsign.SQUAD_LEADER)
394  continue;
395 
396  bool isUnique;
397  if (m_CallsignInfo.GetCharacterRoleCallsign(agent.GetControlledEntity(), -1, m_Group, roleIndex, isUnique))
398  {
399  //~ Update role
400  if (roleIndex != ERoleCallsign.SQUAD_LEADER)
401  {
402  characterCallsignComponent.UpdateCharacterRoleCallsign(roleIndex);
403  }
404  //~ Replace leader
405  else
406  {
407  characterCallsignComponent.UpdateCharacterCallsignAndRole(iLEADER_ROLE_CHARACTER_CALLSIGN, roleIndex);
408 
409  if (m_mAICallsigns.Contains(characterCallsign))
410  m_mAICallsigns.Remove(characterCallsign);
411 
413  }
414 
415  //~ Update role map
416  if (isUnique)
417  m_mAIRoleCallsigns.Set(roleIndex, agent);
418 
419  roleReassigned = true;
420  break;
421  }
422  }
423 
424  //~ Had a prev role make it availible again (Only called if new role assigned is Squad leader else it will never reach this)
425  if (roleReassigned && currentRoleCallsign >= 0)
426  MakeAIRoleAvailable(currentRoleCallsign);
427  }
428 
429  //------------------------------------------------------------------------------------------------
430  override bool GetCallsignNames(out string company, out string platoon, out string squad, out string character, out string format)
431  {
432  int companyCallsignIndex, platoonCallsignIndex, squadCallsignIndex, emptyCharacter;
433  character = string.Empty;
434 
435  if (!GetCallsignIndexes(companyCallsignIndex, platoonCallsignIndex, squadCallsignIndex, emptyCharacter))
436  return false;
437 
438  //No callsign data
439  if (!SetCallsignInfo())
440  {
441  company = companyCallsignIndex.ToString();
442  platoon = platoonCallsignIndex.ToString();
443  squad = squadCallsignIndex.ToString();
444 
445  format = "ERROR %1-%2-%3";
446 
447  return true;
448  }
449 
450  company = m_CallsignInfo.GetCompanyCallsignName(companyCallsignIndex);
451  platoon = m_CallsignInfo.GetPlatoonCallsignName(platoonCallsignIndex);
452  squad = m_CallsignInfo.GetSquadCallsignName(squadCallsignIndex);
453 
454  format = m_CallsignInfo.GetCallsignFormat(false);
455  return true;
456  }
457 
458  //------------------------------------------------------------------------------------------------
459  override bool GetCallsignIndexes(out int companyIndex, out int platoonIndex, out int squadIndex, out int characterNumber = -1, out ERoleCallsign characterRole = ERoleCallsign.NONE)
460  {
461  characterNumber = -1;
462 
463  if (m_iCompanyCallsign < 0 || m_iPlatoonCallsign < 0 || m_iSquadCallsign < 0)
464  {
465  companyIndex = -1;
466  platoonIndex = -1;
467  squadIndex = -1;
468  return false;
469  }
470 
471  companyIndex = m_iCompanyCallsign;
472  platoonIndex = m_iPlatoonCallsign;
473  squadIndex = m_iSquadCallsign;
474 
475  return true;
476  }
477 
478  //------------------------------------------------------------------------------------------------
479  // TODO: Callsigns should have logic as to how they are assigned as now there can be duplicants and there is no structure (eg Alpha-Red-1 should be followed by Alpha-Red-2)
480  protected void AssignGroupCallsign()
481  {
482  if (!m_CallsignManager)
483  return;
484 
485  int company, platoon, squad;
486  m_CallsignManager.AssignCallGroupCallsign(m_Faction, m_MasterGroupCallsignComponent, company, platoon, squad);
487 
488  AssignCallsignBroadcast(company, platoon, squad);
489  Rpc(AssignCallsignBroadcast, company, platoon, squad);
490  }
491 
492  //------------------------------------------------------------------------------------------------
493  [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
494  protected void AssignCallsignBroadcast(int company, int platoon, int squad)
495  {
496  if (company == m_iCompanyCallsign && m_iPlatoonCallsign == platoon && m_iSquadCallsign == squad)
497  return;
498 
499  m_iCompanyCallsign = company;
500  m_iPlatoonCallsign = platoon;
501  m_iSquadCallsign = squad;
502 
503  Event_OnCallsignChanged.Invoke(m_iCompanyCallsign, m_iPlatoonCallsign, m_iSquadCallsign, -1, -1);
504  }
505 
506  //------------------------------------------------------------------------------------------------
510  void FactionInit(Faction faction, bool isFactionChange = false)
511  {
512  //~ Faction is changed but is the same as before
513  if (isFactionChange && faction == m_Faction)
514  return;
515 
516  Faction prevFaction = m_Faction;
517  m_Faction = faction;
518 
519  //Server only
520  if (!m_bIsServer)
521  return;
522 
523  if (!SetCallsignInfo())
524  return;
525 
526  //Faction is changed so make current callsign availible again
527  if (isFactionChange)
528  {
529  if (!prevFaction || !m_CallsignManager)
530  return;
531 
532  if (m_iCompanyCallsign >= 0)
533  {
534  m_CallsignManager.MakeGroupCallsignAvailible(prevFaction, m_iCompanyCallsign, m_iPlatoonCallsign, m_iSquadCallsign);
535  }
536  //Clears assigned callsign
537  ClearCallsigns();
538 
539  //Clear character callsigns
540  m_mAICallsigns.Clear();
541  m_mAIRoleCallsigns.Clear();
542  }
543 
544  if (!SetCallsignInfo())
545  return;
546 
547  m_bGroupInitCalled = true;
548 
549  //Assign group callsign
551 
552  array<AIAgent> agents = {};
553  SCR_CallsignCharacterComponent characterCallsignComponent;
554 
555  m_Group.GetAgents(agents);
556 
557  //If callsigns are assigned at random randomize group as well on init
558  array<int> availibleRandomCallsigns = {};
559  if (m_CallsignInfo.GetIsAssignedRandomly())
560  {
561  int count = agents.Count();
562 
563  while(count > 0)
564  {
565  availibleRandomCallsigns.Insert(count);
566  count--;
567  }
568  }
569 
570  //Assign callsigns for each character in group
571  foreach (AIAgent agent: agents)
572  {
573  characterCallsignComponent = SCR_CallsignCharacterComponent.Cast(agent.GetControlledEntity().FindComponent(SCR_CallsignCharacterComponent));
574  characterCallsignComponent.ClearCallsigns();
575 
576  if (characterCallsignComponent)
577  AssignAICallsign(agent, characterCallsignComponent);
578 
579  //~ Replace line above if you want character callsigns to also be randomized
580 // {
581 // if (m_CallsignInfo.GetIsAssignedRandomly())
582 // {
583 // Math.Randomize(-1);
584 // int randomIndex = Math.RandomInt(0, availibleRandomCallsigns.Count());
585 // int randomCharacterCallsign = availibleRandomCallsigns[randomIndex];
586 // availibleRandomCallsigns.Remove(randomIndex);
587 //
588 // AssignCharacterCallsign(agent, characterCallsignComponent, randomCharacterCallsign);
589 // }
590 // else
591 // {
592 // AssignCharacterCallsign(agent, characterCallsignComponent);
593 // }
594 // }
595  }
596  }
597 
598  //------------------------------------------------------------------------------------------------
599  protected void OnFactionChanged(Faction faction)
600  {
601  FactionInit(faction, m_Faction && m_Faction != faction);
602  }
603 
604  //------------------------------------------------------------------------------------------------
605  override bool RplSave(ScriptBitWriter writer)
606  {
607  writer.WriteInt(m_iCompanyCallsign);
608  writer.WriteInt(m_iPlatoonCallsign);
609  writer.WriteInt(m_iSquadCallsign);
610 
611  return true;
612  }
613 
614  //------------------------------------------------------------------------------------------------
615  override bool RplLoad(ScriptBitReader reader)
616  {
617  int company, platoon, squad, groupSize;
618 
619  reader.ReadInt(company);
620  reader.ReadInt(platoon);
621  reader.ReadInt(squad);
622 
623  AssignCallsignBroadcast(company, platoon, squad);
624 
625  return true;
626  }
627 
628  //------------------------------------------------------------------------------------------------
629  // destructor
631  {
632  if (!m_bIsServer || m_iCompanyCallsign < 0 || !m_Faction || !m_CallsignManager)
633  return;
634 
635  m_CallsignManager.MakeGroupCallsignAvailible(m_Faction, m_iCompanyCallsign, m_iPlatoonCallsign, m_iSquadCallsign);
636  }
637 }
AssignAICallsign
protected void AssignAICallsign(AIAgent character, SCR_CallsignCharacterComponent characterCallsignComponent, int characterCallsign=-1)
Definition: SCR_CallsignGroupComponent.c:331
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
m_MasterGroup
protected SCR_AIGroup m_MasterGroup
Definition: SCR_CallsignGroupComponent.c:28
OnPlayerLeaderAssigned
protected void OnPlayerLeaderAssigned(int groupID, int playerID)
Definition: SCR_CallsignGroupComponent.c:123
UpdateAllCharacterRoleCallsigns
protected void UpdateAllCharacterRoleCallsigns()
Definition: SCR_CallsignGroupComponent.c:179
AssignPlayerCallsign
protected void AssignPlayerCallsign(int playerID, int characterCallsign=-1)
Definition: SCR_CallsignGroupComponent.c:147
UpdatePlayerRoles
protected void UpdatePlayerRoles()
Definition: SCR_CallsignGroupComponent.c:136
SCR_CallsignGroupComponentClass
Definition: SCR_CallsignGroupComponent.c:2
InitOnServer
override void InitOnServer(IEntity owner)
Definition: SCR_CallsignGroupComponent.c:33
~SCR_CallsignGroupComponent
void ~SCR_CallsignGroupComponent()
Definition: SCR_CallsignGroupComponent.c:630
ClearCallsigns
override void ClearCallsigns()
Called on server only before assigning new callsign to make sure everything is clear....
Definition: SCR_CallsignCharacterComponent.c:171
m_Group
protected SCR_AIGroup m_Group
Definition: SCR_CallsignGroupComponent.c:10
ERoleCallsign
ERoleCallsign
Definition: ERoleCallsign.c:4
IsUniqueRoleInUse
bool IsUniqueRoleInUse(int roleToCheck)
Definition: SCR_CallsignGroupComponent.c:210
OnPlayerAddedToGroup
protected void OnPlayerAddedToGroup(SCR_AIGroup aiGroup, int playerID)
Definition: SCR_CallsignGroupComponent.c:80
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
GetCallsignNames
override bool GetCallsignNames(out string company, out string platoon, out string squad, out string character, out string format)
Definition: SCR_CallsignGroupComponent.c:430
SCR_CallsignBaseComponent
Component of assigning and storing squad names.
Definition: SCR_CallsignBaseComponent.c:11
AssignGroupCallsign
protected void AssignGroupCallsign()
Definition: SCR_CallsignGroupComponent.c:480
OnAIRemovedFromGroup
protected void OnAIRemovedFromGroup(SCR_AIGroup group, AIAgent character)
Definition: SCR_CallsignGroupComponent.c:302
m_CallsignInfo
protected ref SCR_FactionCallsignInfo m_CallsignInfo
Definition: SCR_Faction.c:29
m_MasterGroupCallsignComponent
protected SCR_CallsignGroupComponent m_MasterGroupCallsignComponent
Definition: SCR_CallsignGroupComponent.c:29
OnPlayerRemovedFromGroup
protected void OnPlayerRemovedFromGroup(SCR_AIGroup aiGroup, int playerID)
Definition: SCR_CallsignGroupComponent.c:96
MakeAIRoleAvailable
protected void MakeAIRoleAvailable(int roleIndex)
Definition: SCR_CallsignGroupComponent.c:363
m_bGroupInitCalled
SCR_CallsignGroupComponentClass m_bGroupInitCalled
Component of assigning and storing squad names.
iLEADER_ROLE_CHARACTER_CALLSIGN
const protected int iLEADER_ROLE_CHARACTER_CALLSIGN
Definition: SCR_CallsignGroupComponent.c:13
OnAIAddedToGroup
protected void OnAIAddedToGroup(notnull AIAgent character)
Definition: SCR_CallsignGroupComponent.c:282
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
Faction
Definition: Faction.c:12
m_mPlayerRoleCallsigns
protected ref map< int, int > m_mPlayerRoleCallsigns
Keeps track of specific AI role callsigns in group. map<RoleID, PlayerID>
Definition: SCR_CallsignGroupComponent.c:25
OnFactionChanged
protected void OnFactionChanged(Faction faction)
Definition: SCR_CallsignGroupComponent.c:599
RplSave
override bool RplSave(ScriptBitWriter writer)
Definition: SCR_CallsignGroupComponent.c:605
SCR_AIGroup
Definition: SCR_AIGroup.c:68
GetCallsignIndexes
override bool GetCallsignIndexes(out int companyIndex, out int platoonIndex, out int squadIndex, out int characterNumber=-1, out ERoleCallsign characterRole=ERoleCallsign.NONE)
Definition: SCR_CallsignGroupComponent.c:459
SCR_CallsignBaseComponentClass
Definition: SCR_CallsignBaseComponent.c:2
m_Faction
Faction m_Faction
Definition: SCR_AITargetInfo.c:18
m_mPlayerCallsigns
protected ref map< int, int > m_mPlayerCallsigns
Keeps track of player callsigns in group <Callsign, PlayerID>. Player callsigns never change.
Definition: SCR_CallsignGroupComponent.c:22
AssignCallsignBroadcast
protected void AssignCallsignBroadcast(int company, int platoon, int squad)
Definition: SCR_CallsignGroupComponent.c:494
ReplaceAILeaderRole
protected void ReplaceAILeaderRole(AIAgent currentLeader, AIAgent prevLeader)
Definition: SCR_CallsignGroupComponent.c:255
m_mAIRoleCallsigns
protected ref map< int, AIAgent > m_mAIRoleCallsigns
Keeps track of specific AI role callsigns in group.
Definition: SCR_CallsignGroupComponent.c:19
FactionInit
void FactionInit(Faction faction, bool isFactionChange=false)
Definition: SCR_CallsignGroupComponent.c:510
OnAILeaderAssigned
protected void OnAILeaderAssigned(AIAgent currentLeader, AIAgent prevLeader)
Definition: SCR_CallsignGroupComponent.c:231
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180
RplLoad
override bool RplLoad(ScriptBitReader reader)
Definition: SCR_CallsignGroupComponent.c:615
m_mAICallsigns
protected ref map< int, AIAgent > m_mAICallsigns
Keeps track of AI callsigns in group.
Definition: SCR_CallsignGroupComponent.c:16