Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkLogic.c
Go to the documentation of this file.
4 [Attribute(desc: "Input connector", category: "Input")]
6
7 SCR_ScenarioFrameworkLogic m_MasterLogic;
9 //------------------------------------------------------------------------------------------------
12 void Init(SCR_ScenarioFrameworkLogic logic)
13 {
14 m_MasterLogic = logic;
15 if (m_InputAction)
16 m_InputAction.Init(this);
17 }
18
19 //------------------------------------------------------------------------------------------------
23 void OnActivate(bool bSignal, IEntity entity)
24 {
25 if (m_MasterLogic)
26 m_MasterLogic.OnInput(bSignal, entity);
27 }
28}
29
30class SCR_ScenarioFrameworkLogicClass : GenericEntityClass
31{
32}
33
34class SCR_ScenarioFrameworkLogic : GenericEntity
35{
36 [Attribute(desc: "If set to true, when this Logic gets activated, it will break the breakpoint in the Script Editor in respective methods. This can be also set during runtime via Debug Menu > ScenarioFramework > Logic Inspector")]
37 bool m_bDebug;
38
39 [Attribute(desc: "What causes the increase", category: "Input")]
40 ref array<ref SCR_ScenarioFrameworkLogicInput> m_aInputs;
41
42 [Attribute(desc: "What to do once counter is reached", category: "OnActivate")]
43 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActions;
44
45 bool m_bIsTerminated; //Marks if this was terminated - either by death or deletion
46
47 //------------------------------------------------------------------------------------------------
49 void Init()
50 {
52 return;
53
55 {
56 input.Init(this);
57 }
58 }
59
60 //------------------------------------------------------------------------------------------------
62 void SetIsTerminated(bool state)
63 {
64 m_bIsTerminated = state;
65 }
66
67 //------------------------------------------------------------------------------------------------
70 {
71 return m_bIsTerminated;
72 }
73
74 //------------------------------------------------------------------------------------------------
75 void OnInput(bool pSignal = true, IEntity entity = null);
76
77 //------------------------------------------------------------------------------------------------
79 void OnActivate(IEntity entity)
80 {
81 // Here you can debug specific Logic instance.
82 // This can be also adjusted during runtime via Debug Menu > ScenarioFramework > Logic Inspector
83 if (m_bDebug)
84 Print("[SCR_ScenarioFrameworkLogic.OnActivate] debug line (" + __FILE__ + " L" + __LINE__ + ")", LogLevel.WARNING);
85
87 action.OnActivate(entity);
88 }
89
90 //------------------------------------------------------------------------------------------------
92 {
94 {
95 action.RestoreToDefault();
96 }
97 }
98
99#ifdef WORKBENCH
100 //------------------------------------------------------------------------------------------------
103 override void _WB_OnCreate(IEntitySource src)
104 {
105 WorldEditorAPI api = _WB_GetEditorAPI();
106 IEntitySource thisSrc = api.EntityToSource(this);
107 api.RenameEntity(thisSrc, api.GenerateDefaultEntityName(thisSrc));
108 }
109#endif
110}
111
112class SCR_ScenarioFrameworkLogicCounterClass : SCR_ScenarioFrameworkLogicClass
113{
114}
115
116class SCR_ScenarioFrameworkLogicCounter : SCR_ScenarioFrameworkLogic
117{
118 [Attribute(defvalue: "1", desc: "Threshold", UIWidgets.Graph, category: "Counter")]
119 int m_iCountTo;
120
121 [Attribute(desc: "What to do once value is increased", category: "OnIncrease")]
122 ref array<ref SCR_ScenarioFrameworkActionBase> m_aOnIncreaseActions;
123
124 [Attribute(desc: "What to do once value is decreased", category: "OnDecrease")]
125 ref array<ref SCR_ScenarioFrameworkActionBase> m_aOnDecreaseActions;
126
127 int m_iCnt = 0;
128
129 //------------------------------------------------------------------------------------------------
133 override void OnInput(bool pSignal = true, IEntity entity = null)
134 {
135 if (entity)
136 Increase(entity);
137 else
138 Increase(this);
139 }
140
141 //------------------------------------------------------------------------------------------------
144 {
145 return m_iCnt;
146 }
147
148 //------------------------------------------------------------------------------------------------
150 void SetCounterValue(int value)
151 {
152 m_iCnt = value;
153 }
154
155 //------------------------------------------------------------------------------------------------
158 void Increase(IEntity entity)
159 {
160 // Here you can debug specific Logic instance.
161 // This can be also adjusted during runtime via Debug Menu > ScenarioFramework > Logic Inspector
162 if (m_bDebug)
163 Print("[SCR_ScenarioFrameworkLogicCounter.Increase] debug line (" + __FILE__ + " L" + __LINE__ + ")", LogLevel.WARNING);
164
165 m_iCnt++;
166 if (m_iCnt == m_iCountTo)
167 {
168 OnActivate(entity);
169 }
170
172 {
173 increaseAction.OnActivate(entity);
174 }
175 }
176
177 //------------------------------------------------------------------------------------------------
180 void Decrease(IEntity entity)
181 {
182 // Here you can debug specific Logic instance.
183 // This can be also adjusted during runtime via Debug Menu > ScenarioFramework > Logic Inspector
184 if (m_bDebug)
185 Print("[SCR_ScenarioFrameworkLogicCounter.Decrease] debug line (" + __FILE__ + " L" + __LINE__ + ")", LogLevel.WARNING);
186
187 m_iCnt--;
188 if (m_iCnt == m_iCountTo)
189 {
190 OnActivate(entity);
191 }
192
194 {
195 decreaseAction.OnActivate(entity);
196 }
197 }
198
199 //------------------------------------------------------------------------------------------------
201 void Reset()
202 {
203 m_iCnt = 0;
204 }
205
206 //------------------------------------------------------------------------------------------------
207 override void RestoreToDefault()
208 {
209 super.RestoreToDefault();
210
211 Reset();
212
213 foreach (SCR_ScenarioFrameworkActionBase action : m_aOnIncreaseActions)
214 {
215 action.RestoreToDefault();
216 }
217
218 foreach (SCR_ScenarioFrameworkActionBase action : m_aOnDecreaseActions)
219 {
220 action.RestoreToDefault();
221 }
222 }
223}
224
225//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
226class SCR_ScenarioFrameworkLogicORClass : SCR_ScenarioFrameworkLogicClass
227{
228}
229
230class SCR_ScenarioFrameworkLogicOR : SCR_ScenarioFrameworkLogic
231{
233
234 //------------------------------------------------------------------------------------------------
238 override void OnInput(bool pSignal = true, IEntity entity = null)
239 {
240 if (pSignal)
242 else
244 }
245}
246
247class SCR_ScenarioFrameworkLogicSwitchClass : SCR_ScenarioFrameworkLogicClass
248{
249}
250
251class SCR_ScenarioFrameworkLogicSwitch : SCR_ScenarioFrameworkLogic
252{
253}
254//---- REFACTOR NOTE END ----
override void Init()
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
ref SCR_SortedArray< SCR_BaseEditorAction > m_aActions
override void OnActivate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void SetIsTerminated(bool state)
void OnInput(bool pSignal=true, IEntity entity=null)
void Init()
Initializes scenario framework logic and inputs.
void RestoreToDefault()
SCR_ScenarioFrameworkLogicORClass m_iActivations
void SetCounterValue(int value)
void Decrease(IEntity entity)
int GetCounterValue()
ref array< ref SCR_ScenarioFrameworkLogicInput > m_aInputs
SCR_ScenarioFrameworkLogic m_MasterLogic
ref SCR_ScenarioFrameworkActionInputBase m_InputAction
void Increase(IEntity entity)
ref array< ref SCR_ScenarioFrameworkActionBase > m_aOnIncreaseActions
ref array< ref SCR_ScenarioFrameworkActionBase > m_aOnDecreaseActions
enum EVehicleType IEntity
event void _WB_OnCreate(IEntitySource src)
Called after entity gets created in map during editing or when deleted entity gets restored after und...
proto external WorldEditorAPI _WB_GetEditorAPI()
This returns world editor API, which is safe to use from editor events bellow.
Definition Math.c:13
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
void Reset()