Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_GameOverFactionsEditorAttribute.c
Go to the documentation of this file.
3{
4
5 override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
6 {
7 SCR_RespawnComponent respawnComponent = SCR_RespawnComponent.Cast(item);
8 if (!respawnComponent)
9 return null;
10
11 BaseGameMode gameMode = GetGame().GetGameMode();
12 if (!gameMode)
13 return null;
14
15 SCR_GameOverScreenManagerComponent gameOverManager = SCR_GameOverScreenManagerComponent.Cast(gameMode.FindComponent(SCR_GameOverScreenManagerComponent));
16 if (!gameOverManager)
17 return null;
18
19 super.ReadVariable(item, manager);
20
22 if (!delegateFactionManager)
23 return null;
24
25 SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
26 if (!factionManager)
27 return null;
28
29 SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates = new SCR_SortedArray<SCR_EditableFactionComponent>;
30 int count = delegateFactionManager.GetSortedFactionDelegates(factionDelegates);
31
32
33 SCR_Faction scrFaction;
34 int playableFactionsCount = 0;
35
36 for(int i = 0; i < count; ++i)
37 {
38 scrFaction = SCR_Faction.Cast(factionDelegates.Get(i).GetFaction());
39
40 if (!scrFaction || !scrFaction.IsPlayable())
41 continue;
42
43 playableFactionsCount++;
44 AddOrderedState(false);
45 }
46
47 if (playableFactionsCount <= 0)
48 return null;
49
51 }
52
53 override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
54 {
55 super.WriteVariable(item, var, manager, playerID);
56
58 if (!gamemode)
59 return;
60
61 SCR_GameOverScreenManagerComponent gameOverManager = SCR_GameOverScreenManagerComponent.Cast(gamemode.FindComponent(SCR_GameOverScreenManagerComponent));
62 if (!gameOverManager)
63 return;
64
65 SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
66 if (!factionManager)
67 return;
68
70 if (!delegateFactionManager)
71 return;
72
73 SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates = new SCR_SortedArray<SCR_EditableFactionComponent>;
74 int count = delegateFactionManager.GetSortedFactionDelegates(factionDelegates);
75
76 array <int> selectedFactions = new array<int>;
77 SCR_Faction scrFaction;
78
79 //Get all selected factions
80 for(int i = 0; i < count; ++i)
81 {
82 scrFaction = SCR_Faction.Cast(factionDelegates.Get(i).GetFaction());
83
84 if (!scrFaction || !scrFaction.IsPlayable() || !GetOrderedState())
85 continue;
86
87 selectedFactions.Insert(factionManager.GetFactionIndex(scrFaction));
88 }
89
90 gameOverManager.SetEditorGameOverFactions(selectedFactions);
91 }
92
93 protected int GetEditorGameOverInfoArray(notnull array <SCR_BaseGameOverScreenInfo> gameOverScreens, notnull out array <SCR_BaseGameOverScreenInfo> editorGameOverScreens)
94 {
96
97 foreach (SCR_BaseGameOverScreenInfo screen: gameOverScreens)
98 {
99 editorOptional = screen.GetEditorOptionalParams();
100
101 if (!editorOptional || !editorOptional.m_bCanBeSetByGameMaster)
102 continue;
103
104 editorGameOverScreens.Insert(screen);
105 }
106
107 return editorGameOverScreens.Count();
108 }
109
110 override protected void CreatePresets()
111 {
113 if (!delegateFactionManager)
114 return;
115
116 FactionManager factionManager = GetGame().GetFactionManager();
117 if (!factionManager)
118 return;
119
120 m_aValues.Clear();
121
122 SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates = new SCR_SortedArray<SCR_EditableFactionComponent>;
123 int count = delegateFactionManager.GetSortedFactionDelegates(factionDelegates);
124
125 SCR_Faction scrFaction;
126
127 for(int i = 0; i < count; ++i)
128 {
129 scrFaction = SCR_Faction.Cast(factionDelegates.Get(i).GetFaction());
130
131 if (!scrFaction || !scrFaction.IsPlayable())
132 continue;
133
135 value.SetWithUIInfo(scrFaction.GetUIInfo(), factionManager.GetFactionIndex(factionDelegates.Get(i).GetFaction()));
136 m_aValues.Insert(value);
137 }
138 }
139};
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_BaseGameMode GetGameMode()
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_RespawnComponent(IEntityComponentSource src, IEntity ent, 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)
bool IsPlayable()
int GetEditorGameOverInfoArray(notnull array< SCR_BaseGameOverScreenInfo > gameOverScreens, notnull out array< SCR_BaseGameOverScreenInfo > editorGameOverScreens)