Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkADSCondition.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Entity to check")]
5 ref SCR_ScenarioFrameworkGet m_Getter;
6
7 [Attribute(desc: "Entity(s) must have this aim down sights state")]
8 protected bool m_bMustBeADS;
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_ScenarioFrameworkADSCondition.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 {
24 SCR_ScenarioFrameworkParam<array<IEntity>> entityArrayWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
25 if (!entityArrayWrapper)
26 {
27 PrintFormat("ScenarioFramework Condition: Issue with Getter detected for condition %1.", this, level: LogLevel.ERROR);
28 return false;
29 }
30
31 array<IEntity> entities = entityArrayWrapper.GetValue();
32
33 if (entities.IsEmpty())
34 {
35 PrintFormat("ScenarioFramework Condition: Array Getter for %1 has no elements to work with.", this, level: LogLevel.ERROR);
36 return false;
37 }
38
39 foreach (IEntity ent : entities)
40 {
41 if (!EvaluateEntityStance(ent))
42 return false;
43 }
44
45 return true;
46 }
47
48 IEntity WrappedEntity = entityWrapper.GetValue();
49 if (!WrappedEntity)
50 {
51 PrintFormat("ScenarioFramework Condition: Entity not found for condition %1.", this, level: LogLevel.ERROR);
52 return false;
53 }
54
55 return EvaluateEntityStance(WrappedEntity);
56 }
57
58 //------------------------------------------------------------------------------------------------
62 protected bool EvaluateEntityStance(notnull IEntity entitiy)
63 {
65 if (!controllerComponent)
66 return true;
67
68 bool isADS = controllerComponent.IsWeaponADS();
69 return m_bMustBeADS == isADS;
70 }
71}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
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