Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkMedicalConditionHealth.c
Go to the documentation of this file.
1[BaseContainerProps(description: "Similar to SCR_ScenarioFrameworEntitykDamageStateCondition but with propulated selections for character and character hit zone groups.")]
3{
4 [Attribute(desc: "Minimum health of hit zone or group to satisfy condition. (Inclusive)", uiwidget: UIWidgets.Slider, defvalue: "0.0", params: "0 1 0.001")]
5 float m_fHealthMinimum;
6
7 [Attribute(desc: "Maximum health of hit zone or group to satisfy condition. (Inclusive)", uiwidget: UIWidgets.Slider, defvalue: "1.0", params: "0 1 0.001")]
8 float m_fHealthMaximum;
9
10 [Attribute(desc: "If true, uses the health hitpoint.", defvalue: "1")]
11 bool m_bUseDefaultHealth;
12
13 [Attribute(desc: "Is satisfied by health on any specified hit zone.", uiwidget: UIWidgets.EditComboBox, defvalue: "Head", enums: SCR_AttributesHelper.ParamFromTitles("Health;Blood;Resilience;Head;Chest;Abdomen;Hips;RArm;LArm;RForearm;LForearm;RHand;LHand;RThigh;LThigh;RCalf;LCalf;RFoot;LFoot;Neck;"))]
14 ref array<string> m_aHitZoneNames;
15
16 [Attribute(desc: "Is satisfied by health in any specified hit zone groups.", uiwidget: UIWidgets.ComboBox, defvalue: ECharacterHitZoneGroup.HEAD.ToString(), enums: ParamEnumArray.FromEnum(ECharacterHitZoneGroup))]
17 ref array<ECharacterHitZoneGroup> m_aHitZonesGroups;
18
19 protected static const float S_F_HEALTH_EPSILON = 0.001;
20
21 //------------------------------------------------------------------------------------------------
22 override bool Init(notnull SCR_ChimeraCharacter character, notnull SCR_CharacterDamageManagerComponent damageManager)
23 {
24 super.Init(character, damageManager);
25
26 if (m_fHealthMinimum > m_fHealthMaximum)
27 {
28 PrintFormat("[SCR_ScenarioFrameworkMedicalConditionHealth.Init] defined m_fHealthMinimum %1 is greater than m_fHealthMaximum %2", m_fHealthMinimum, m_fHealthMaximum, LogLevel.WARNING);
29 return false;
30 }
31
32 if (m_bUseDefaultHealth)
33 return EvaluateHealthScaled(damageManager.GetHealthScaled());
34
35 foreach (string hitZoneName : m_aHitZoneNames)
36 {
37 HitZone hitZone = damageManager.GetHitZoneByName(hitZoneName);
38 if (EvaluateHealthScaled(hitZone.GetHealthScaled()))
39 return true;
40 }
41
42 foreach (ECharacterHitZoneGroup hitZoneGroup : m_aHitZonesGroups)
43 {
44 float healthScaled = damageManager.GetGroupHealthScaled(hitZoneGroup);
45 if (EvaluateHealthScaled(healthScaled))
46 return true;
47 }
48
49 return false;
50 }
51
52 //------------------------------------------------------------------------------------------------
56 protected bool EvaluateHealthScaled(float health)
57 {
58 return
59 (health >= m_fHealthMinimum || float.AlmostEqual(health, m_fHealthMinimum, S_F_HEALTH_EPSILON)) &&
60 (health <= m_fHealthMaximum || float.AlmostEqual(health, m_fHealthMaximum, S_F_HEALTH_EPSILON));
61 }
62}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
static ParamEnumArray ParamFromTitles(string titles)
override bool Init(notnull SCR_ChimeraCharacter character, notnull SCR_CharacterDamageManagerComponent damageManager)
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