Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkSlotTask.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/ScenarioFramework/Slot", description: "")]
5
6class SCR_ScenarioFrameworkSlotTask : SCR_ScenarioFrameworkSlotBase
7{
8 [Attribute(desc: "Name of the task in list of tasks", category: "Task")]
9 LocalizedString m_sTaskTitle;
10
11 [Attribute(desc: "Description of the task", category: "Task")]
12 LocalizedString m_sTaskDescription;
13
14 [Attribute(params: "edds imageset", uiwidget: UIWidgets.ResourcePickerThumbnail, desc: "Task icon set", category: "Task UI")]
15 ResourceName m_sTaskIconSet;
16
17 [Attribute(desc: "Name of the specific icon from the icon set", category: "Task UI")]
18 string m_sTaskIconName;
19
20 [Attribute(desc: "Text for the Execution category in Briefing", category: "Task")]
22
23 [Attribute(desc: "StringID for the Intro Voiceline action to be processed. Processing must be setup after tasks are initialized.", category: "Task")]
24 string m_sTaskIntroVoiceline;
25
26 [Attribute(desc: "Conditions that will be checked upon trying to finish a task", category: "Task")]
27 ref array<ref SCR_ScenarioFrameworkActivationConditionBase> m_aFinishConditions;
28
29 [Attribute(defvalue: SCR_EScenarioFrameworkLogicOperators.AND.ToString(), UIWidgets.ComboBox, "Which Boolean Logic will be used for Finish Conditions.", "", enums: SCR_EScenarioFrameworkLogicOperatorHelper.GetParamInfo(), category: "Task")]
30 SCR_EScenarioFrameworkLogicOperators m_eFinishConditionLogic;
31
32 [Attribute(desc: "What to do once task is finished", UIWidgets.Auto, category: "Task State Changed Actions")]
33 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnFinished;
34
35 [Attribute(desc: "What to do once task is created", UIWidgets.Auto, category: "Task State Changed Actions")]
36 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnCreated;
37
38 [Attribute(desc: "What to do once task is created", UIWidgets.Auto, category: "Task State Changed Actions")]
39 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnFailed;
40
41 [Attribute(desc: "What to do once task is cancelled", UIWidgets.Auto, category: "Task State Changed Actions")]
42 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnCancelled;
43
44 [Attribute(desc: "What to do once task progressed", UIWidgets.Auto, category: "Task State Changed Actions")]
45 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnProgress;
46
47 [Attribute(desc: "What to do once task is updated", UIWidgets.Auto, category: "Task State Changed Actions")]
48 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnAssigned;
49
50 SCR_ScenarioFrameworkLayerTask m_TaskLayer;
51 bool m_bTaskResolvedBeforeLoad;
52
53 //------------------------------------------------------------------------------------------------
56 {
57 if (m_TaskLayer)
58 {
59 SCR_ScenarioFrameworkTask task = m_TaskLayer.GetTask();
60 if (task)
61 m_TaskLayer.OnTaskStateChanged(task.GetTaskState(), newState);
62 }
63
64 if (newState == SCR_ETaskState.CREATED)
65 {
66 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnCreated)
67 {
68 action.OnActivate(GetOwner());
69 }
70 }
71 else if (newState == SCR_ETaskState.COMPLETED && !m_bTaskResolvedBeforeLoad)
72 {
73 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnFinished)
74 {
75 action.OnActivate(GetOwner());
76 }
77 }
78 else if (newState == SCR_ETaskState.FAILED && !m_bTaskResolvedBeforeLoad)
79 {
80 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnFailed)
81 {
82 action.OnActivate(GetOwner());
83 }
84 }
85 else if (newState == SCR_ETaskState.CANCELLED && !m_bTaskResolvedBeforeLoad)
86 {
87 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnCancelled)
88 {
89 action.OnActivate(GetOwner());
90 }
91 }
92 else if (newState == SCR_ETaskState.PROGRESSED && !m_bTaskResolvedBeforeLoad)
93 {
94 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnProgress)
95 {
96 action.OnActivate(GetOwner());
97 }
98 }
99 else
100 {
101 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnAssigned)
102 {
103 action.OnActivate(GetOwner());
104 };
105 }
106 }
107
108 //------------------------------------------------------------------------------------------------
111 {
112 m_bTaskResolvedBeforeLoad = state;
113 }
114
115 //------------------------------------------------------------------------------------------------
118 {
119 m_TaskLayer = GetParentTaskLayer();
120 if (m_TaskLayer)
121 {
122 m_TaskLayer.SetSlotTask(this);
123 if (m_Entity)
124 m_TaskLayer.SetEntity(m_Entity);
125 }
126 else
127 {
128 Print(string.Format("ScenarioFramework: %1 could not be spawned and cannot bind it to task %2", m_sObjectToSpawn, m_TaskLayer.GetOwner().GetName()), LogLevel.ERROR);
129 }
130 }
131
132 //------------------------------------------------------------------------------------------------
137 {
138 return m_sTaskTitle;
139 }
140
141 //------------------------------------------------------------------------------------------------
147
148 //------------------------------------------------------------------------------------------------
152 string GetTaskDescription(int iState = 0)
153 {
154 return m_sTaskDescription;
155 }
156
157 //------------------------------------------------------------------------------------------------
160 {
161 if (!m_TaskLayer)
162 {
163 m_TaskLayer = GetParentTaskLayer();
164 if (!m_TaskLayer)
165 return SCR_ETaskState.CREATED;
166 }
167
168 if (m_TaskLayer.m_Task)
169 return m_TaskLayer.m_Task.GetTaskState();
170 else
171 return SCR_ETaskState.CREATED;
172 }
173
174 //------------------------------------------------------------------------------------------------
176 SCR_ScenarioFrameworkLayerTask GetParentTaskLayer()
177 {
178 SCR_ScenarioFrameworkLayerTask layer;
179 IEntity entity = GetOwner().GetParent();
180 while (entity)
181 {
182 layer = SCR_ScenarioFrameworkLayerTask.Cast(entity.FindComponent(SCR_ScenarioFrameworkLayerTask));
183 if (layer)
184 return layer;
185
186 entity = entity.GetParent();
187 }
188
189 return null;
190 }
191
192 //------------------------------------------------------------------------------------------------
197 override void RestoreToDefault(bool includeChildren = false, bool reinitAfterRestoration = false, bool affectRandomization = true, bool deleteSpawnedEntities = true)
198 {
199 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnFinished)
200 {
201 activationAction.RestoreToDefault();
202 }
203
204 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnCreated)
205 {
206 activationAction.RestoreToDefault();
207 }
208
209 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnFailed)
210 {
211 activationAction.RestoreToDefault();
212 }
213
214 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnCancelled)
215 {
216 activationAction.RestoreToDefault();
217 }
218
219 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnProgress)
220 {
221 activationAction.RestoreToDefault();
222 }
223
224 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnAssigned)
225 {
226 activationAction.RestoreToDefault();
227 }
228
229 if (m_TaskLayer)
230 m_TaskLayer.ProcessLayerTaskState(SCR_ETaskState.CANCELLED);
231
232 m_TaskLayer = null;
233 m_bTaskResolvedBeforeLoad = false;
234
235 super.RestoreToDefault(includeChildren, reinitAfterRestoration, affectRandomization, deleteSpawnedEntities);
236 }
237
238 //------------------------------------------------------------------------------------------------
240 override void DynamicReinit()
241 {
242 Init(null, SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT);
243 }
244
245 //------------------------------------------------------------------------------------------------
249 {
251 if (!m_Entity && !SCR_StringHelper.IsEmptyOrWhiteSpace(m_sObjectToSpawn))
252 {
254 return;
255 }
256
258 return;
259
260 if (m_Entity)
261 {
262 m_vPosition = m_Entity.GetOrigin();
264 if (invComp)
265 invComp.m_OnParentSlotChangedInvoker.Remove(OnInventoryParentChanged);
266 }
267
268 m_bInitiated = false;
270 SCR_EntityHelper.DeleteEntityAndChildren(m_Entity);
271 }
272
273 //------------------------------------------------------------------------------------------------
276 override bool InitNotTerminated()
277 {
278 if (m_bIsTerminated)
280
281 return super.InitNotTerminated();
282 }
283
284 //------------------------------------------------------------------------------------------------
287 override bool InitEntitySpawnCheck()
288 {
289 if (!m_Entity)
291
292 super.InitEntitySpawnCheck();
293
294 if (m_Entity)
295 return true;
296 else
297 return false;
298 }
299
300 //------------------------------------------------------------------------------------------------
302 override void FinishInit()
303 {
305 super.FinishInit();
306 }
307
308 //------------------------------------------------------------------------------------------------
311 {
313 return;
314
315 DynamicDespawn(this);
316
317 if (!m_TaskLayer)
318 {
319 m_TaskLayer = GetParentTaskLayer();
320 if (!m_TaskLayer)
321 return;
322
323 m_TaskLayer.ProcessLayerTaskState(SCR_ETaskState.CANCELLED);
324 }
325 }
326}
override void Init()
LayerPresets layer
vector m_vPosition
enum EAITargetInfoCategory m_Entity
void OnTaskStateChanged(SCR_Task task, SCR_ETaskState newState)
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void DynamicReinit()
Reinitializes this layer.
ScriptInvokerScenarioFrameworkLayer GetOnAllChildrenSpawned()
bool m_bExcludeFromDynamicDespawn
void FinishInit()
Initializes children, retrieves them, and spawns them.
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
void DynamicDespawn(SCR_ScenarioFrameworkLayerBase layer)
bool m_bDynamicallyDespawned
string GetTaskDescription()
string GetTaskTitle()
void RestoreToDefault()
void SCR_ScenarioFrameworkSlotBase(IEntityComponentSource src, IEntity ent, IEntity parent)
bool InitEntitySpawnCheck()
void OnInventoryParentChanged(InventoryStorageSlot oldSlot, InventoryStorageSlot newSlot)
override void StoreTaskSubjectToParentTaskLayer()
Sets delivery point entity for nested tasks within associated layers or parent layer if no associated...
LocalizedString GetTaskExecutionBriefing()
SCR_ETaskState GetTaskState()
void SetTaskResolvedBeforeLoad(bool state)
void ~SCR_ScenarioFrameworkSlotTask()
Removes current task from support entity if in scenario mode, otherwise despawns self.
SCR_ScenarioFrameworkLayerTask GetParentTaskLayer()
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnCancelled
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnCreated
SCR_ScenarioFrameworkSlotAISave m_aActionsOnFinished
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnAssigned
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnFailed
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnProgress
SCR_ETaskState
Definition SCR_Task.c:3
SCR_ExtendedTaskSave m_sTaskExecutionBriefing
proto external Managed FindComponent(typename typeName)
proto external IEntity GetParent()
static bool IsEditMode()
Definition Functions.c:1566
static bool IsEmptyOrWhiteSpace(string input)
IEntity GetOwner()
Owner entity of the fuel tank.
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