Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_PlayableFactionsEditorAttribute.c
Go to the documentation of this file.
1
4{
5 override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
6 {
7 //If opened in global attributes
8 if (!IsGameMode(item))
9 {
10 SCR_TaskSystem taskSystem = SCR_TaskSystem.Cast(item);
11 if (!taskSystem)
12 return null;
13 }
14
15 super.ReadVariable(item, manager);
16
18 if (!delegateFactionManager)
19 return null;
20
21 SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
22 if (!factionManager || !factionManager.CanChangeFactionsPlayable())
23 return null;
24
25 SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates = new SCR_SortedArray<SCR_EditableFactionComponent>;
26 int count = delegateFactionManager.GetSortedFactionDelegates(factionDelegates);
27 SCR_Faction scrFaction;
28
29 for(int i = 0; i < count; ++i)
30 {
31 scrFaction = SCR_Faction.Cast(factionDelegates.Get(i).GetFaction());
32
33 if (!scrFaction)
34 continue;
35
36 AddOrderedState(scrFaction.IsPlayable());
37 }
38
40 }
41
42 override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
43 {
44 super.WriteVariable(item, var, manager, playerID);
45
47 if (!delegateFactionManager)
48 return;
49
50 SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates = new SCR_SortedArray<SCR_EditableFactionComponent>;
51 int count = delegateFactionManager.GetSortedFactionDelegates(factionDelegates);
52 SCR_Faction scrFaction;
53
54 for(int i = 0; i < count; ++i)
55 {
56 scrFaction = SCR_Faction.Cast(factionDelegates.Get(i).GetFaction());
57
58 if (!scrFaction)
59 continue;
60
61 factionDelegates.Get(i).SetFactionPlayableServer(GetOrderedState());
62 }
63
64 if (item)
65 SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_ATTRIBUTES_FACTION_CHANGED, playerID);
66 }
67
68 override protected void CreatePresets()
69 {
71 if (!delegateFactionManager)
72 return;
73
74 FactionManager factionManager = GetGame().GetFactionManager();
75 if (!factionManager)
76 return;
77
78 m_aValues.Clear();
79
80 SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates = new SCR_SortedArray<SCR_EditableFactionComponent>;
81 int count = delegateFactionManager.GetSortedFactionDelegates(factionDelegates);
82
83 SCR_Faction scrFaction;
84
85 for(int i = 0; i < count; ++i)
86 {
87 scrFaction = SCR_Faction.Cast(factionDelegates.Get(i).GetFaction());
88
89 if (!scrFaction || scrFaction.GetParent() != null)
90 continue;
91
93 value.SetWithUIInfo(scrFaction.GetUIInfo(), factionManager.GetFactionIndex(factionDelegates.Get(i).GetFaction()));
94 m_aValues.Insert(value);
95 }
96 }
97};
ENotification
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
void SCR_FactionManager(IEntitySource src, IEntity parent)
static SCR_BaseEditorAttributeVar CreateVector(vector value)
ref array< ref SCR_EditorAttributeFloatStringValueHolder > m_aValues
static SCR_DelegateFactionManagerComponent GetInstance()
int GetSortedFactionDelegates(notnull out SCR_SortedArray< SCR_EditableFactionComponent > outDelegates)
Faction GetParent()
bool IsPlayable()