Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkCharacterInVehicleCondition.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Entity to check.")]
5 ref SCR_ScenarioFrameworkGet m_Getter;
6
7 //------------------------------------------------------------------------------------------------
8 override bool Init(IEntity entity)
9 {
10 // Here you can debug specific Condition instance.
11 // This can be also adjusted during runtime via Debug Menu > ScenarioFramework > Condition Inspector
12 if (m_bDebug)
13 Print("[SCR_ScenarioFrameworkCharacterInVehicleCondition.Init] debug line (" + __FILE__ + " L" + __LINE__ + ")", LogLevel.WARNING);
14
15 if (!m_Getter)
16 return false;
17
18 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
19 if (!entityWrapper)
20 {
21 SCR_ScenarioFrameworkParam<array<IEntity>> entityArrayWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
22 if (!entityArrayWrapper)
23 {
24 PrintFormat("ScenarioFramework Condition: Issue with Getter detected for condition %1.", this, level: LogLevel.ERROR);
25 return false;
26 }
27
28 array<IEntity> entities = entityArrayWrapper.GetValue();
29
30 if (entities.IsEmpty())
31 {
32 PrintFormat("ScenarioFramework Condition: Array Getter for %1 has no elements to work with.", this, level: LogLevel.ERROR);
33 return false;
34 }
35
36 foreach (IEntity ent : entities)
37 {
38 if (!EvaluateInVehiclePresence(ent))
39 return false;
40 }
41
42 return true;
43 }
44
45 IEntity wrappedEntity = entityWrapper.GetValue();
46 if (!wrappedEntity)
47 {
48 Print(string.Format("ScenarioFramework Condition: Entity not found for condition %1.", this), LogLevel.ERROR);
49 return false;
50 }
51
52 return EvaluateInVehiclePresence(wrappedEntity);
53 }
54
55 //------------------------------------------------------------------------------------------------
56 bool EvaluateInVehiclePresence(notnull IEntity ent)
57 {
58 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(ent);
59 if (!character)
60 return false;
61
62 IEntity vehicle;
63 SCR_CompartmentAccessComponent compartmentAccessComponent = SCR_CompartmentAccessComponent.Cast(ent.FindComponent(SCR_CompartmentAccessComponent));
64 if (!compartmentAccessComponent)
65 false;
66
67 return compartmentAccessComponent.GetVehicle();
68 }
69}
override void Init()
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