Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkMedicalCondition.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: "Character must have all of these medical conditions.")]
8 ref array<ref SCR_ScenarioFrameworkMedicalConditionBase> m_aRequiredMedicalConditions;
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_ScenarioFrameworkMedicalCondition.Init] Condition invoked with debug flag (" + __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 (!EvaluateMedicalConditions(ent))
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 EvaluateMedicalConditions(wrappedEntity);
56 }
57
58 //------------------------------------------------------------------------------------------------
59 bool EvaluateMedicalConditions(notnull IEntity ent)
60 {
61 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(ent);
62 if (!character)
63 return true;
64
65 SCR_CharacterDamageManagerComponent damageManager = SCR_CharacterDamageManagerComponent.Cast(character.GetDamageManager());
66 if (!damageManager)
67 return true;
68
69 foreach (SCR_ScenarioFrameworkMedicalConditionBase requiredCondition : m_aRequiredMedicalConditions)
70 {
71 if (!requiredCondition.Init(character, damageManager))
72 return false;
73 }
74 return true;
75 }
76}
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