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_BaseEffectManagerComponent.c
Go to the documentation of this file.
1
//class SCR_BaseEffectManagerComponentClass : MotorExhaustEffectComponentClass
2
class
SCR_BaseEffectManagerComponentClass
:
ScriptComponentClass
3
{
4
};
5
6
//------------------------------------------------------------------------------------------------
7
//TODO: Get rid of MotorExhaustEffectComponent typename
8
//this class must be independent on vehicles
9
//the base class is meant to work with any type of object
10
//class SCR_BaseEffectManagerComponent : MotorExhaustEffectComponent
11
class
SCR_BaseEffectManagerComponent
:
ScriptComponent
12
{
13
[
Attribute
()]
14
protected
ref array<ref SCR_EffectModule>
m_aEffectModules
;
//array of all effect modules
15
protected
ref array<ref SCR_EffectModule>
m_aEffectModulesActive
= {};
//array of all ACTIVATED effect modules
16
protected
IEntity
m_pOwner
;
//the entity which is owner of this component
17
protected
bool
m_bInitiated
=
false
;
18
protected
const
bool
ON_PHYSIC_ONLY
=
false
;
19
protected
const
bool
ON_FRAME
=
true
;
20
21
//------------------------------------------------------------------------------------------------
22
//USER METHODS
23
//------------------------------------------------------------------------------------------------
24
25
//------------------------------------------------------------------------------------------------
26
protected
void
DeactivateModule
(
SCR_EffectModule
pModule)
27
{
28
m_aEffectModulesActive
.RemoveItem(pModule);
29
}
30
31
//------------------------------------------------------------------------------------------------
32
protected
void
ActivateModule
(
SCR_EffectModule
pModule)
33
{
34
if
(
m_aEffectModulesActive
.Find(pModule) == -1)
35
{
36
pModule.
Init
(
this
);
37
m_aEffectModulesActive
.Insert(pModule);
38
}
39
}
40
41
//------------------------------------------------------------------------------------------------
43
protected
void
ActivateAllModules
(
bool
bPhysics)
44
{
45
foreach
(
SCR_EffectModule
pModule :
m_aEffectModules
)
46
{
47
if
(!pModule)
48
continue
;
49
if
(pModule.GetTickOnFrame() == bPhysics)
50
ActivateModule
(pModule);
51
}
52
}
53
54
//------------------------------------------------------------------------------------------------
56
protected
void
DeactivateAllModules
(
bool
bPhysics)
57
{
58
for
(
int
i = 0; i <
m_aEffectModulesActive
.Count(); i++)
59
{
60
if
(!
m_aEffectModulesActive
[i])
61
continue
;
62
if
(
m_aEffectModulesActive
[i].GetTickOnFrame() == bPhysics)
63
DeactivateModule
(
m_aEffectModulesActive
[i]);
64
}
65
}
66
67
//------------------------------------------------------------------------------------------------
68
protected
void
InitModules
(
bool
bTickOnFrame =
false
)
69
{
70
foreach
(
SCR_EffectModule
pModule :
m_aEffectModules
)
71
{
72
if
(!pModule)
73
continue
;
74
if
(
m_aEffectModulesActive
.Find(pModule) != -1)
75
continue
;
//this module is already activated
76
if
(pModule.GetTickOnFrame() == bTickOnFrame)
77
{
78
pModule.Init(
this
);
79
ActivateModule
(pModule);
//add it to the array of active modules
80
}
81
}
82
}
83
84
//------------------------------------------------------------------------------------------------
85
//STANDARD METHODS
86
//------------------------------------------------------------------------------------------------
87
#ifdef WORKBENCH
88
//------------------------------------------------------------------------------------------------------------
89
override
int
_WB_GetAfterWorldUpdateSpecs
(
IEntity
owner,
IEntitySource
src)
90
{
91
return
EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
92
}
93
94
//------------------------------------------------------------------------------------------------------------
95
override
void
_WB_AfterWorldUpdate
(
IEntity
owner,
float
timeSlice)
96
{
97
foreach
(SCR_EffectModule pModule :
m_aEffectModules
)
98
{
99
if
(!pModule)
100
continue
;
101
pModule.WB_Update(owner, timeSlice);
102
}
103
}
104
#endif
105
106
//------------------------------------------------------------------------------------------------
107
void
UpdateModules
(
float
timeSlice)
108
{
109
foreach
(
SCR_EffectModule
pModule :
m_aEffectModulesActive
)
110
{
111
if
(!pModule)
112
continue
;
113
pModule.Update(
m_pOwner
, timeSlice);
114
}
115
}
116
117
//------------------------------------------------------------------------------------------------
118
override
void
EOnInit
(
IEntity
owner)
119
{
120
ActivateAllModules
(
ON_FRAME
);
121
}
122
123
override
void
EOnPhysicsActive
(
IEntity
owner,
bool
activeState)
124
{
125
if
(
System
.IsConsoleApp())
//don't run it on DS
126
return
;
127
128
if
(activeState)
129
{
130
m_pOwner
= owner;
131
ActivateAllModules
(
ON_PHYSIC_ONLY
);
132
133
}
134
else
135
{
136
DeactivateAllModules
(
ON_PHYSIC_ONLY
);
137
}
138
}
139
140
override
void
EOnDeactivate
(
IEntity
owner)
141
{
142
super.EOnDeactivate(owner);
143
144
DisconnectFromEffectManagerSystem();
145
}
146
147
override
void
EOnActivate
(
IEntity
owner)
148
{
149
super.EOnActivate(owner);
150
151
ConnectToEffectManagerSystem();
152
}
153
154
//------------------------------------------------------------------------------------------------
155
override
void
OnPostInit
(
IEntity
owner)
156
{
157
super.OnPostInit(owner);
158
159
m_pOwner
= owner;
160
161
if
(
System
.IsConsoleApp())
//don't run it on DS
162
return
;
163
164
SetEventMask
(owner,
EntityEvent
.INIT |
EntityEvent
.PHYSICSACTIVE);
165
ConnectToEffectManagerSystem();
166
}
167
168
override
void
OnDelete
(
IEntity
owner)
169
{
170
DisconnectFromEffectManagerSystem();
171
172
super.OnDelete(owner);
173
}
174
175
private
void
ConnectToEffectManagerSystem()
176
{
177
World
world =
m_pOwner
.
GetWorld
();
178
EffectManagerSystem
updateSystem =
EffectManagerSystem
.Cast(world.FindSystem(
EffectManagerSystem
));
179
if
(!updateSystem)
180
return
;
181
182
updateSystem.
Register
(
this
);
183
}
184
185
private
void
DisconnectFromEffectManagerSystem()
186
{
187
World world =
m_pOwner
.GetWorld();
188
EffectManagerSystem updateSystem = EffectManagerSystem.Cast(world.FindSystem(EffectManagerSystem));
189
if
(!updateSystem)
190
return
;
191
192
updateSystem.
Unregister
(
this
);
193
}
194
195
#ifdef WORKBENCH
196
//------------------------------------------------------------------------------------------------
197
override
void
_WB_OnInit
(
IEntity
owner, inout vector mat[4], IEntitySource src)
198
{
199
foreach
(SCR_EffectModule pModule :
m_aEffectModules
)
200
{
201
if
(!pModule)
202
continue
;
203
pModule.WB_OnInit(owner, mat, src);
204
}
205
}
206
#endif
207
};
208
209
//------------------------------------------------------------------------------------------------
210
class
SCR_HelicopterEffectManagerComponentClass
:
SCR_BaseEffectManagerComponentClass
211
{
212
};
213
214
//------------------------------------------------------------------------------------------------
215
//Helicopter specific effect class
216
class
SCR_HelicopterEffectManagerComponent
:
SCR_BaseEffectManagerComponent
217
{
218
//------------------------------------------------------------------------------------------------
219
SCR_HelicopterControllerComponent GetHelicopterController()
220
{
221
if
(!
m_pOwner
)
222
return
null;
//we don't have owner
223
return
SCR_HelicopterControllerComponent.Cast(
m_pOwner
.FindComponent(SCR_HelicopterControllerComponent));
224
}
225
226
//------------------------------------------------------------------------------------------------
227
override
void
EOnInit(
IEntity
owner)
228
{
229
super.
EOnInit
(owner);
230
}
231
};
232
233
234
235
236
237
238
IEntity
enum EVehicleType IEntity
EffectManagerSystem
Definition
EffectManagerSystem.c:2
EffectManagerSystem::Register
void Register(SCR_BaseEffectManagerComponent component)
Definition
EffectManagerSystem.c:43
EffectManagerSystem::Unregister
void Unregister(SCR_BaseEffectManagerComponent component)
Definition
EffectManagerSystem.c:56
GenericComponent::_WB_GetAfterWorldUpdateSpecs
event int _WB_GetAfterWorldUpdateSpecs(IEntity owner, IEntitySource src)
Called after _WB_OnInit or also later when editor needs to know whether _WB_AfterWorldUpdate needs to...
GenericComponent::SetEventMask
proto external int SetEventMask(notnull IEntity owner, int mask)
GenericComponent::_WB_OnInit
event void _WB_OnInit(IEntity owner, inout vector mat[4], IEntitySource src)
Called always after entity creation. It's purpose is to prepare entity for editing....
GenericComponent::_WB_AfterWorldUpdate
event void _WB_AfterWorldUpdate(IEntity owner, float timeSlice)
Called after updating world in Workbench. The entity must be selected. You can use editor API here an...
IEntity
Definition
IEntity.c:13
IEntity::GetWorld
proto external BaseWorld GetWorld()
IEntitySource
Definition
IEntitySource.c:13
SCR_BaseEffectManagerComponentClass
Definition
SCR_BaseEffectManagerComponent.c:3
SCR_BaseEffectManagerComponent
Definition
SCR_BaseEffectManagerComponent.c:12
SCR_BaseEffectManagerComponent::ActivateModule
void ActivateModule(SCR_EffectModule pModule)
Definition
SCR_BaseEffectManagerComponent.c:32
SCR_BaseEffectManagerComponent::m_aEffectModules
ref array< ref SCR_EffectModule > m_aEffectModules
Definition
SCR_BaseEffectManagerComponent.c:14
SCR_BaseEffectManagerComponent::ON_PHYSIC_ONLY
const bool ON_PHYSIC_ONLY
Definition
SCR_BaseEffectManagerComponent.c:18
SCR_BaseEffectManagerComponent::UpdateModules
void UpdateModules(float timeSlice)
Definition
SCR_BaseEffectManagerComponent.c:107
SCR_BaseEffectManagerComponent::m_bInitiated
bool m_bInitiated
Definition
SCR_BaseEffectManagerComponent.c:17
SCR_BaseEffectManagerComponent::OnDelete
override void OnDelete(IEntity owner)
Definition
SCR_BaseEffectManagerComponent.c:168
SCR_BaseEffectManagerComponent::m_aEffectModulesActive
ref array< ref SCR_EffectModule > m_aEffectModulesActive
Definition
SCR_BaseEffectManagerComponent.c:15
SCR_BaseEffectManagerComponent::OnPostInit
override void OnPostInit(IEntity owner)
Definition
SCR_BaseEffectManagerComponent.c:155
SCR_BaseEffectManagerComponent::ActivateAllModules
void ActivateAllModules(bool bPhysics)
Activate all modules which should be activated. Parameter decides if it should be activated on physic...
Definition
SCR_BaseEffectManagerComponent.c:43
SCR_BaseEffectManagerComponent::EOnPhysicsActive
override void EOnPhysicsActive(IEntity owner, bool activeState)
Definition
SCR_BaseEffectManagerComponent.c:123
SCR_BaseEffectManagerComponent::EOnInit
override void EOnInit(IEntity owner)
Definition
SCR_BaseEffectManagerComponent.c:118
SCR_BaseEffectManagerComponent::EOnActivate
override void EOnActivate(IEntity owner)
Definition
SCR_BaseEffectManagerComponent.c:147
SCR_BaseEffectManagerComponent::ON_FRAME
const bool ON_FRAME
Definition
SCR_BaseEffectManagerComponent.c:19
SCR_BaseEffectManagerComponent::m_pOwner
IEntity m_pOwner
Definition
SCR_BaseEffectManagerComponent.c:16
SCR_BaseEffectManagerComponent::EOnDeactivate
override void EOnDeactivate(IEntity owner)
Definition
SCR_BaseEffectManagerComponent.c:140
SCR_BaseEffectManagerComponent::InitModules
void InitModules(bool bTickOnFrame=false)
Definition
SCR_BaseEffectManagerComponent.c:68
SCR_BaseEffectManagerComponent::DeactivateModule
void DeactivateModule(SCR_EffectModule pModule)
Definition
SCR_BaseEffectManagerComponent.c:26
SCR_BaseEffectManagerComponent::DeactivateAllModules
void DeactivateAllModules(bool bPhysics)
Deactivate all modules which should be deactivated. Parameter decides if it should be activated on ph...
Definition
SCR_BaseEffectManagerComponent.c:56
SCR_EffectModule
Definition
SCR_EffectModule.c:5
SCR_EffectModule::Init
void Init(SCR_BaseEffectManagerComponent manager)
Definition
SCR_EffectModule.c:128
SCR_HelicopterEffectManagerComponentClass
Definition
SCR_BaseEffectManagerComponent.c:211
SCR_HelicopterEffectManagerComponent
Definition
SCR_BaseEffectManagerComponent.c:217
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
System
Definition
System.c:13
World
Definition
World.c:16
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityEvent
EntityEvent
Various entity events.
Definition
EntityEvent.c:14
scripts
Game
Vehicle
SCR_BaseEffectManagerComponent.c
Generated by
1.17.0