Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_FactionManager.c
Go to the documentation of this file.
1 //~ Event when player faction changed
2 void SCR_FactionManager_PlayerFactionChanged(int playerId, SCR_PlayerFactionAffiliationComponent playerFactionAffiliationComponent, Faction faction);
4 
6 {
7 }
8 
9 class SCR_FactionManager : FactionManager
10 {
11  [Attribute(defvalue: "1", desc: "Whether or not the isPlayable state of a faction can be changed on run time")]
12  protected bool m_bCanChangeFactionsPlayable;
13 
14  [Attribute("", UIWidgets.Object, "List of rank types")]
15  protected ref array<ref SCR_RankID> m_aRanks;
16 
17  protected ref SCR_SortedArray<SCR_Faction> m_SortedFactions = new SCR_SortedArray<SCR_Faction>();
18  protected ref map<string, ref array<string>> m_aAncestors = new map<string, ref array<string>>();
19 
21  [RplProp(onRplName: "OnPlayerFactionInfoChanged")]
22  protected ref array<ref SCR_PlayerFactionInfo> m_aPlayerFactionInfo = {};
23 
25  protected ref map<int, int> m_PreviousPlayerFactions = new map<int, int>();
26 
28  protected ref set<int> m_ChangedFactions = new set<int>();
29 
31  protected ref map<int, ref SCR_PlayerFactionInfo> m_MappedPlayerFactionInfo = new map<int, ref SCR_PlayerFactionInfo>();
32 
34  protected ref map<int, int> m_PlayerCount = new map<int, int>();
35 
36  //~ Script invokers
37  protected ref ScriptInvoker s_OnPlayerFactionCountChanged = new ScriptInvoker();
38  //~ Server only \/
39  protected ref ScriptInvokerBase<SCR_FactionManager_PlayerFactionChanged> m_OnPlayerFactionChanged_S;
40 
41  //------------------------------------------------------------------------------------------------
44  {
46  s_OnPlayerFactionCountChanged = new ScriptInvoker();
47 
49  }
50 
51  //------------------------------------------------------------------------------------------------
53  ScriptInvokerBase<SCR_FactionManager_PlayerFactionChanged> GetOnPlayerFactionChanged_S()
54  {
56  m_OnPlayerFactionChanged_S = new ScriptInvokerBase<SCR_FactionManager_PlayerFactionChanged>();
57 
59  }
60 
61  //------------------------------------------------------------------------------------------------
63  protected void OnPlayerFactionInfoChanged()
64  {
65  // Store previous factions, so we can raise events
66  m_ChangedFactions.Clear();
68  foreach (int id, SCR_PlayerFactionInfo factionInfo : m_MappedPlayerFactionInfo)
69  {
70  int factionIndex = -1;
71  if (factionInfo)
72  factionIndex = factionInfo.GetFactionIndex();
73 
74  m_PreviousPlayerFactions.Set(id, factionIndex);
75  }
76 
77  // Clear all records and rebuild them from scratch
79  m_PlayerCount.Clear();
80  for (int i = 0, cnt = m_aPlayerFactionInfo.Count(); i < cnt; i++)
81  {
82  // Map player to info
83  int playerId = m_aPlayerFactionInfo[i].GetPlayerId();
84  m_MappedPlayerFactionInfo.Insert(playerId, m_aPlayerFactionInfo[i]);
85 
86  // Resolve player-faction count
87  int playerFactionIndex = m_aPlayerFactionInfo[i].GetFactionIndex();
88  if (playerFactionIndex != -1)
89  {
90  int previousCount;
91  m_PlayerCount.Find(playerFactionIndex, previousCount);
92  m_PlayerCount.Set(playerFactionIndex, previousCount+1);
93  }
94 
95  // If player count changed, append to temp list
96  int previousFactionIndex;
97  if (!m_PreviousPlayerFactions.Find(playerId, previousFactionIndex))
98  previousFactionIndex = -1; // If player had no affiliated faction previously, always assume none instead
99 
100  if (previousFactionIndex != playerFactionIndex)
101  {
102  m_ChangedFactions.Insert(previousFactionIndex);
103  m_ChangedFactions.Insert(playerFactionIndex);
104  }
105  }
106 
107  // Raise callback for all factions of which the count has changed
108  foreach (int factionIndex : m_ChangedFactions)
109  {
110  // Null faction
111  if (factionIndex == -1)
112  continue;
113 
114  Faction faction = GetFactionByIndex(factionIndex);
115  int count;
116  m_PlayerCount.Find(factionIndex, count);
117  OnPlayerFactionCountChanged(faction, count);
118  }
119  }
120 
121  //------------------------------------------------------------------------------------------------
124  protected void OnPlayerFactionSet_S(SCR_PlayerFactionAffiliationComponent playerComponent, Faction faction)
125  {
127  m_OnPlayerFactionChanged_S.Invoke(playerComponent.GetPlayerId(), playerComponent, faction);
128 
129  #ifdef _ENABLE_RESPAWN_LOGS
130  Print(string.Format("%1::OnPlayerFactionSet_S(playerId: %2, faction: %3)", Type().ToString(), playerComponent.GetPlayerId(), faction), LogLevel.NORMAL);
131  #endif
132  }
133 
134  //------------------------------------------------------------------------------------------------
142  protected void OnPlayerFactionCountChanged(Faction faction, int newCount)
143  {
145  s_OnPlayerFactionCountChanged.Invoke(faction, newCount);
146 
147  #ifdef _ENABLE_RESPAWN_LOGS
148  FactionKey key;
149  if (faction)
150  key = faction.GetFactionKey();
151 
152  Print(string.Format("%1::OnPlayerFactionCountChanged(faction: %2 [%3], count: %4)", Type().ToString(), faction, key, newCount), LogLevel.NORMAL);
153  #endif
154  }
155 
156  //------------------------------------------------------------------------------------------------
161  Faction GetPlayerFaction(int playerId)
162  {
164  if (m_MappedPlayerFactionInfo.Find(playerId, info))
165  {
166  int factionIndex = info.GetFactionIndex();
167  return GetFactionByIndex(factionIndex);
168  }
169 
170  return null;
171  }
172 
173  //------------------------------------------------------------------------------------------------
180  static Faction SGetPlayerFaction(int playerId)
181  {
182  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
183  return factionManager.GetPlayerFaction(playerId);
184  }
185 
186  //------------------------------------------------------------------------------------------------
191  {
192  int localPlayerId = SCR_PlayerController.GetLocalPlayerId();
193  return GetPlayerFaction(localPlayerId);
194  }
195 
196  //------------------------------------------------------------------------------------------------
202  static Faction SGetLocalPlayerFaction()
203  {
204  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
205  if (!factionManager)
206  return null;
207 
208  return factionManager.GetLocalPlayerFaction();
209  }
210 
211  //------------------------------------------------------------------------------------------------
216  {
217  if (!faction)
218  return 0;
219 
220  int playerCount;
221  m_PlayerCount.Find(GetFactionIndex(faction), playerCount);
222  return playerCount;
223  }
224 
225  //------------------------------------------------------------------------------------------------
232  static int SGetFactionPlayerCount(Faction faction)
233  {
234  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
235  return factionManager.GetFactionPlayerCount(faction);
236  }
237 
238  //------------------------------------------------------------------------------------------------
242  int GetSortedFactionsList(out notnull SCR_SortedArray<SCR_Faction> outFactions)
243  {
244  return outFactions.CopyFrom(m_SortedFactions);
245  }
246 
247  //------------------------------------------------------------------------------------------------
250  SCR_RankID GetRankByID(SCR_ECharacterRank rankID)
251  {
252  if (!m_aRanks)
253  return null;
254 
255  foreach (SCR_RankID rank: m_aRanks)
256  {
257  if (rank && rank.GetRankID() == rankID)
258  return rank;
259  }
260 
261  return null;
262  }
263 
264  //------------------------------------------------------------------------------------------------
266  array<ref SCR_RankID> GetAllAvailableRanks()
267  {
268  array<ref SCR_RankID> outArray = {};
269  foreach (SCR_RankID rank: m_aRanks)
270  {
271  outArray.Insert(rank);
272  }
273 
274  return outArray;
275  }
276 
277  //------------------------------------------------------------------------------------------------
281  {
282  SCR_RankID rank = GetRankByID(rankID);
283 
284  if (rank)
285  return rank.IsRankRenegade();
286  else
287  return false;
288  }
289 
290  //------------------------------------------------------------------------------------------------
294  {
295  SCR_RankID rank = SCR_RankID.Cast(GetRankByID(rankID));
296 
297  if (!rank)
298  return int.MAX;
299 
300  return rank.GetRequiredRankXP();
301  }
302 
303  //------------------------------------------------------------------------------------------------
305  {
306  foreach (SCR_RankID rank: m_aRanks)
307  {
308  if (rank && rank.IsRankRenegade())
309  return rank.GetRankID();
310  }
311 
312  return SCR_ECharacterRank.INVALID;
313  }
314 
315  //------------------------------------------------------------------------------------------------
319  {
320  if (!m_aRanks)
321  return SCR_ECharacterRank.INVALID;
322 
323  int maxFoundXP = -100000;
324  SCR_ECharacterRank rankFound = GetRenegadeRank();
325 
326  foreach (SCR_RankID rank: m_aRanks)
327  {
328  int reqXP = GetRequiredRankXP(rank.GetRankID());
329 
330  if (reqXP <= XP && reqXP > maxFoundXP)
331  {
332  maxFoundXP = reqXP;
333  rankFound = rank.GetRankID();
334  }
335  }
336 
337  return rankFound;
338  }
339 
340  //------------------------------------------------------------------------------------------------
344  {
345  int rankXP = GetRequiredRankXP(rank);
346  int higherXP = 99999;
347  SCR_ECharacterRank foundID = SCR_ECharacterRank.INVALID;
348 
349  foreach (SCR_RankID r: m_aRanks)
350  {
351  if (!r)
352  continue;
353 
354  SCR_ECharacterRank ID = r.GetRankID();
355  int thisXP = GetRequiredRankXP(ID);
356 
357  if (thisXP > rankXP && thisXP < higherXP)
358  {
359  higherXP = thisXP;
360  foundID = ID;
361  }
362  }
363 
364  return foundID;
365  }
366 
367  //------------------------------------------------------------------------------------------------
371  {
372  int rankXP = GetRequiredRankXP(rank);
373  int lowerXP = -99999;
374  SCR_ECharacterRank foundID = SCR_ECharacterRank.INVALID;
375 
376  foreach (SCR_RankID r: m_aRanks)
377  {
378  if (!r)
379  continue;
380 
381  SCR_ECharacterRank ID = r.GetRankID();
382  int thisXP = GetRequiredRankXP(ID);
383 
384  if (thisXP < rankXP && thisXP > lowerXP)
385  {
386  lowerXP = thisXP;
387  foundID = ID;
388  }
389  }
390 
391  return foundID;
392  }
393 
394  //------------------------------------------------------------------------------------------------
395  override void EOnInit(IEntity owner)
396  {
397  array<string> ancestors;
398  array<Faction> factions = {};
399  GetFactionsList(factions);
400  for (int i = factions.Count() - 1; i >= 0; i--)
401  {
402  SCR_Faction scriptedFaction = SCR_Faction.Cast(factions[i]);
403  if (scriptedFaction)
404  {
405  if (m_aAncestors.Find(scriptedFaction.GetFactionKey(), ancestors))
406  scriptedFaction.SetAncestors(ancestors);
407 
408  m_SortedFactions.Insert(scriptedFaction.GetOrder(), scriptedFaction);
409 
410  scriptedFaction.InitializeFaction();
411  }
412  }
413  m_aAncestors = null; //--- Don't keep in the memory anymore, stored on factions now
414 
415  //--- Initialise components (OnPostInit doesn't work in them)
417  array<Managed> components = {};
418  for (int i = 0, count = owner.FindComponents(SCR_BaseFactionManagerComponent, components); i < count; i++)
419  {
420  component = SCR_BaseFactionManagerComponent.Cast(components[i]);
421  component.OnFactionsInit(factions);
422  }
423 
424  //--- Hook player disconnection event
425  #ifdef WORKBENCH
426  if (!GetGame().InPlayMode())
427  return;
428  #endif
429 
431  gameMode.GetOnPlayerDisconnected().Insert(OnPlayerDisconnected);
432  }
433 
434  #ifdef ENABLE_DIAG
435  //------------------------------------------------------------------------------------------------
436  protected override void EOnDiag(IEntity owner, float timeSlice)
437  {
438  super.EOnDiag(owner, timeSlice);
439 
440  if (!DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_RESPAWN_PLAYER_FACTION_DIAG))
441  return;
442 
443  DbgUI.Begin("SCR_FactionManager");
444  {
445  DbgUI.Text("* Faction Player Count *");
446  array<Faction> factions = {};
447  GetFactionsList(factions);
448  foreach (Faction faction : factions)
449  {
450  DbgUI.Text(string.Format("%1: %2 player(s)", faction.GetFactionKey(), GetFactionPlayerCount(faction)));
451  }
452  }
453  DbgUI.End();
454  }
455  #endif
456 
457  //------------------------------------------------------------------------------------------------
458  // constructor
461  void SCR_FactionManager(IEntitySource src, IEntity parent)
462  {
463  SetEventMask(EntityEvent.INIT);
464  #ifdef ENABLE_DIAG
465  ConnectToDiagSystem();
466  #endif
467 
468  //--- Save faction ancestors
469  BaseContainerList factionSources = src.GetObjectArray("Factions");
470  BaseContainer factionSource;
471  string factionKey, parentKey;
472  for (int i, count = factionSources.Count(); i < count; i++)
473  {
474  factionSource = factionSources.Get(i);
475  factionSource.Get("FactionKey", factionKey);
476 
477  array<string> ancestors = {};
478  while (factionSource)
479  {
480  factionSource.Get("FactionKey", parentKey);
481  if (!ancestors.Contains(parentKey))
482  ancestors.Insert(parentKey);
483 
484  factionSource = factionSource.GetAncestor();
485  }
486 
487  m_aAncestors.Insert(factionKey, ancestors);
488  }
489  }
490 
491  //------------------------------------------------------------------------------------------------
492  // destructor
494  {
495  #ifdef ENABLE_DIAG
496  DisconnectFromDiagSystem();
497  #endif
498  }
499 
500  //------------------------------------------------------------------------------------------------
505  {
506  return m_bCanChangeFactionsPlayable;
507  }
508 
509  //======================================== FACTION RELATIONS ========================================\\
510 
511  //------------------------------------------------------------------------------------------------
517  void SetFactionsFriendly(notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged = -1)
518  {
519  //~ Already friendly
520  if (factionA.DoCheckIfFactionFriendly(factionB))
521  return;
522 
523  //~ Only call once if setting self as friendly
524  if (factionA == factionB)
525  {
526  factionA.SetFactionFriendly(factionA);
527 
528  if (playerChanged > 0)
529  SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_FACTION_SET_FRIENDLY_TO_SELF, playerChanged, GetFactionIndex(factionA));
530 
532  return;
533  }
534 
535  factionA.SetFactionFriendly(factionB);
536  factionB.SetFactionFriendly(factionA);
537 
539 
540  if (playerChanged > 0)
541  SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_FACTION_SET_FRIENDLY_TO, playerChanged, GetFactionIndex(factionA), GetFactionIndex(factionB));
542  }
543 
544  //------------------------------------------------------------------------------------------------
550  void SetFactionsHostile(notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged = -1)
551  {
552  //~ Already Hostile
553  if (!factionA.DoCheckIfFactionFriendly(factionB))
554  return;
555 
556  //~ Only call once if setting self as hostile
557  if (factionA == factionB)
558  {
559  factionA.SetFactionHostile(factionA);
560 
561  if (playerChanged > 0)
562  SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_FACTION_SET_HOSTILE_TO_SELF, playerChanged, GetFactionIndex(factionA));
563 
565  return;
566  }
567 
568  factionA.SetFactionHostile(factionB);
569  factionB.SetFactionHostile(factionA);
570 
572 
573  if (playerChanged > 0)
574  SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_FACTION_SET_HOSTILE_TO, playerChanged, GetFactionIndex(factionA), GetFactionIndex(factionB));
575  }
576 
577  //------------------------------------------------------------------------------------------------
580  static void RequestUpdateAllTargetsFactions()
581  {
582  PerceptionManager pm = GetGame().GetPerceptionManager();
583  if (pm)
584  pm.RequestUpdateAllTargetsFactions();
585  }
586 
587  //------------------------------------------------------------------------------------------------
592  {
593  int targetPlayerId = playerFactionComponent.GetPlayerController().GetPlayerId();
594  Faction targetFaction = playerFactionComponent.GetAffiliatedFaction();
595  int targetFactionIndex = GetFactionIndex(targetFaction);
596 
597  // See if we have a record of player in the map
598  SCR_PlayerFactionInfo foundInfo;
599  if (m_MappedPlayerFactionInfo.Find(targetPlayerId, foundInfo))
600  {
601  // Adjust player counts
602  Faction previousFaction = GetPlayerFaction(targetPlayerId);
603  if (previousFaction)
604  {
605  // But only if previous entry was valid
606  int previousIndex = GetFactionIndex(previousFaction);
607  if (previousIndex != -1)
608  {
609  int previousCount;
610  m_PlayerCount.Find(previousIndex, previousCount); // Will not set value if not found
611  int newCount = previousCount - 1;
612  m_PlayerCount.Set(previousIndex, newCount); // Remove this player
613  OnPlayerFactionCountChanged(previousFaction, newCount);
614  }
615  }
616 
617  // Update existing record
618  foundInfo.SetFactionIndex(targetFactionIndex);
619 
620  // If new faction is valid, add to player count
621  if (targetFactionIndex != -1)
622  {
623  int previousCount;
624  m_PlayerCount.Find(targetFactionIndex, previousCount); // Will not set value if not found
625  int newCount = previousCount + 1;
626  m_PlayerCount.Set(targetFactionIndex, newCount); // Remove this player
627  OnPlayerFactionCountChanged(targetFaction, newCount);
628  }
629 
630  // Raise authority callback
631  OnPlayerFactionSet_S(playerFactionComponent, targetFaction);
632 
633  Replication.BumpMe();
634  return;
635  }
636 
637  // Insert new record
638  SCR_PlayerFactionInfo newInfo = SCR_PlayerFactionInfo.Create(targetPlayerId);
639  newInfo.SetFactionIndex(targetFactionIndex);
640  m_aPlayerFactionInfo.Insert(newInfo);
641  // And map it
642  m_MappedPlayerFactionInfo.Set(targetPlayerId, newInfo);
643  // And since this player was not assigned, increment the count of players for target faction
644  if (targetFactionIndex != -1)
645  {
646  int previousCount;
647  m_PlayerCount.Find(targetFactionIndex, previousCount);
648  int newCount = previousCount + 1;
649  m_PlayerCount.Set(targetFactionIndex, newCount);
650  OnPlayerFactionCountChanged(targetFaction, newCount);
651  }
652 
653  // Raise authority callback
654  OnPlayerFactionSet_S(playerFactionComponent, targetFaction);
655  Replication.BumpMe();
656  }
657 
658  //------------------------------------------------------------------------------------------------
664  protected void OnPlayerDisconnected(int playerId, KickCauseCode cause, int timeout)
665  {
666  PlayerController playerController = GetGame().GetPlayerManager().GetPlayerController(playerId);
667 
668  // If faction is unused, no need to do anything
669  SCR_PlayerFactionAffiliationComponent playerFactionAffiliation = SCR_PlayerFactionAffiliationComponent.Cast(playerController.FindComponent(SCR_PlayerFactionAffiliationComponent));
670  if (!playerFactionAffiliation)
671  return;
672 
673  // No faction does not need update
674  if (!playerFactionAffiliation.GetAffiliatedFaction())
675  return;
676 
677  // Clear faction, this will result in proper update of things
678  playerFactionAffiliation.RequestFaction(null);
679  }
680 }
SCR_BaseFactionManagerComponent
void SCR_BaseFactionManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_BaseFactionManagerComponent.c:20
SCR_BaseGameMode
Definition: SCR_BaseGameMode.c:137
UpdatePlayerFaction_S
void UpdatePlayerFaction_S(SCR_PlayerFactionAffiliationComponent playerFactionComponent)
Definition: SCR_FactionManager.c:591
SetFactionsHostile
void SetFactionsHostile(notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged=-1)
Definition: SCR_FactionManager.c:550
GetRankByID
SCR_RankID GetRankByID(SCR_ECharacterRank rankID)
Definition: SCR_FactionManager.c:250
SCR_PlayerController
Definition: SCR_PlayerController.c:31
GetFactionsList
proto external int GetFactionsList(out notnull array< Faction > outFactions)
GetLocalPlayerFaction
Faction GetLocalPlayerFaction()
Definition: SCR_FactionManager.c:190
GetAllAvailableRanks
array< ref SCR_RankID > GetAllAvailableRanks()
Definition: SCR_FactionManager.c:266
m_aRanks
protected ref array< ref SCR_CharacterRank > m_aRanks
Definition: SCR_Faction.c:47
GetSortedFactionsList
int GetSortedFactionsList(out notnull SCR_SortedArray< SCR_Faction > outFactions)
Definition: SCR_FactionManager.c:242
RplProp
SCR_RplTestEntityClass RplProp
Used for handling entity spawning requests for SCR_CatalogEntitySpawnerComponent and inherited classe...
SCR_FactionManagerClass
Definition: SCR_FactionManager.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GetFactionIndex
int GetFactionIndex()
Definition: SCR_EditableFactionComponent.c:57
SCR_PlayerFactionInfo
Definition: SCR_PlayerFactionInfo.c:1
SetFactionsFriendly
void SetFactionsFriendly(notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged=-1)
Definition: SCR_FactionManager.c:517
SCR_ECharacterRank
SCR_ECharacterRank
Definition: SCR_CharacterRankComponent.c:305
GetRankNext
SCR_ECharacterRank GetRankNext(SCR_ECharacterRank rank)
Definition: SCR_FactionManager.c:343
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
s_OnPlayerFactionCountChanged
protected ref ScriptInvoker s_OnPlayerFactionCountChanged
Definition: SCR_FactionManager.c:37
func
func
Definition: SCR_AIThreatSystem.c:5
Attribute
SCR_FactionManagerClass FactionManagerClass Attribute(defvalue:"1", desc:"Whether or not the isPlayable state of a faction can be changed on run time")
List of all player faction infos in no particular order. Maintained by the authority.
Definition: SCR_FactionManager.c:11
KickCauseCode
KickCauseCode
Definition: KickCauseCode.c:19
m_ChangedFactions
protected ref set< int > m_ChangedFactions
List of indices of factions whose count has changed since last update.
Definition: SCR_FactionManager.c:28
IsRankRenegade
bool IsRankRenegade(SCR_ECharacterRank rankID)
Definition: SCR_FactionManager.c:280
OnPlayerFactionInfoChanged
protected void OnPlayerFactionInfoChanged()
Update local player faction mapping.
Definition: SCR_FactionManager.c:63
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition: SCR_BaseGameModeComponent.c:15
ENotification
ENotification
Definition: ENotification.c:4
m_MappedPlayerFactionInfo
protected ref map< int, ref SCR_PlayerFactionInfo > m_MappedPlayerFactionInfo
Local mapping of playerId to player faction info.
Definition: SCR_FactionManager.c:31
~SCR_FactionManager
void ~SCR_FactionManager()
Definition: SCR_FactionManager.c:493
GetRequiredRankXP
int GetRequiredRankXP(SCR_ECharacterRank rankID)
Definition: SCR_FactionManager.c:293
GetFactionPlayerCount
int GetFactionPlayerCount(Faction faction)
Definition: SCR_FactionManager.c:215
GetOnPlayerFactionCountChanged
ScriptInvoker GetOnPlayerFactionCountChanged()
Definition: SCR_FactionManager.c:43
SCR_FactionManager_PlayerFactionChanged
func SCR_FactionManager_PlayerFactionChanged
Definition: SCR_FactionManager.c:3
m_PreviousPlayerFactions
protected ref map< int, int > m_PreviousPlayerFactions
Map of previous players <playerId : factionIndex>.
Definition: SCR_FactionManager.c:25
m_PlayerCount
protected ref map< int, int > m_PlayerCount
Mapping of faction id : player count.
Definition: SCR_FactionManager.c:34
EOnDiag
override void EOnDiag(IEntity owner, float timeSlice)
Definition: SCR_AIGroupUtilityComponent.c:426
m_OnPlayerFactionChanged_S
protected ref ScriptInvokerBase< SCR_FactionManager_PlayerFactionChanged > m_OnPlayerFactionChanged_S
Definition: SCR_FactionManager.c:39
OnPlayerFactionSet_S
protected void OnPlayerFactionSet_S(SCR_PlayerFactionAffiliationComponent playerComponent, Faction faction)
Definition: SCR_FactionManager.c:124
GetRankPrev
SCR_ECharacterRank GetRankPrev(SCR_ECharacterRank rank)
Definition: SCR_FactionManager.c:370
GetOnPlayerFactionChanged_S
ScriptInvokerBase< SCR_FactionManager_PlayerFactionChanged > GetOnPlayerFactionChanged_S()
return Script invoker on player faction changed (Server only)
Definition: SCR_FactionManager.c:53
EOnInit
override void EOnInit(IEntity owner)
Definition: SCR_FactionManager.c:395
Faction
Definition: Faction.c:12
GetRankByXP
SCR_ECharacterRank GetRankByXP(int XP)
Definition: SCR_FactionManager.c:318
SCR_PlayerFactionAffiliationComponent
Definition: SCR_PlayerFactionAffiliationComponent.c:16
RequestUpdateAllTargetsFactions
proto external void RequestUpdateAllTargetsFactions()
m_aAncestors
protected ref array< string > m_aAncestors
Definition: SCR_Faction.c:43
GetPlayerFaction
Faction GetPlayerFaction(int playerId)
Definition: SCR_FactionManager.c:161
OnPlayerFactionCountChanged
protected void OnPlayerFactionCountChanged(Faction faction, int newCount)
Definition: SCR_FactionManager.c:142
FactionManagerClass
Definition: FactionManager.c:12
CanChangeFactionsPlayable
bool CanChangeFactionsPlayable()
Definition: SCR_FactionManager.c:504
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition: SCR_FactionManager.c:461
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition: DebugMenuID.c:3
GetRenegadeRank
protected SCR_ECharacterRank GetRenegadeRank()
Definition: SCR_FactionManager.c:304
OnPlayerDisconnected
protected void OnPlayerDisconnected(int playerId, KickCauseCode cause, int timeout)
Definition: SCR_FactionManager.c:664
SCR_Faction
Definition: SCR_Faction.c:6
GetFactionByIndex
proto external Faction GetFactionByIndex(int index)