17 [
Attribute(
desc:
"StringID for the Intro Voiceline action to be processed. Processing must be setup after tasks are initialized.",
category:
"Task")]
18 string m_sTaskIntroVoiceline;
20 [
Attribute(defvalue:
"1",
desc:
"What to do once task is finished", UIWidgets.Auto,
category:
"OnTaskFinish")]
21 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnFinished;
23 [
Attribute(defvalue:
"1",
desc:
"What to do once task is created", UIWidgets.Auto,
category:
"OnTaskCreate")]
24 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnCreated;
26 [
Attribute(defvalue:
"1",
desc:
"What to do once task is created", UIWidgets.Auto,
category:
"OnTaskFailed")]
27 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnFailed;
29 [
Attribute(defvalue:
"1",
desc:
"What to do once task progressed", UIWidgets.Auto,
category:
"OnTaskProgress")]
30 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnProgress;
32 [
Attribute(defvalue:
"1",
desc:
"What to do once task is updated", UIWidgets.Auto,
category:
"OnTaskUpdated")]
33 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnUpdated;
35 SCR_ScenarioFrameworkLayerTask m_TaskLayer;
36 bool m_bTaskResolvedBeforeLoad;
44 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnCreated)
49 else if (newState ==
SCR_TaskState.FINISHED && !m_bTaskResolvedBeforeLoad)
51 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnFinished)
56 else if (newState ==
SCR_TaskState.CANCELLED && !m_bTaskResolvedBeforeLoad)
58 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnFailed)
63 else if (newState ==
SCR_TaskState.PROGRESSED && !m_bTaskResolvedBeforeLoad)
65 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnProgress)
72 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnUpdated)
83 m_bTaskResolvedBeforeLoad = state;
92 m_TaskLayer.SetSlotTask(
this);
98 Print(
string.Format(
"ScenarioFramework: %1 could not be spawned and cannot bind it to task %2", m_sObjectToSpawn, m_TaskLayer.GetOwner().GetName()), LogLevel.ERROR);
114 return m_sTaskExecutionBriefing;
122 return m_sTaskDescription;
129 SCR_ScenarioFrameworkLayerTask layer;
130 IEntity entity =
GetOwner().GetParent();
133 layer = SCR_ScenarioFrameworkLayerTask.Cast(entity.FindComponent(SCR_ScenarioFrameworkLayerTask));
137 entity = entity.GetParent();
145 override void RestoreToDefault(
bool includeChildren =
false,
bool reinitAfterRestoration =
false)
147 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnFinished)
149 activationAction.m_iNumberOfActivations = 0;
152 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnCreated)
154 activationAction.m_iNumberOfActivations = 0;
157 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnFailed)
159 activationAction.m_iNumberOfActivations = 0;
162 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnProgress)
164 activationAction.m_iNumberOfActivations = 0;
167 foreach (SCR_ScenarioFrameworkActionBase activationAction : m_aActionsOnUpdated)
169 activationAction.m_iNumberOfActivations = 0;
173 m_bTaskResolvedBeforeLoad =
false;
175 super.RestoreToDefault(includeChildren, reinitAfterRestoration);
181 Init(
null, SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT);
211 override void Init(
SCR_ScenarioFrameworkArea area =
null, SCR_ScenarioFrameworkEActivationType activation = SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT)
227 if (!activationCondition.Init(
GetOwner()))
247 IEntity entity =
GetOwner().GetParent();
255 if (!layerBase.GetEnableRepeatedSpawn())
257 Print(
string.Format(
"ScenarioFramework: Object %1 already exists and won't be spawned for %2, exiting...",
m_Entity,
GetOwner().
GetName()), LogLevel.ERROR);
266 if (!m_bUseExistingWorldAsset)
272 QueryObjectsInRange();
285 if (!m_sID.IsEmpty())
288 SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(
m_Entity.FindComponent(SCR_DamageManagerComponent));
289 if (objectDmgManager)
290 objectDmgManager.GetOnDamageStateChanged().Insert(
OnObjectDamage);
294 EventHandlerManagerComponent ehManager = EventHandlerManagerComponent.Cast(
m_Entity.FindComponent(EventHandlerManagerComponent));
296 ehManager.RegisterScriptHandler(
"OnCompartmentEntered",
this,
OnCompartmentEntered,
false,
true);
303 if (!m_bCanBeGarbageCollected)
307 garbageSystem.UpdateBlacklist(
m_Entity,
true);