Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkTaskStatusCondition.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Layer task(s) to check for condition. If multiple layer tasks are specified, they must all have an acceptable state.")]
5 ref SCR_ScenarioFrameworkGet m_Getter;
6
7 [Attribute(desc: "If the layer task is any of these states, the condition will be statisfied", defvalue: SCR_ETaskState.COMPLETED.ToString(), uiwidget: UIWidgets.ComboBox, enumType: SCR_ETaskState)]
8 ref array<SCR_ETaskState> m_aAcceptableTaskStates;
9
10 //------------------------------------------------------------------------------------------------
11 override bool Init(IEntity entity)
12 {
13 // Here you can debug specific Condition instance.
14 // This can be also adjusted during runtime via Debug Menu > ScenarioFramework > Condition Inspector
15 if (m_bDebug)
16 Print("[SCR_ScenarioFrameworEntitykDamageStateCondition.Init] debug line (" + __FILE__ + " L" + __LINE__ + ")", LogLevel.WARNING);
17
18 if (!m_Getter)
19 return false;
20
21 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
22 if (entityWrapper)
23 return EvaluateEntityAsTaskState(entityWrapper.GetValue());
24
25 // Check if multiple entities are referenced
26 SCR_ScenarioFrameworkParam<array<IEntity>> entityArrayWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
27 if (!entityArrayWrapper)
28 {
29 Print(string.Format("ScenarioFramework Condition: Issue with Getter detected for condition %1.", this), LogLevel.ERROR);
30 return false;
31 }
32
33 array<IEntity> entities = entityArrayWrapper.GetValue();
34 if (entities.IsEmpty())
35 {
36 Print(string.Format("ScenarioFramework Condition: Array Getter for %1 has no elements to work with.", this), LogLevel.ERROR);
37 return false;
38 }
39
40 foreach (IEntity ent : entities)
41 {
43 return false;
44 }
45
46 return true;
47 }
48
49 //------------------------------------------------------------------------------------------------
53 protected bool EvaluateEntityAsTaskState(IEntity entity)
54 {
55 if (!entity)
56 {
57 Print(string.Format("ScenarioFramework Condition: Entity was null for condition %1.", this), LogLevel.ERROR);
58 return false;
59 }
60
61 SCR_ScenarioFrameworkLayerTask task = SCR_ScenarioFrameworkLayerTask.Cast(entity.FindComponent(SCR_ScenarioFrameworkLayerTask));
62 if (!task)
63 {
64 Print(string.Format("ScenarioFramework Condition: entity %2 had no SCR_ScenarioFrameworkLayerTask for condition %1.", this, entity), LogLevel.ERROR);
65 return false;
66 }
67
68 return EvaluateTaskState(task);
69 }
70
71 //------------------------------------------------------------------------------------------------
75 protected bool EvaluateTaskState(notnull SCR_ScenarioFrameworkLayerTask layer)
76 {
77 SCR_ETaskState state = layer.GetLayerTaskState();
78 return m_aAcceptableTaskStates.Contains(state);
79 }
80}
override void Init()
LayerPresets layer
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_ETaskState
Definition SCR_Task.c:3
proto external Managed FindComponent(typename typeName)
bool EvaluateTaskState(notnull SCR_ScenarioFrameworkLayerTask layer)
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