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_AnimatedBeltSystem.c
Go to the documentation of this file.
1
/*
2
System to move any ammobelt UV's that are currently being fired
3
*/
4
5
class
SCR_AnimatedBeltSystem
:
GameSystem
6
{
7
override
static
void
InitInfo(
WorldSystemInfo
outInfo)
8
{
9
outInfo
10
.SetAbstract(
false
)
11
.AddPoint(
ESystemPoint
.Frame);
12
}
13
14
protected
ref array<SCR_AnimatedBeltComponent>
m_aComponents
= {};
15
protected
ref array<SCR_AnimatedBeltComponent>
m_aComponentsToAdd
= {};
16
protected
ref array<SCR_AnimatedBeltComponent>
m_aComponentsToDel
= {};
17
private
bool
m_bSimulationRunning;
18
19
//------------------------------------------------------------------------------------------------
20
protected
override
void
OnInit
()
21
{
22
Enable(
false
);
23
}
24
25
//------------------------------------------------------------------------------------------------
26
override
void
OnUpdatePoint
(
WorldUpdatePointArgs
args)
27
{
28
float
timeSlice = args.GetTimeSliceSeconds();
29
bool
nullValuePresent;
30
31
m_bSimulationRunning =
true
;
32
foreach
(SCR_AnimatedBeltComponent comp :
m_aComponents
)
33
{
34
if
(!comp)
35
{
36
nullValuePresent =
true
;
37
continue
;
38
}
39
40
comp.Update(timeSlice);
41
}
42
m_bSimulationRunning =
false
;
43
44
// Remove any null referenes
45
if
(nullValuePresent)
46
{
47
for
(
int
i =
m_aComponents
.Count() - 1; i >= 0; i--)
48
{
49
if
(!
m_aComponents
[i])
50
m_aComponents
.Remove(i);
51
}
52
}
53
54
// Simulation stopped running, time to update m_aComponents if necessary
55
foreach
(SCR_AnimatedBeltComponent comp :
m_aComponentsToAdd
)
56
{
57
if
(comp)
58
RegisterInternal(comp);
59
}
60
foreach
(SCR_AnimatedBeltComponent comp :
m_aComponentsToDel
)
61
{
62
if
(comp)
63
UnregisterInternal(comp);
64
}
65
m_aComponentsToAdd
.Clear();
66
m_aComponentsToDel
.Clear();
67
}
68
69
//------------------------------------------------------------------------------------------------
70
private
void
RegisterInternal(notnull SCR_AnimatedBeltComponent component)
71
{
72
int
index
= component.GetBeltSystemIdx();
73
if
(
index
>= 0)
74
return
;
75
76
index
=
m_aComponents
.Insert(component);
77
component.SetBeltSystemIdx(
index
);
78
79
if
(!
IsEnabled
())
80
Enable
(
true
);
81
}
82
83
//------------------------------------------------------------------------------------------------
84
void
Register(notnull SCR_AnimatedBeltComponent component)
85
{
86
if
(m_bSimulationRunning)
87
{
88
m_aComponentsToAdd
.Insert(component);
89
return
;
90
}
91
92
RegisterInternal(component);
93
}
94
95
//------------------------------------------------------------------------------------------------
96
private
void
UnregisterInternal(notnull SCR_AnimatedBeltComponent component)
97
{
98
int
index
= component.GetBeltSystemIdx();
99
if
(
index
< 0)
100
return
;
101
102
// Assign the last item in the array out current system index if possible
103
if
(!
m_aComponents
.IsEmpty() &&
m_aComponents
[
m_aComponents
.Count()-1] != component)
104
m_aComponents
[
m_aComponents
.Count()-1].SetBeltSystemIdx(
index
);
105
// Swap indices with the last item in the array
106
m_aComponents
.Remove(
index
);
107
// Invalidate current component's index
108
component.SetBeltSystemIdx(-1);
109
110
if
(
m_aComponents
.IsEmpty())
111
Enable(
false
);
112
}
113
114
//------------------------------------------------------------------------------------------------
115
void
Unregister(notnull SCR_AnimatedBeltComponent component)
116
{
117
if
(m_bSimulationRunning)
118
{
119
m_aComponentsToDel
.Insert(component);
120
return
;
121
}
122
123
UnregisterInternal(component);
124
}
125
}
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
Enable
void Enable(bool enable)
Definition
SCR_TabViewComponent.c:820
GameSystem
Definition
GameSystem.c:16
SCR_AnimatedBeltSystem
Definition
SCR_AnimatedBeltSystem.c:6
SCR_AnimatedBeltSystem::OnInit
override void OnInit()
Definition
SCR_AnimatedBeltSystem.c:20
SCR_AnimatedBeltSystem::m_aComponentsToAdd
ref array< SCR_AnimatedBeltComponent > m_aComponentsToAdd
Definition
SCR_AnimatedBeltSystem.c:15
SCR_AnimatedBeltSystem::m_aComponents
ref array< SCR_AnimatedBeltComponent > m_aComponents
Definition
SCR_AnimatedBeltSystem.c:14
SCR_AnimatedBeltSystem::m_aComponentsToDel
ref array< SCR_AnimatedBeltComponent > m_aComponentsToDel
Definition
SCR_AnimatedBeltSystem.c:16
SCR_AnimatedBeltSystem::OnUpdatePoint
override void OnUpdatePoint(WorldUpdatePointArgs args)
Definition
SCR_AnimatedBeltSystem.c:26
WorldSystemInfo
Structure holding world system meta-information required by the engine.
Definition
WorldSystemInfo.c:14
WorldUpdatePointArgs
Structure holding extra data of WorldSystem update point.
Definition
WorldUpdatePointArgs.c:14
ESystemPoint
WorldSystemPoint ESystemPoint
Definition
gameLib.c:7
IsEnabled
int IsEnabled()
Returns true if the light is enabled.
Definition
SCR_BaseManualCameraComponent.c:239
scripts
Game
Systems
SCR_AnimatedBeltSystem.c
Generated by
1.17.0