Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkActionCompareCounterAndExecute.c
Go to the documentation of this file.
3{
4
5 [Attribute("0", UIWidgets.ComboBox, "Operator", "", ParamEnumArray.FromEnum(SCR_EScenarioFrameworkComparisonOperator))]
7
8 [Attribute(desc: "Value")]
9 int m_iValue;
10
11 [Attribute(desc: "Counter to compare (Optional if this action is attached on Counter)")]
12 string m_sCounterName;
13
14 [Attribute(desc: "What to do once counter is reached", category: "OnActivate")]
15 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActions;
16
17 //------------------------------------------------------------------------------------------------
18 override void OnActivate(IEntity object)
19 {
20 if (!CanActivate())
21 return;
22
23 SCR_ScenarioFrameworkLogicCounter logicCounter;
24 if (SCR_StringHelper.IsEmptyOrWhiteSpace(m_sCounterName))
25 {
26 if (!object)
27 {
28 PrintFormat("ScenarioFramework Action: Logic Counter not found for Action %1", this, LogLevel.ERROR);
29 return;
30 }
31
32 logicCounter = SCR_ScenarioFrameworkLogicCounter.Cast(object);
33 if (!logicCounter)
34 {
35 PrintFormat("ScenarioFramework Action: Logic Counter %1 not found for Action %2", object.GetName(), this, LogLevel.ERROR);
36 return;
37 }
38 }
39 else
40 {
41 IEntity entity = GetGame().GetWorld().FindEntityByName(m_sCounterName);
42 if (!entity)
43 {
44 PrintFormat("ScenarioFramework Action: Could not find %1 for Action %2", m_sCounterName, this, LogLevel.ERROR);
45 return;
46 }
47
48 logicCounter = SCR_ScenarioFrameworkLogicCounter.Cast(entity);
49 if (!logicCounter)
50 {
51 PrintFormat("ScenarioFramework Action: Logic Counter %1 not found for Action %2", m_sCounterName, this, LogLevel.ERROR);
52 return;
53 }
54 }
55
56 int counterValue = logicCounter.m_iCnt;
57
58 if (
59 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.LESS_THAN) && (counterValue < m_iValue)) ||
60 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.LESS_OR_EQUAL) && (counterValue <= m_iValue)) ||
61 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.EQUAL) && (counterValue == m_iValue)) ||
62 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.GREATER_OR_EQUAL) && (counterValue >= m_iValue)) ||
63 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.GREATER_THEN) && (counterValue > m_iValue))
64 )
65 {
66 foreach (SCR_ScenarioFrameworkActionBase actions : m_aActions)
67 {
68 actions.OnActivate(object);
69 }
70 }
71 }
72
73 //------------------------------------------------------------------------------------------------
74 override array<ref SCR_ScenarioFrameworkActionBase> GetSubActions()
75 {
76 return m_aActions;
77 }
78}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override void OnActivate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external BaseWorld GetWorld()
static bool IsEmptyOrWhiteSpace(string input)
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
SCR_FieldOfViewSettings Attribute