Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_FactionAffiliationComponent.c
Go to the documentation of this file.
2 {
3 }
4 
5 void OnFactionChangeDelegate(FactionAffiliationComponent owner, Faction previousFaction, Faction newFaction);
7 typedef ScriptInvokerBase<OnFactionChangeDelegate> OnFactionChangedInvoker;
8 
9 
10 class SCR_FactionAffiliationComponent : FactionAffiliationComponent
11 {
12  // Local invokers
13  private ref ScriptInvoker m_OnFactionUpdate;
14  private ref OnFactionChangedInvoker m_OnFactionChangedInvoker;
15 
16  //------------------------------------------------------------------------------------------------
17  override protected void OnFactionChanged(Faction previous, Faction current)
18  {
19  if (m_OnFactionUpdate)
20  m_OnFactionUpdate.Invoke(GetAffiliatedFaction());
21 
22  if (m_OnFactionChangedInvoker)
23  m_OnFactionChangedInvoker.Invoke(this, previous, current);
24  }
25 
26  //------------------------------------------------------------------------------------------------
28  // may return to DefaultAffiliatedFaction in some cases - override this
29  void ClearAffiliatedFaction()
30  {
31  SetAffiliatedFaction(null);
32  }
33 
34  //------------------------------------------------------------------------------------------------
38  static void SetFaction(IEntity owner, Faction faction)
39  {
40  if (!owner || !faction )
41  return;
42 
44  if (factionComponent)
45  factionComponent.SetAffiliatedFaction(faction);
46  }
47 
48  //------------------------------------------------------------------------------------------------
50  [Obsolete("Use the SCR_FactionAffiliationComponent.GetOnFactionChanged invoker instead!")]
51  ScriptInvoker GetOnFactionUpdate()
52  {
53  if (!m_OnFactionUpdate)
54  m_OnFactionUpdate = new ScriptInvoker();
55  return m_OnFactionUpdate;
56  }
57 
58  //------------------------------------------------------------------------------------------------
60  OnFactionChangedInvoker GetOnFactionChanged()
61  {
62  if (!m_OnFactionChangedInvoker)
63  m_OnFactionChangedInvoker = new OnFactionChangedInvoker();
64 
65  return m_OnFactionChangedInvoker;
66  }
67 }
OnFactionChangeDelegate
func OnFactionChangeDelegate
Definition: SCR_FactionAffiliationComponent.c:6
FactionAffiliationComponentClass
Definition: FactionAffiliationComponent.c:12
func
func
Definition: SCR_AIThreatSystem.c:5
SetAffiliatedFaction
proto external void SetAffiliatedFaction(Faction faction)
GetAffiliatedFaction
proto external Faction GetAffiliatedFaction()
Returns the affiliated faction or null if none.
Faction
Definition: Faction.c:12
SCR_FactionAffiliationComponent
Definition: SCR_FactionAffiliationComponent.c:10
OnFactionChangedInvoker
ScriptInvokerBase< OnFactionChangeDelegate > OnFactionChangedInvoker
Definition: SCR_FactionAffiliationComponent.c:7
SCR_FactionAffiliationComponentClass
Definition: SCR_FactionAffiliationComponent.c:1
Obsolete
RespawnSystemComponentClass GameComponentClass Obsolete()] proto external GenericEntity DoSpawn(string prefab
RespawnSystemComponent should be attached to a gamemode to handle player spawning and respawning.