Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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_BaseTaskManager taskManager = SCR_BaseTaskManager.Cast(item);
11  if (!taskManager)
12  return null;
13  }
14 
15  super.ReadVariable(item, manager);
16 
17  SCR_DelegateFactionManagerComponent delegateFactionManager = SCR_DelegateFactionManagerComponent.GetInstance();
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 
39  return SCR_BaseEditorAttributeVar.CreateVector(GetFlagVector());
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 
46  SCR_DelegateFactionManagerComponent delegateFactionManager = SCR_DelegateFactionManagerComponent.GetInstance();
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  {
70  SCR_DelegateFactionManagerComponent delegateFactionManager = SCR_DelegateFactionManagerComponent.GetInstance();
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)
90  continue;
91 
93  value.SetWithUIInfo(scrFaction.GetUIInfo(), factionManager.GetFactionIndex(factionDelegates.Get(i).GetFaction()));
94  m_aValues.Insert(value);
95  }
96  }
97 };
m_aValues
SCR_BaseEditorAttributeEntryTimeSlider m_aValues
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_PlayableFactionsEditorAttribute
Definition: SCR_PlayableFactionsEditorAttribute.c:3
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
ENotification
ENotification
Definition: ENotification.c:4
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
SCR_BaseTaskManager
Definition: SCR_BaseTaskManager.c:25
SCR_BaseMultiSelectPresetsEditorAttribute
Definition: SCR_BaseMultiSelectPresetsEditorAttribute.c:4
SCR_EditorAttributeFloatStringValueHolder
Definition: SCR_BaseFloatValueHolderEditorAttribute.c:17
SCR_DelegateFactionManagerComponent
Definition: SCR_DelegateFactionManagerComponent.c:15
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition: SCR_FactionManager.c:461
SCR_Faction
Definition: SCR_Faction.c:6
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468