Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_HitZoneInfo.c
Go to the documentation of this file.
1
//#define SHOW_DMG_INDICATORS_WARNING
2
//#define SHOW_DMG_INDICATORS_ERROR
3
4
class
SCR_HitZoneInfo
:
SCR_BaseVehicleInfo
5
{
6
[
Attribute
(
""
, uiwidget:
UIWidgets
.Auto)]
7
protected
ref array<string>
m_aHitZoneNames
;
8
9
protected
ref array<HitZone>
m_aHitZones
;
10
11
//------------------------------------------------------------------------------------------------
13
override
EVehicleInfoState
GetState
()
14
{
15
#ifdef SHOW_DMG_INDICATORS_ERROR
16
return
EVehicleInfoState
.ERROR;
17
#endif
18
19
#ifdef SHOW_DMG_INDICATORS_WARNING
20
return
EVehicleInfoState
.WARNING;
21
#endif
22
23
if
(!
m_aHitZones
)
24
return
EVehicleInfoState
.DISABLED;
25
26
m_bIsBlinking
=
false
;
27
28
EDamageState
damageState;
29
EVehicleInfoState
state =
EVehicleInfoState
.DISABLED;
30
SCR_WheelHitZone wheelHitZone;
31
foreach
(
HitZone
hitZone :
m_aHitZones
)
32
{
33
if
(!hitZone)
34
continue
;
35
36
// Ignore spare wheels
37
wheelHitZone = SCR_WheelHitZone.Cast(hitZone);
38
if
(wheelHitZone && wheelHitZone.GetWheelIndex() < 0)
39
continue
;
40
41
// On fire
42
if
(hitZone.GetDamageOverTime(
EDamageType
.FIRE) > 0)
43
{
44
m_bIsBlinking
=
true
;
45
return
EVehicleInfoState
.ERROR;
46
}
47
48
// Destroyed or damaged
49
damageState = hitZone.GetDamageState();
50
if
(damageState >
EDamageState
.DESTROYED)
51
state =
EVehicleInfoState
.WARNING;
52
else
if
(damageState ==
EDamageState
.DESTROYED)
53
return
EVehicleInfoState
.ERROR;
54
}
55
56
return
state;
57
}
58
59
//------------------------------------------------------------------------------------------------
60
override
bool
DisplayStartDrawInit
(
IEntity
owner)
61
{
62
DamageManagerComponent
damageManager =
DamageManagerComponent
.Cast(owner.
FindComponent
(
DamageManagerComponent
));
63
if
(!damageManager)
64
return
false
;
65
66
m_aHitZones
= {};
67
68
// Just get default hitzone if none are provided
69
if
(
m_aHitZoneNames
.IsEmpty())
70
{
71
HitZone
hitZone = damageManager.GetDefaultHitZone();
72
m_aHitZones
= {hitZone};
73
}
74
else
75
{
76
// Get lowercase hitzone names
77
array<string> hitzoneNames = {};
78
foreach
(
string
name :
m_aHitZoneNames
)
79
{
80
name.ToLower();
81
hitzoneNames.Insert(name);
82
}
83
84
// Find all matching hitzones
85
m_aHitZones
= {};
86
array<HitZone> hitZones = {};
87
damageManager.GetAllHitZonesInHierarchy(hitZones);
88
string
name;
89
foreach
(
HitZone
hitZone : hitZones)
90
{
91
name = hitZone.GetName();
92
name.ToLower();
93
if
(hitzoneNames.Contains(name))
94
m_aHitZones
.Insert(hitZone);
95
}
96
}
97
98
if
(
m_aHitZones
.IsEmpty())
99
m_aHitZones
= null;
100
101
// Terminate if there are no hitzones
102
if
(!
m_aHitZones
)
103
return
false
;
104
105
return
super.DisplayStartDrawInit(owner);
106
}
107
108
//------------------------------------------------------------------------------------------------
109
override
void
DisplayStopDraw
(
IEntity
owner)
110
{
111
m_aHitZones
= null;
112
}
113
};
EVehicleInfoState
EVehicleInfoState
UI indicator state, controlling colors and opacity.
Definition
SCR_BaseVehicleInfo.c:6
DamageManagerComponent
Definition
DamageManagerComponent.c:13
HitZone
Definition
HitZone.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
SCR_BaseVehicleInfo
Base class for all vehicle UI state and damage indicators.
Definition
SCR_BaseVehicleInfo.c:29
SCR_BaseVehicleInfo::m_bIsBlinking
bool m_bIsBlinking
Definition
SCR_BaseVehicleInfo.c:50
SCR_HitZoneInfo
Definition
SCR_HitZoneInfo.c:5
SCR_HitZoneInfo::DisplayStopDraw
override void DisplayStopDraw(IEntity owner)
Definition
SCR_HitZoneInfo.c:109
SCR_HitZoneInfo::m_aHitZones
ref array< HitZone > m_aHitZones
Definition
SCR_HitZoneInfo.c:9
SCR_HitZoneInfo::DisplayStartDrawInit
override bool DisplayStartDrawInit(IEntity owner)
Definition
SCR_HitZoneInfo.c:60
SCR_HitZoneInfo::GetState
override EVehicleInfoState GetState()
Can be overridden to get state of actual system or linked to an event.
Definition
SCR_HitZoneInfo.c:13
SCR_HitZoneInfo::m_aHitZoneNames
ref array< string > m_aHitZoneNames
Definition
SCR_HitZoneInfo.c:7
UIWidgets
Definition
attributes.c:40
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EDamageType
EDamageType
Definition
EDamageType.c:13
EDamageState
EDamageState
Definition
EDamageState.c:13
scripts
Game
UI
HUD
VehicleInfo
SCR_HitZoneInfo.c
Generated by
1.17.0