Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FactionAffiliationComponent.c
Go to the documentation of this file.
4
5void OnFactionChangeDelegate(FactionAffiliationComponent owner, Faction previousFaction, Faction newFaction);
7typedef ScriptInvokerBase<OnFactionChangeDelegate> OnFactionChangedInvoker;
8
9
10class 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
30 {
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!")]
52 {
53 if (!m_OnFactionUpdate)
54 m_OnFactionUpdate = new ScriptInvoker();
55 return m_OnFactionUpdate;
56 }
57
58 //------------------------------------------------------------------------------------------------
61 {
62 if (!m_OnFactionChangedInvoker)
63 m_OnFactionChangedInvoker = new OnFactionChangedInvoker();
64
65 return m_OnFactionChangedInvoker;
66 }
67}
func OnFactionChangeDelegate
ScriptInvokerBase< OnFactionChangeDelegate > OnFactionChangedInvoker
proto external Managed FindComponent(typename typeName)
static void SetFaction(IEntity owner, Faction faction)
void OnFactionChanged(Faction previous, Faction current)
proto external void SetAffiliatedFaction(Faction faction)
SCR_CampaignFaction GetAffiliatedFaction()
Returns the affiliated faction or null if none.
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134