Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PlayerModesEditorAttribute.c
Go to the documentation of this file.
3 {
4  protected SCR_EditorManagerEntity GetEditorManager(Managed item)
5  {
6  SCR_EditablePlayerDelegateComponent delegate = SCR_EditablePlayerDelegateComponent.Cast(item);
7  if (!delegate)
8  return null;
9 
11  if (!core)
12  return null;
13 
14  return core.GetEditorManager(delegate.GetPlayerID());
15  }
16 
17  override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
18  {
19  EEditorMode modes;
20 
21  //--- Player modes, affects specific editor manager
22  SCR_EditorManagerEntity editorManager = GetEditorManager(item);
23  if (!editorManager)
24  return null;
25 
26  if (SCR_Global.IsAdmin(editorManager.GetPlayerID()))
27  return null;
28 
29  modes = editorManager.GetModes();
30 
31  super.ReadVariable(item, manager);
32  SetFlags(modes);
33  return SCR_BaseEditorAttributeVar.CreateVector(GetFlagVector());
34  }
35 
36  override void UpdateInterlinkedVariables(SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, bool isInit = false)
37  {
38  if (isInit)
39  {
40  manager.SetAttributeAsSubAttribute(SCR_PlayerBudgetPropEnableEditorAttribute);
41  manager.SetAttributeAsSubAttribute(SCR_PlayerBudgetVehicleEnableEditorAttribute);
42  manager.SetAttributeAsSubAttribute(SCR_PlayerBudgetAIEnableEditorAttribute);
43  manager.SetAttributeAsSubAttribute(SCR_PlayerBudgetSystemEnableEditorAttribute);
44  }
45 
46  if (!var)
47  {
48  manager.SetAttributeEnabled(SCR_PlayerBudgetPropEnableEditorAttribute, false);
49  manager.SetAttributeEnabled(SCR_PlayerBudgetVehicleEnableEditorAttribute, false);
50  manager.SetAttributeEnabled(SCR_PlayerBudgetAIEnableEditorAttribute, false);
51  manager.SetAttributeEnabled(SCR_PlayerBudgetSystemEnableEditorAttribute, false);
52  }
53  else
54  {
55  int flags = var.GetVector()[0];
56  bool enableBudget = flags & EEditorMode.EDIT;
57 
58  manager.SetAttributeEnabled(SCR_PlayerBudgetPropEnableEditorAttribute, enableBudget);
59  manager.SetAttributeEnabled(SCR_PlayerBudgetVehicleEnableEditorAttribute, enableBudget);
60  manager.SetAttributeEnabled(SCR_PlayerBudgetAIEnableEditorAttribute, enableBudget);
61  manager.SetAttributeEnabled(SCR_PlayerBudgetSystemEnableEditorAttribute, enableBudget);
62  }
63  }
64 
65  override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
66  {
67  if (!var)
68  return;
69 
70  super.WriteVariable(item, var, manager, playerID);
71 
72  //--- Player modes
73  SCR_EditorManagerEntity editorManager = GetEditorManager(item);
74  if (!editorManager)
75  return;
76 
77  if (SCR_Global.IsAdmin(editorManager.GetPlayerID()))
78  return;
79 
80  int flags = GetFlags(0);
81  editorManager.SetEditorModes(EEditorModeAccess.BASE, flags, false);
82  }
83 
84  protected override void CreatePresets()
85  {
87  if (!core) return;
88 
89  m_aValues.Clear();
90 
92  SCR_SortedArray<SCR_EditorModePrefab> modePrefabs = new SCR_SortedArray<SCR_EditorModePrefab>;
93  for (int i, count = core.GetBaseModePrefabs(modePrefabs, EEditorModeFlag.EDITABLE, true); i < count; i++)
94  {
95  mode = modePrefabs[i];
97  value.SetWithUIInfo(mode.GetInfo(), mode.GetMode());
98  m_aValues.Insert(value);
99  }
100  }
101 
102 };
SCR_PlayerBudgetPropEnableEditorAttribute
Definition: SCR_PlayerBudgetPropEnableEditorAttribute.c:2
GetFlags
int GetFlags(out array< SCR_FlagComponent > flags)
Definition: SCR_MilitaryBaseComponent.c:428
m_aValues
SCR_BaseEditorAttributeEntryTimeSlider m_aValues
SCR_PlayerBudgetAIEnableEditorAttribute
Definition: SCR_PlayerBudgetAIEnableEditorAttribute.c:2
EEditorModeAccess
EEditorModeAccess
Definition: EEditorModeAccess.c:1
SCR_PlayerModesEditorAttribute
Definition: SCR_PlayerModesEditorAttribute.c:2
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
SCR_EditorManagerCore
Core component to manage SCR_EditorManagerEntity.
Definition: SCR_EditorManagerCore.c:5
SCR_PlayerBudgetSystemEnableEditorAttribute
Definition: SCR_PlayerBudgetSystemEnableEditorAttribute.c:2
SCR_BaseMultiSelectPresetsEditorAttribute
Definition: SCR_BaseMultiSelectPresetsEditorAttribute.c:4
EEditorModeFlag
EEditorModeFlag
Definition: EEditorModeFlag.c:1
EEditorMode
EEditorMode
Editor mode that defines overall functionality.
Definition: EEditorMode.c:5
SCR_EditorAttributeFloatStringValueHolder
Definition: SCR_BaseFloatValueHolderEditorAttribute.c:17
SCR_Global
Definition: Functions.c:6
SCR_PlayerBudgetVehicleEnableEditorAttribute
Definition: SCR_PlayerBudgetVehicleEnableEditorAttribute.c:2
SCR_EditorModePrefab
Definition: SCR_EditorManagerEntity.c:1888
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
SCR_EditorManagerEntity
Definition: SCR_EditorManagerEntity.c:26