Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CustomTriggerConditionsAltitude.c
Go to the documentation of this file.
1//Baseclass that is supposed to be extended and filled with custom conditions
4{
5 [Attribute(desc: "Entity to check.")]
6 ref SCR_ScenarioFrameworkGet m_Getter;
7
8 [Attribute(desc: "Checked altitude.", category: "Trigger")]
9 float m_fAltitude;
10
11 [Attribute("0", UIWidgets.ComboBox, "Operator", "", ParamEnumArray.FromEnum(SCR_EScenarioFrameworkComparisonOperator))]
13
14 //------------------------------------------------------------------------------------------------
17 override bool Init(IEntity entity)
18 {
19 if (m_bDebug)
20 Print("[SCR_CustomTriggerConditionsAltitude.Init] debug line (" + __FILE__ + " L" + __LINE__ + ")", LogLevel.WARNING);
21
22 array <IEntity> entities = {};
23 if (m_Getter)
24 {
25 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
26 if (!entityWrapper)
27 {
28 SCR_ScenarioFrameworkParam<array<IEntity>> entityArrayWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
29 if (!entityArrayWrapper)
30 {
31 PrintFormat("ScenarioFramework Condition: Issue with Getter detected for condition %1.", this, level: LogLevel.ERROR);
32 return false;
33 }
34
35 entities = entityArrayWrapper.GetValue();
36 }
37
38 IEntity wrappedEntity = entityWrapper.GetValue();
39 if (wrappedEntity)
40 entities.Insert(wrappedEntity);
41 }
42 else
43 {
45 if (!trigger)
46 return false;
47
48 trigger.GetEntitiesInside(entities);
49 }
50
51 if (!entities || entities.IsEmpty())
52 {
53 PrintFormat("ScenarioFramework Condition: Array Getter for %1 has no elements to work with.", this, level: LogLevel.ERROR);
54 return false;
55 }
56
57 float aglHeight;
58 foreach (IEntity ent : entities)
59 {
60 if (!ent)
61 continue;
62
63 aglHeight = SCR_TerrainHelper.GetHeightAboveTerrain(ent.GetOrigin());
64 if (
65 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.LESS_THAN) && (aglHeight < m_fAltitude)) ||
66 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.LESS_OR_EQUAL) && (aglHeight <= m_fAltitude)) ||
67 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.EQUAL) && (aglHeight == m_fAltitude)) ||
68 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.GREATER_OR_EQUAL) && (aglHeight >= m_fAltitude)) ||
69 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.GREATER_THEN) && (aglHeight > m_fAltitude))
70 )
71 return true;
72 }
73
74 return false;
75 }
76
77}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_EScenarioFrameworkComparisonOperator m_eComparisonOperator
static float GetHeightAboveTerrain(vector pos, BaseWorld world=null, bool noUnderwater=false, TraceParam trace=null)
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
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