Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkEntityDamageState.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Entity to check.")]
5 ref SCR_ScenarioFrameworkGet m_Getter;
6
7 [Attribute(uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EDamageState), desc: "Damage state to check. Returns true when the entity state match. If entity doesn't have damage manager, returns true. If array of entities is passed on, return false when at least one entity doesn't fit selected damage state.")]
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 {
24 SCR_ScenarioFrameworkParam<array<IEntity>> entityArrayWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
25 if (!entityArrayWrapper)
26 {
27 Print(string.Format("ScenarioFramework Condition: Issue with Getter detected for condition %1.", this), LogLevel.ERROR);
28 return false;
29 }
30
31 array<IEntity> entities = entityArrayWrapper.GetValue();
32
33 if (entities.IsEmpty())
34 {
35 Print(string.Format("ScenarioFramework Condition: Array Getter for %1 has no elements to work with.", this), LogLevel.ERROR);
36 return false;
37 }
38
39 foreach (IEntity ent : entities)
40 {
42 return false;
43 }
44
45 return true;
46 }
47
48 IEntity WrappedEntity = entityWrapper.GetValue();
49 if (!WrappedEntity)
50 {
51 Print(string.Format("ScenarioFramework Condition: Entity not found for condition %1.", this), LogLevel.ERROR);
52 return false;
53 }
54
55 return EvaluateEntityDamageState(WrappedEntity);
56
57 }
58
59 //------------------------------------------------------------------------------------------------
61 {
62 SCR_DamageManagerComponent damageManager = SCR_DamageManagerComponent.GetDamageManager(ent);
63 if (damageManager)
64 return damageManager.GetState() == m_eDamageState;
65 else
66 return true;
67 }
68}
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
SCR_FieldOfViewSettings Attribute
EDamageState