Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SpectateTargetComponent.c
Go to the documentation of this file.
1
[
ComponentEditorProps
(
category
:
"GameScripted/Spectating"
, description:
"Entity that this is attached to becomes selectable by the Spectator Camera."
)]
2
class
SCR_SpectateTargetComponentClass
:
ScriptComponentClass
3
{
4
}
5
6
class
SCR_SpectateTargetComponent :
ScriptComponent
7
{
8
// List of all spectate targets
9
private
static
ref array <SCR_SpectateTargetComponent>
s_aSpectateTargets
= null;
10
11
private
DamageManagerComponent
m_DamageManagerComponent = null;
12
private
IEntity
m_Entity
= null;
13
14
//------------------------------------------------------------------------------------------------
16
IEntity
GetEntity
()
17
{
18
return
m_Entity
;
19
}
20
21
//------------------------------------------------------------------------------------------------
23
bool
IsAlive()
24
{
25
if
(!m_DamageManagerComponent)
26
return
true
;
27
28
return
m_DamageManagerComponent.GetState() !=
EDamageState
.DESTROYED;
29
}
30
31
//------------------------------------------------------------------------------------------------
34
static
SCR_SpectateTargetComponent GetSpectateTarget(
int
index
)
35
{
36
if
(!
s_aSpectateTargets
)
37
return
null;
38
39
int
count =
s_aSpectateTargets
.Count();
40
if
(
index
>= 0 &&
index
< count)
41
{
42
return
s_aSpectateTargets
[
index
];
43
}
44
else
45
return
null;
46
}
47
48
//------------------------------------------------------------------------------------------------
50
static
int
GetSpectateTargetCount()
51
{
52
if
(!
s_aSpectateTargets
)
53
return
0;
54
55
return
s_aSpectateTargets
.Count();
56
}
57
58
//------------------------------------------------------------------------------------------------
59
private
static
void
RegisterTarget(SCR_SpectateTargetComponent spectateTarget)
60
{
61
if
(!
s_aSpectateTargets
)
62
s_aSpectateTargets
=
new
array<SCR_SpectateTargetComponent>();
63
64
if
(
s_aSpectateTargets
)
65
{
66
s_aSpectateTargets
.Insert(spectateTarget);
67
}
68
}
69
70
//------------------------------------------------------------------------------------------------
71
private
static
void
UnregisterTarget(SCR_SpectateTargetComponent spectateTarget)
72
{
73
if
(!
s_aSpectateTargets
)
74
return
;
75
76
int
index
=
s_aSpectateTargets
.Find(spectateTarget);
77
if
(
index
!= -1)
78
{
79
s_aSpectateTargets
.RemoveItem(spectateTarget);
80
81
int
cnt =
s_aSpectateTargets
.Count();
82
if
(cnt - 1 >= 0)
83
s_aSpectateTargets
.Resize(cnt-1);
84
}
85
86
int
count =
s_aSpectateTargets
.Count();
87
if
(count <= 0)
88
{
89
s_aSpectateTargets
.Clear();
90
s_aSpectateTargets
= null;
91
}
92
}
93
94
//------------------------------------------------------------------------------------------------
95
// constructor
99
void
SCR_SpectateTargetComponent(IEntityComponentSource src,
IEntity
ent,
IEntity
parent)
100
{
101
if
(!
GetGame
().GetWorldEntity())
102
return
;
103
104
RegisterTarget(
this
);
105
m_Entity
= ent;
106
GenericEntity genericEntity = GenericEntity.Cast(ent);
107
m_DamageManagerComponent = DamageManagerComponent.Cast(genericEntity.
FindComponent
(DamageManagerComponent));
108
}
109
110
//------------------------------------------------------------------------------------------------
111
// destructor
112
void
~SCR_SpectateTargetComponent()
113
{
114
UnregisterTarget(
this
);
115
}
116
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
m_Entity
enum EAITargetInfoCategory m_Entity
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
s_aSpectateTargets
SCR_SpectateTargetComponentClass s_aSpectateTargets
IEntity
enum EVehicleType IEntity
DamageManagerComponent
Definition
DamageManagerComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
SCR_SpectateTargetComponentClass
Definition
SpectateTargetComponent.c:3
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
GetEntity
IEntity GetEntity()
Definition
SCR_QuickslotBaseContainer.c:34
EDamageState
EDamageState
Definition
EDamageState.c:13
scripts
Game
Components
SpectateTargetComponent.c
Generated by
1.17.0