Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BasePlayerBudgetEnableEditorAttribute.c
Go to the documentation of this file.
1 
4 {
5  //~ ToDo: this is temporary for when the budgets get a Init value function
6  [Attribute(desc: "The budget Value if in Multiplayer when budget is enabled")]
7  protected int m_iBudgetValueMP;
8 
9  [Attribute(desc: "The budget Value if in Singleplayer when budget is enabled")]
10  protected int m_iBudgetValueSP;
11 
12  protected SCR_EditorManagerEntity m_EditorManager;
13 
14  protected void SetEditorManager(Managed item)
15  {
16  m_EditorManager = null;
17 
18  SCR_EditablePlayerDelegateComponent delegate = SCR_EditablePlayerDelegateComponent.Cast(item);
19  if (!delegate)
20  return;
21 
23  if (!core)
24  return;
25 
26  m_EditorManager = core.GetEditorManager(delegate.GetPlayerID());
27  }
28 
29  override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
30  {
31  SetEditorManager(item);
32  if (!m_EditorManager)
33  return null;
34 
36  if (!budgetComponent)
37  return null;
38 
39  int maxBudget;
40  budgetComponent.GetMaxBudgetValue(GetBudgetType(), maxBudget);
41 
42  return SCR_BaseEditorAttributeVar.CreateBool(maxBudget > 0);
43  }
44 
45  override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
46  {
47  if (!var)
48  return;
49 
50  if (!m_EditorManager)
51  SetEditorManager(item);
52 
53  SCR_EditablePlayerDelegateComponent delegate = SCR_EditablePlayerDelegateComponent.Cast(item);
54  if (!delegate)
55  return;
56 
57  if (!m_EditorManager)
58  return;
59 
61  if (!budgetComponent)
62  return;
63 
64  if (var.GetBool())
65  {
66  int budgetValue;
67 
68  if (Replication.IsRunning())
69  budgetValue = m_iBudgetValueMP;
70  else
71  budgetValue = m_iBudgetValueSP;
72 
73  budgetComponent.SetMaxBudgetValue(GetBudgetType(), budgetValue);
74  SCR_NotificationsComponent.SendToUnlimitedEditorPlayersAndPlayer(playerID, GetEnableNotification(), playerID, delegate.GetPlayerID());
75  }
76  else
77  {
78  budgetComponent.SetMaxBudgetValue(GetBudgetType(), 0);
79  SCR_NotificationsComponent.SendToUnlimitedEditorPlayersAndPlayer(playerID, GetDisableNotification(), playerID, delegate.GetPlayerID());
80  }
81  }
82 
83  protected EEditableEntityBudget GetBudgetType()
84  {
85  return EEditableEntityBudget.SYSTEMS;
86  }
87 
88  protected ENotification GetEnableNotification()
89  {
90  return ENotification.UNKNOWN;
91  }
92 
93  protected ENotification GetDisableNotification()
94  {
95  return ENotification.UNKNOWN;
96  }
97 };
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
EEditableEntityBudget
EEditableEntityBudget
Definition: EEditableEntityBudget.c:1
SCR_BudgetEditorComponent
Definition: SCR_BudgetEditorComponent.c:18
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
ENotification
ENotification
Definition: ENotification.c:4
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_EditorManagerCore
Core component to manage SCR_EditorManagerEntity.
Definition: SCR_EditorManagerCore.c:5
SCR_BasePlayerBudgetEnableEditorAttribute
Definition: SCR_BasePlayerBudgetEnableEditorAttribute.c:3
SCR_BaseEditorAttribute
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Definition: SCR_BaseEditorAttribute.c:3
m_EditorManager
protected SCR_EditorManagerEntity m_EditorManager
Definition: SCR_VotingEditor.c:5
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