Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BloodTooltipDetail.c
Go to the documentation of this file.
3{
5
6 [Attribute("BloodUnconsciousBar", desc: "Image that shows when Character becomes conscious")]
7 protected string m_sUnconsciousBarName;
8
9 [Attribute("BloodUnconsciousBarTop", desc: "Set at the end of the bar")]
10 protected string m_sUnconsciousBarTopName;
11
12 [Attribute("BloodUnconsciousFillRight", desc: "Filler make sure the bar is set the correct size")]
14
15 [Attribute("0.025", desc: "Size of the BarTop")]
16 protected float m_iUnconsciousBarTopSize;
17
18 protected float m_fBloodLevelLoseDeath;
20 protected float m_fBloodLevel;
21
25
26 //------------------------------------------------------------------------------------------------
27 override bool NeedUpdate()
28 {
29 return m_CharacterDamageManager != null;
30 }
31
32 //------------------------------------------------------------------------------------------------
34 {
35 super.UpdateDetail(entity);
36
37 HitZone bloodHitZone = m_CharacterDamageManager.GetBloodHitZone();
38 if (!bloodHitZone)
39 return;
40
41 //~ If character dead set blood 0
42 if (m_CharacterDamageManager.GetState() == EDamageState.DESTROYED)
43 {
44
46 m_UnconsciousBar.SetVisible(false);
47
49 m_UnconsciousBarTop.SetVisible(false);
50
52 m_UnconsciousFillerRight.SetVisible(false);
53
55 return;
56 }
57
58 float bloodLevel = Math.InverseLerp(bloodHitZone.GetDamageStateThreshold(ECharacterBloodState.DESTROYED), 1, bloodHitZone.GetHealthScaled());
59
60 //~ Update blood visual
61 bloodLevel = Math.Clamp(bloodLevel, 0, 1);
62 UpdateBloodBar(bloodLevel, bloodHitZone.GetDamageStateThreshold(ECharacterBloodState.UNCONSCIOUS));
63 SetBarAndPercentageValue(bloodLevel);
64 }
65
66 //------------------------------------------------------------------------------------------------
67 protected void UpdateBloodBar(float bloodLevel, float unconsciousLevel)
68 {
69 if (bloodLevel >= unconsciousLevel)
70 {
71 m_UnconsciousBarTop.SetVisible(true);
72 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(unconsciousLevel - m_iUnconsciousBarTopSize, 0, 1));
73 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(1 - unconsciousLevel, 0, 1));
74 }
75 else
76 {
77 if (bloodLevel >= m_iUnconsciousBarTopSize)
78 {
79 m_UnconsciousBarTop.SetVisible(true);
80 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(bloodLevel - m_iUnconsciousBarTopSize, 0 , 1));
81 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(1 - bloodLevel, 0, 1));
82 }
83 else
84 {
85 m_UnconsciousBarTop.SetVisible(false);
86 LayoutSlot.SetFillWeight(m_UnconsciousBar, Math.Clamp(bloodLevel, 0 , 1));
87 LayoutSlot.SetFillWeight(m_UnconsciousFillerRight, Math.Clamp(1 - bloodLevel, 0, 1));
88 }
89 }
90 }
91
92 //------------------------------------------------------------------------------------------------
93 override void SetBarColor(bool SetConditionColor)
94 {
95 super.SetBarColor(SetConditionColor);
96
98 return;
99
100 //~ Reverse colors of unconciouss amount
101 if (m_bBarIsColored)
102 {
105 }
106 else
107 {
110 }
111 }
112
113 //------------------------------------------------------------------------------------------------
114 override bool InitDetail(SCR_EditableEntityComponent entity, Widget widget)
115 {
116 if (!super.InitDetail(entity, widget))
117 return false;
118
121 return false;
122
123 HitZone bloodHitZone = m_CharacterDamageManager.GetBloodHitZone();
124 if (!bloodHitZone)
125 return false;
126
127 m_UnconsciousBarTop = widget.FindAnyWidget(m_sUnconsciousBarTopName);
128 m_UnconsciousBar = widget.FindAnyWidget(m_sUnconsciousBarName);
130
132 {
133 Print("'SCR_BloodTooltipDetail' is missing UI to display which means it will be hidden!", LogLevel.ERROR);
134 return false;
135 }
136
137 if (m_CharacterDamageManager.GetState() == EDamageState.DESTROYED)
138 return false;
139
140 if (m_CharacterDamageManager.GetState() == EDamageState.DESTROYED)
141 {
142 m_UnconsciousBar.SetVisible(false);
143 m_UnconsciousBarTop.SetVisible(false);
144 m_UnconsciousFillerRight.SetVisible(false);
145 return false;
146 }
147
149
150 UpdateDetail(entity);
151 return true;
152 }
153}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
ECharacterBloodState
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Math.c:13
override void UpdateDetail(SCR_EditableEntityComponent entity)
void UpdateBloodBar(float bloodLevel, float unconsciousLevel)
override bool InitDetail(SCR_EditableEntityComponent entity, Widget widget)
SCR_CharacterDamageManagerComponent m_CharacterDamageManager
override void SetBarColor(bool SetConditionColor)
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