12 string m_sTaskDescription;
17 [
Attribute(defvalue: SCR_ETaskOwnership.FACTION.ToString(),
desc:
"Who will be the owner of the task for whom it will be assignable. In Default, it will be owned by the given Faction.", uiwidget:
UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(SCR_ETaskOwnership),
category:
"Task Enums")];
23 [
Attribute(defvalue: SCR_ETaskUIVisibility.ALL.ToString(),
desc:
"Where will the task be visible in UI. In default, it will be visible in the Task List and on the Map.", uiwidget:
UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(SCR_ETaskUIVisibility),
category:
"Task Enums")];
30 string m_sOverrideObjectDisplayName;
36 string m_sTaskIconName;
38 [
Attribute(defvalue:
"1",
desc:
"Whether task has functionality on its own or it is just holder for parent task without actuall functionality",
category:
"Task")]
39 bool m_bTaskFunctionsOnItsOwn;
42 ref array<ref SCR_ScenarioFrameworkActivationConditionBase> m_aFinishConditions;
50 [
Attribute(defvalue:
"1",
desc:
"It will set percentage of progress based on the number of completed tasks that are not optional",
category:
"Task UI")]
51 bool m_bCalculateProgressBarOnCompletedTasks;
53 [
Attribute(
desc:
"Marker on map is placed directly on the task subject Slot or on layer Slot",
category:
"Task UI")]
54 bool m_bPlaceMarkerOnSubjectSlot;
59 [
Attribute(defvalue:
"0",
desc:
"Marker Update Interval. If set to 0, marker position won't be automatically updated",
params:
"0 inf 0.01",
category:
"Task UI")]
60 protected float m_fMarkerUpdateInterval;
65 [
Attribute(defvalue:
"-1",
desc:
"Number Of Requiered Tasks To Finish this task if it has subtasks. Optional subtasks are excluded. -1 for currently attached subtasks (It can change in runtime)",
params:
"-1 inf",
category:
"Subtask")]
66 int m_iNumberOfRequieredTasksToFinish;
68 [
Attribute(
desc:
"Description that is displayed above subtasks in the parent task",
category:
"Subtask", )]
69 string m_sSubtasksDescription;
71 [
Attribute(defvalue:
"0",
desc:
"If it is a subtask it will be grouped under the top most LayerTask or if attribute target parent task is filled, it will group it under that",
category:
"Subtask")]
74 [
Attribute(defvalue:
"0",
desc:
"If this is subtask, whether or not the subtask is optional or not.",
category:
"Subtask")]
77 [
Attribute(
desc:
"Name of the parent LayerTask if this LayerTask is set to be a Subtask. It will override default behaviour, where parent LayerTask is the top most LayerTask in hierarchy.",
category:
"Subtask", )]
78 string m_sParentLayerTask;
98 SCR_ScenarioFrameworkLayerTask m_TopParentLayerTask;
99 SCR_ScenarioFrameworkSlotTask m_SlotTask;
102 bool m_bTaskResolvedBeforeLoad;
103 bool m_bTaskCompletedWithoutSubtasks;
112 return m_eLayerTaskState;
119 return m_bTaskResolvedBeforeLoad;
126 m_eLayerTaskState = state;
140 return m_sTaskPrefab;
147 return m_sOverrideObjectDisplayName;
154 m_sOverrideObjectDisplayName = name;
168 return m_sTaskDescription;
175 if (!m_sOverrideObjectDisplayName.IsEmpty() && m_SlotTask && m_SlotTask.GetOverriddenObjectDisplayName().IsEmpty())
176 m_SlotTask.SetOverriddenObjectDisplayName(m_sOverrideObjectDisplayName);
178 return m_sTaskDescription;
185 return m_eTypeOfTask;
192 SCR_ScenarioFrameworkLayerTask topMostLayer;
196 SCR_ScenarioFrameworkLayerTask
layer = SCR_ScenarioFrameworkLayerTask.Cast(entity.
FindComponent(SCR_ScenarioFrameworkLayerTask));
198 topMostLayer =
layer;
211 override void RestoreToDefault(
bool includeChildren =
false,
bool reinitAfterRestoration =
false,
bool affectRandomization =
true,
bool deleteSpawnedEntities =
true)
215 activationAction.RestoreToDefault();
220 activationAction.RestoreToDefault();
225 activationAction.RestoreToDefault();
230 activationAction.RestoreToDefault();
235 activationAction.RestoreToDefault();
240 activationAction.RestoreToDefault();
250 m_bTaskResolvedBeforeLoad =
false;
252 super.RestoreToDefault(includeChildren, reinitAfterRestoration, affectRandomization, deleteSpawnedEntities);
280 if (!activationCondition.Init(
GetOwner()))
294 child.DynamicDespawn(
this);
330 else if (newState ==
SCR_ETaskState.COMPLETED && !m_bTaskResolvedBeforeLoad)
337 else if (newState ==
SCR_ETaskState.FAILED && !m_bTaskResolvedBeforeLoad)
344 else if (newState ==
SCR_ETaskState.CANCELLED && !m_bTaskResolvedBeforeLoad)
351 else if (newState ==
SCR_ETaskState.PROGRESSED && !m_bTaskResolvedBeforeLoad)
371 m_SlotTask = slotTask;
373 m_Task.SetSlotTask(slotTask);
390 if (!m_SlotTask &&
m_Task)
391 m_SlotTask =
m_Task.GetSlotTask();
396 if (state ==
SCR_ETaskState.COMPLETED || !m_bTaskCompletedWithoutSubtasks)
400 if (!m_SlotTask.m_aFinishConditions || m_SlotTask.m_aFinishConditions.IsEmpty())
413 if (!m_SlotTask.m_aFinishConditions || m_SlotTask.m_aFinishConditions.IsEmpty())
426 int allRequiredTasks;
433 array<SCR_Task> subtasks =
m_Task.GetChildTasks();
434 array<SCR_ScenarioFrameworkTask> optional_subtasks = {};
435 if (subtasks && subtasks.Count() > 0)
438 foreach (
SCR_Task subtask : subtasks)
460 if (m_iNumberOfRequieredTasksToFinish == -1)
462 if (finishedTasks != allRequiredTasks)
464 m_bTaskCompletedWithoutSubtasks =
true;
470 if (finishedTasks != m_iNumberOfRequieredTasksToFinish)
472 m_bTaskCompletedWithoutSubtasks =
true;
477 if (calledFromSubtask)
479 if (m_bTaskFunctionsOnItsOwn && !m_bTaskCompletedWithoutSubtasks)
484 if (!m_bTaskFunctionsOnItsOwn)
490 if (!frameworkSubtask.GetLayerTask())
493 frameworkSubtask.GetLayerTask().ProcessLayerTaskState(
SCR_ETaskState.CANCELLED,
false,
true);
514 if (m_bProgressBar && m_bCalculateProgressBarOnCompletedTasks && allRequiredTasks != 0)
515 m_Task.SetTaskProgress(100 * (finishedTasks/allRequiredTasks),
false);
525 array<SCR_Task> subtasks =
m_Task.GetChildTasks();
526 if (subtasks && subtasks.Count() > 0)
529 int allRequiredTasks;
531 foreach (
SCR_Task subtask : subtasks)
545 if (m_bProgressBar && m_bCalculateProgressBarOnCompletedTasks && allRequiredTasks != 0)
546 m_Task.SetTaskProgress(100 * (finishedTasks/allRequiredTasks),
false);
548 if (m_iNumberOfRequieredTasksToFinish == -1)
550 if (finishedTasks == allRequiredTasks)
557 if (finishedTasks == m_iNumberOfRequieredTasksToFinish)
581 m_SlotTask =
m_Task.GetSlotTask();
603 m_bTaskResolvedBeforeLoad =
true;
604 m_SlotTask.SetTaskResolvedBeforeLoad(
true);
630 m_Task.SetLayerTask(
this);
631 m_SlotTask.OnTaskStateChanged(m_eLayerTaskState);
635 m_bTaskResolvedBeforeLoad =
true;
636 m_SlotTask.SetTaskResolvedBeforeLoad(
true);
647 if (m_fMarkerUpdateInterval > 0)
659 if (m_fMarkerUpdateInterval > 0)
671 if (newPosition ==
m_Task.GetTaskPosition())
684 if (m_EntityToAttachGetter)
686 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_EntityToAttachGetter.Get());
689 IEntity entity = entityWrapper.GetValue();
695 if (m_bPlaceMarkerOnSubjectSlot && m_SlotTask)
696 return m_SlotTask.GetOwner().GetOrigin();
710 Print(
string.Format(
"ScenarioFramework: Creating of task %1 failed! Task manager refused to create it.", m_sTaskTitle),
LogLevel.ERROR);
714 array<Faction> aPlayableFactions = {};
716 FactionManager manager =
GetGame().GetFactionManager();
719 Print(
string.Format(
"ScenarioFramework: Creating of task %1 failed! Faction manager doesn't exist", m_sTaskTitle),
LogLevel.ERROR);
723 manager.GetFactionsList(aPlayableFactions);
729 foreach (
Faction faction : aPlayableFactions)
742 if (faction == testFaction)
750 if (!factionSelected)
752 Print(
string.Format(
"ScenarioFramework: Creating of task %1 failed for %2! No playable faction available", m_sTaskTitle,
GetOwner().
GetName()),
LogLevel.ERROR);
761 m_Task.SetCustomSubtaskDescription(m_sSubtasksDescription);
763 m_Task.SetSlotTask(m_SlotTask);
776 if (!m_SlotTask.GetTaskTitle().IsEmpty())
777 return m_SlotTask.GetTaskTitle();
783 Print(
string.Format(
"ScenarioFramework - LayerTask: Task Subject not found doesn't exist for %1. Task won't be spawned!",
GetOwner().
GetName()),
LogLevel.ERROR);
795 if (!m_SlotTask.GetTaskDescription().IsEmpty())
796 return m_SlotTask.GetTaskDescription();
798 return m_sTaskDescription;
802 Print(
string.Format(
"ScenarioFramework - LayerTask: Task Subject not found doesn't exist for %1. Task won't be spawned!",
GetOwner().
GetName()),
LogLevel.ERROR);
803 return m_sTaskDescription;
820 Print(
string.Format(
"ScenarioFramework - LayerTask: Init Icon failed for %1 due to empty Task Icon Name",
GetOwner().
GetName()),
LogLevel.ERROR);
824 m_Task.SetTaskIconPath(m_sTaskIconSet);
825 m_Task.SetTaskIconSetName(m_sTaskIconName);
831 Print(
string.Format(
"ScenarioFramework - LayerTask: Init Icon failed for %1 due to empty Task Icon Name on the Slot Task",
GetOwner().
GetName()),
LogLevel.ERROR);
835 m_Task.SetTaskIconPath(m_SlotTask.m_sTaskIconSet);
836 m_Task.SetTaskIconSetName(m_SlotTask.m_sTaskIconName);
841 Print(
string.Format(
"ScenarioFramework - LayerTask: Slot Task not found doesn't exist for %1. Icon won't be initialized",
GetOwner().
GetName()),
LogLevel.ERROR);
854 return SCR_ScenarioFrameworkLayerTask.Cast(entity.
FindComponent(SCR_ScenarioFrameworkLayerTask));
864 array<LocalizedString> descriptionParams = {};
865 descriptionParams.Insert(m_SlotTask.GetSpawnedEntityDisplayName());
871 Print(
string.Format(
"ScenarioFramework - LayerTask: Task Subject not found doesn't exist for %1. Task won't be spawned!",
GetOwner().
GetName()),
LogLevel.ERROR);
876 s_OnTaskSetup.Invoke(
m_Task);
880 string cachedLanguage;
882 if (cachedLanguage !=
"en_us")
885 Print(
string.Format(
"ScenarioFramework: -> LayerTask: SlotTask %1 - generating task %2. Description: %3", m_SlotTask.GetOwner().GetName(),
WidgetManager.Translate(
m_Task.GetTaskName()),
string.Format(
WidgetManager.Translate(
m_Task.GetTaskDescription(),
WidgetManager.Translate(
m_Task.GetSlotTask().GetSpawnedEntityDisplayName())))),
LogLevel.NORMAL);
887 if (cachedLanguage !=
"en_us")
902 taskData.m_bLinkDataToRelatedTasks =
false;
909 if (!m_TopParentLayerTask)
911 Print(
string.Format(
"ScenarioFramework - LayerTask: Registering this task as a Subtask failed for %1",
GetOwner().
GetName()),
LogLevel.ERROR);
917 array<LocalizedString> nameParams = {};
918 nameParams.Insert(
"#AR-Tasks_Optional");
920 m_Task.SetTaskName(
"%1 %2", nameParams);
923 if (m_TopParentLayerTask.GetIsInitiated())
933 if (!m_TopParentLayerTask || !
m_Task)
ArmaReforgerScripted GetGame()
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.
SCR_EScenarioFrameworkLogicOperators
SCR_ETaskNotificationSettings
void CreateTask(ResourceName taskPrefab, vector position, SCR_AIGroup group, int playerId)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_ScenarioFrameworkEActivationType
ref array< IEntity > m_aSpawnedEntities
ref array< ref SCR_ScenarioFrameworkActivationConditionBase > m_aActivationConditions
void DynamicReinit()
Reinitializes this layer.
ref array< SCR_ScenarioFrameworkLayerBase > m_aChildren
SCR_ScenarioFrameworkLayerBase m_ParentLayer
ScriptInvokerScenarioFrameworkLayer GetOnAllChildrenSpawned()
bool m_bExcludeFromDynamicDespawn
void FinishInit()
Initializes children, retrieves them, and spawns them.
ref array< SCR_ScenarioFrameworkLayerBase > m_aRandomlySpawnedChildren
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
void DynamicDespawn(SCR_ScenarioFrameworkLayerBase layer)
bool m_bDynamicallyDespawned
void SetOverridenObjectDisplayName(string name)
void ~SCR_ScenarioFrameworkLayerTask()
Removes task from support entity and despawns if in edit mode or task is cancelled.
void SetSlotTask(SCR_ScenarioFrameworkSlotTask slotTask)
void SetMarkerUpdateInterval(float newInterval)
void InitTask(SCR_ScenarioFrameworkLayerBase layer)
SCR_ScenarioFrameworkSlotTask GetSlotTask()
void SetLayerTaskState(SCR_ETaskState state)
ResourceName GetTaskPrefab()
string GetTaskDescription()
string GetOverridenObjectDisplayName()
SCR_ScenarioFrameworkTask GetTask()
void UpdateMarkerPosition()
Updates marker position on map, if it changed from previous one.
void InitIcon()
Initializes task icon based on provided task or slot task. If task icon set name or path is empty,...
string GetOriginalTaskDescription()
SCR_ESFTaskType GetTaskType()
void ProcessLayerTaskState(SCR_ETaskState state, bool forced=false, bool calledFromSubtask=false)
bool GetLayerTaskResolvedBeforeLoad()
string PrepareDescription()
SCR_ScenarioFrameworkLayerTask GetLayerTaskByName(string name)
SCR_ScenarioFrameworkLayerTask GetTopMostParentTaskLayer()
void OnTopParentLayerTaskInitialized(SCR_ScenarioFrameworkLayerBase layer)
void SetupSubtask()
Sets up a subtask, disables linking data to related tasks, and registers the task as a subtask of a p...
void ProcessSubTasks()
This method processes subtasks of a main task, calculates progress bar based on completed subtasks,...
vector GetMarkerPosition()
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnCancelled
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnCreated
ref array< ref SCR_ScenarioFrameworkActionSave > m_aTriggerActionsOnFinish
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnAssigned
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnFailed
ref array< ref SCR_ScenarioFrameworkActionSave > m_aActionsOnProgress
void SCR_Task(IEntitySource src, IEntity parent)
SCR_ETaskOwnership m_eTaskOwnership
SCR_ETaskUIVisibility m_eTaskUIVisibility
SCR_ETaskVisibility m_eTaskVisibility
SCR_TaskSystem m_TaskSystem
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external BaseWorld GetWorld()
proto external IEntity GetParent()
static ScriptCallQueue GetCallQueueNonPausable()
SCR_ScenarioFrameworkLayerTask GetLayerTask()
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.
SCR_EditableTaskComponentClass m_Task
Editable SCR_BaseTask.
SCR_FieldOfViewSettings Attribute