Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ScenarioFrameworkLogic.c
Go to the documentation of this file.
3 {
4  [Attribute(defvalue: "1", desc: "Input connector", UIWidgets.Auto, category: "Input")];
5  protected ref SCR_ScenarioFrameworkActionInputBase m_InputAction;
6 
7  [Attribute(defvalue: "0", desc: "Input connector", UIWidgets.Auto, category: "Input")];
8  protected bool m_bLatch;
9 
10  protected bool m_bSignal;
11  protected IEntity m_Entity;
12  protected SCR_ScenarioFrameworkLogic m_MasterLogic;
13 
14  //------------------------------------------------------------------------------------------------
17  void Init(SCR_ScenarioFrameworkLogic logic)
18  {
19  m_MasterLogic = logic;
20  if (m_InputAction)
21  m_InputAction.Init(this);
22  }
23 
24  //------------------------------------------------------------------------------------------------
27  void OnActivate(bool bSignal, IEntity entity)
28  {
29  if (m_MasterLogic)
30  m_MasterLogic.OnInput(bSignal, entity);
31  }
32 }
33 
34 class SCR_ScenarioFrameworkLogicClass : GenericEntityClass
35 {
36 }
37 
38 class SCR_ScenarioFrameworkLogic : GenericEntity
39 {
40 
41  [Attribute(defvalue: "1", desc: "What causes the increase", UIWidgets.Auto, category: "Input")];
42  protected ref array<ref SCR_ScenarioFrameworkLogicInput> m_aInputs;
43 
44  [Attribute(defvalue: "1", desc: "What to do once counter is reached", UIWidgets.Auto, category: "OnActivate")];
45  protected ref array<ref SCR_ScenarioFrameworkActionBase> m_aActions;
46 
47  protected bool m_bIsTerminated; //Marks if this was terminated - either by death or deletion
48 
49  //------------------------------------------------------------------------------------------------
51  void Init()
52  {
53  if (m_bIsTerminated)
54  return;
55 
57  input.Init(this);
58  }
59 
60  //------------------------------------------------------------------------------------------------
62  void SetIsTerminated(bool state)
63  {
64  m_bIsTerminated = state;
65  }
66 
67  //------------------------------------------------------------------------------------------------
70  {
71  return m_bIsTerminated;
72  }
73 
74  //------------------------------------------------------------------------------------------------
77  void OnInput(bool pSignal = true, IEntity entity = null);
78 
79  //------------------------------------------------------------------------------------------------
81  void OnActivate(IEntity entity)
82  {
83  foreach (SCR_ScenarioFrameworkActionBase action : m_aActions)
84  action.OnActivate(entity);
85  }
86 
87 #ifdef WORKBENCH
88  //------------------------------------------------------------------------------------------------
89  override void _WB_OnCreate(IEntitySource src)
90  {
91  WorldEditorAPI api = _WB_GetEditorAPI();
92  IEntitySource thisSrc = api.EntityToSource(this);
93  api.RenameEntity(thisSrc, api.GenerateDefaultEntityName(thisSrc));
94  }
95 #endif
96 }
97 
98 class SCR_ScenarioFrameworkLogicCounterClass : SCR_ScenarioFrameworkLogicClass
99 {
100 }
101 
102 class SCR_ScenarioFrameworkLogicCounter : SCR_ScenarioFrameworkLogic
103 {
104  [Attribute(defvalue: "1", desc: "Threshold", UIWidgets.Graph, category: "Counter")];
105  protected int m_iCountTo;
106 
107  [Attribute(defvalue: "1", desc: "What to do once value is increased", UIWidgets.Auto, category: "OnIncrease")];
108  protected ref array<ref SCR_ScenarioFrameworkActionBase> m_aOnIncreaseActions;
109 
110  int m_iCnt = 0;
111 
112  //------------------------------------------------------------------------------------------------
113  override void OnInput(bool pSignal = true, IEntity entity = null)
114  {
115  Increase(entity);
116  }
117 
118  //------------------------------------------------------------------------------------------------
121  {
122  return m_iCnt;
123  }
124 
125  //------------------------------------------------------------------------------------------------
127  void SetCounterValue(int value)
128  {
129  m_iCnt = value;
130  }
131 
132  //------------------------------------------------------------------------------------------------
135  void Increase(IEntity entity)
136  {
137  m_iCnt++;
138  if (m_iCnt == m_iCountTo)
139  {
140  OnActivate(entity);
141  }
142  else
143  {
144  foreach (SCR_ScenarioFrameworkActionBase increaseAction : m_aOnIncreaseActions)
145  {
146  increaseAction.OnActivate(entity);
147  }
148  }
149  }
150 
151  //------------------------------------------------------------------------------------------------
153  void Reset()
154  {
155  m_iCnt = 0;
156  }
157 }
158 
159 class SCR_ScenarioFrameworkLogicORClass : SCR_ScenarioFrameworkLogicClass
160 {
161 }
162 
163 class SCR_ScenarioFrameworkLogicOR : SCR_ScenarioFrameworkLogic
164 {
165  protected int m_iActivations = 0;
166 
167  //------------------------------------------------------------------------------------------------
168  override void OnInput(bool pSignal = true, IEntity entity = null)
169  {
170  if (pSignal)
171  m_iActivations = Math.Min(++m_iActivations, m_aInputs.Count());
172  else
173  m_iActivations--;
174  }
175 }
176 
177 class SCR_ScenarioFrameworkLogicSwitchClass : SCR_ScenarioFrameworkLogicClass
178 {
179 }
180 
181 class SCR_ScenarioFrameworkLogicSwitch : SCR_ScenarioFrameworkLogic
182 {
183 }
GetCounterValue
int GetCounterValue()
Definition: SCR_ScenarioFrameworkLogic.c:120
m_iActivations
SCR_ScenarioFrameworkLogicORClass m_iActivations
m_MasterLogic
protected SCR_ScenarioFrameworkLogic m_MasterLogic
Definition: SCR_ScenarioFrameworkLogic.c:10
m_iCountTo
protected int m_iCountTo
Definition: SCR_ScenarioFrameworkLogic.c:105
m_aActions
protected ref array< ref SCR_ScenarioFrameworkActionBase > m_aActions
Definition: SCR_ScenarioFrameworkLogic.c:44
SetIsTerminated
void SetIsTerminated(bool state)
Definition: SCR_ScenarioFrameworkLogic.c:62
Init
void Init(SCR_ScenarioFrameworkLogic logic)
Definition: SCR_ScenarioFrameworkLogic.c:15
m_bIsTerminated
protected bool m_bIsTerminated
Definition: SCR_ScenarioFrameworkLogic.c:47
SCR_ScenarioFrameworkLogicCounterClass
Definition: SCR_ScenarioFrameworkLogic.c:98
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
OnActivate
void OnActivate(bool bSignal, IEntity entity)
Definition: SCR_ScenarioFrameworkLogic.c:25
OnInput
void OnInput(bool pSignal=true, IEntity entity=null)
Definition: SCR_ScenarioFrameworkLogic.c:113
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
Attribute
class SCR_ScenarioFrameworkLogicInput Attribute(defvalue:"1", desc:"What causes the increase", UIWidgets.Auto, category:"Input")]
m_aOnIncreaseActions
protected ref array< ref SCR_ScenarioFrameworkActionBase > m_aOnIncreaseActions
Definition: SCR_ScenarioFrameworkLogic.c:107
m_InputAction
protected ref SCR_ScenarioFrameworkActionInputBase m_InputAction
Definition: SCR_ScenarioFrameworkLogic.c:2
SCR_ScenarioFrameworkLogicSwitchClass
Definition: SCR_ScenarioFrameworkLogic.c:177
m_iCnt
int m_iCnt
Definition: SCR_ScenarioFrameworkLogic.c:110
Increase
void Increase(IEntity entity)
Definition: SCR_ScenarioFrameworkLogic.c:135
SCR_ScenarioFrameworkActionInputBase
Definition: SCR_ScenarioFrameworkActionsInputs.c:3
SetCounterValue
void SetCounterValue(int value)
Definition: SCR_ScenarioFrameworkLogic.c:127
SCR_ScenarioFrameworkLogicInput
Definition: SCR_ScenarioFrameworkLogic.c:2
m_aInputs
protected ref array< ref SCR_ScenarioFrameworkLogicInput > m_aInputs
Definition: SCR_ScenarioFrameworkLogic.c:42
GetIsTerminated
bool GetIsTerminated()
Definition: SCR_ScenarioFrameworkLogic.c:69
SCR_ScenarioFrameworkLogicORClass
Definition: SCR_ScenarioFrameworkLogic.c:159
Reset
void Reset()
Definition: SCR_ScenarioFrameworkLogic.c:153
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
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180