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_ParticleContactComponent.c
Go to the documentation of this file.
1
class
SCR_ParticleContactComponentClass
:
ScriptComponentClass
2
{
3
[
Attribute
(
category
:
"Sound"
)]
4
ref SCR_AudioSourceConfiguration m_AudioSourceConfiguration;
5
6
[
Attribute
(
"true"
,
desc
:
"Set surface signal"
,
category
:
"Sound"
)]
7
bool
m_bSurfaceSignal;
8
9
[
Attribute
(
"false"
,
desc
:
"If to play particle effect"
,
category
:
"VFX"
)]
10
bool
m_bPlayParticle;
11
12
[
Attribute
(
""
,
UIWidgets
.ResourcePickerThumbnail,
desc
:
"Particle effect"
,
params
:
"ptc"
,
category
:
"VFX"
)]
13
ResourceName
m_Particle;
14
15
[
Attribute
(
"0"
, uiwidget:
UIWidgets
.ComboBox,
"Desired type of Game Material effect"
,
""
, ParamEnumArray.FromEnum(EParticleEffectInfoType),
category
:
"VFX"
)]
16
int
m_iGameMaterialEffect;
17
18
[
Attribute
(
"0"
,
desc
:
"Index of Material Effect type"
,
category
:
"VFX"
)]
19
int
m_iEffectIndex;
20
21
[
Attribute
(
"true"
,
desc
:
"Disable OnContact after the first contact"
)]
22
bool
m_bFirstContactOnly;
23
24
[
Attribute
(
"false"
,
desc
:
"Particle oriented to surface"
,
category
:
"VFX"
)]
25
bool
m_bParticleOriented;
26
}
27
28
enum
EParticleEffectInfoType
29
{
30
NONE
= 0,
31
VEHICLE
= 1,
32
BLAST
= 2,
33
}
34
35
class
SCR_ParticleContactComponent :
ScriptComponent
36
{
37
//------------------------------------------------------------------------------------------------
38
private
void
PlaySound
(
IEntity
owner, SCR_ParticleContactComponentClass prefabData, Contact contact)
39
{
40
if
(!prefabData.m_AudioSourceConfiguration || !prefabData.m_AudioSourceConfiguration.IsValid())
41
return
;
42
43
SCR_SoundManagerModule
soundManager =
SCR_SoundManagerModule
.GetInstance(owner.
GetWorld
());
44
if
(!soundManager)
45
return
;
46
47
// Create audio source
48
SCR_AudioSource
audioSource = soundManager.CreateAudioSource(owner, prefabData.m_AudioSourceConfiguration, contact.Position);
49
if
(!audioSource)
50
return
;
51
52
// Set surface signal
53
if
(prefabData.m_bSurfaceSignal)
54
{
55
GameMaterial
material = contact.Material2;
56
if
(material)
57
{
58
audioSource.SetSignalValue(
SCR_AudioSource
.SURFACE_SIGNAL_NAME, material.GetSoundInfo().GetSignalValue());
59
}
60
}
61
62
// Play sound
63
soundManager.PlayAudioSource(audioSource);
64
}
65
66
//------------------------------------------------------------------------------------------------
67
override
void
OnPostInit
(
IEntity
owner)
68
{
69
SCR_ParticleContactComponentClass
prefabData =
SCR_ParticleContactComponentClass
.Cast(
GetComponentData
(owner));
70
if
(!prefabData)
71
return
;
72
73
SetEventMask
(owner,
EntityEvent
.CONTACT);
74
75
#ifdef ENABLE_DIAG
76
DiagMenu
.RegisterBool(
SCR_DebugMenuID
.DEBUGUI_PARTICLES_CONTACT_COMPONENT,
""
,
"Show Particle Contacts"
,
"Particles"
);
77
#endif
78
79
}
80
81
//------------------------------------------------------------------------------------------------
82
override
void
EOnContact
(
IEntity
owner,
IEntity
other,
Contact
contact)
83
{
84
// Get prefab data
85
SCR_ParticleContactComponentClass
prefabData =
SCR_ParticleContactComponentClass
.Cast(
GetComponentData
(owner));
86
if
(!prefabData)
87
{
88
ClearEventMask
(owner,
EntityEvent
.CONTACT);
89
return
;
90
}
91
92
// Play sound
93
PlaySound
(owner, prefabData, contact);
94
95
//Play VFX
96
if
(prefabData.m_bPlayParticle)
97
{
98
99
//Play game material effect
100
if
(prefabData.m_iGameMaterialEffect == 1)
101
{
102
GameMaterial
material = contact.Material2;
103
ParticleEffectInfo
effectInfo = material.GetParticleEffectInfo();
104
105
if
(effectInfo)
106
{
107
prefabData.m_Particle = effectInfo.GetVehicleDustResource(prefabData.m_iEffectIndex);
108
}
109
}
110
else
if
(prefabData.m_iGameMaterialEffect == 2)
111
{
112
GameMaterial
material = contact.Material2;
113
ParticleEffectInfo
effectInfo = material.GetParticleEffectInfo();
114
115
if
(effectInfo)
116
{
117
prefabData.m_Particle = effectInfo.GetBlastResource(prefabData.m_iEffectIndex);
118
}
119
}
120
121
if
(prefabData.m_Particle !=
string
.Empty)
122
{
123
ParticleEffectEntitySpawnParams
spawnParams =
new
ParticleEffectEntitySpawnParams
();
124
spawnParams.UseFrameEvent =
true
;
125
126
if
(prefabData.m_bParticleOriented)
127
Math3D
.AnglesToMatrix(contact.Normal, spawnParams.Transform);
128
129
spawnParams.Transform[3] = contact.Position;
130
ParticleEffectEntity
.SpawnParticleEffect(prefabData.m_Particle, spawnParams);
131
132
#ifdef ENABLE_DIAG
133
if
(
DiagMenu
.GetBool(
SCR_DebugMenuID
.DEBUGUI_PARTICLES_CONTACT_COMPONENT))
134
{
135
DebugTextWorldSpace
.Create(
GetOwner
().GetWorld(), contact.Material2.GetName(),
DebugTextFlags
.CENTER, contact.Position[0], contact.Position[1], contact.Position[2]);
136
}
137
#endif
138
}
139
}
140
141
// Disable OnContact after the first contact
142
if
(prefabData.m_bFirstContactOnly)
143
ClearEventMask
(owner,
EntityEvent
.CONTACT);
144
}
145
}
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition
DebugMenuID.c:4
SCR_AudioSource
void SCR_AudioSource(SCR_AudioSourceConfiguration audioSourceConfiguration, vector mat[4])
Definition
SCR_AudioSource.c:139
GetComponentData
SCR_CharacterSoundComponentClass GetComponentData()
Definition
SCR_CharacterSoundComponent.c:132
PlaySound
void PlaySound(string soundName)
Definition
SCR_DetonatorGadgetComponent.c:292
VEHICLE
@ VEHICLE
Definition
SCR_EArsenalItemType.c:25
BLAST
SCR_ParticleContactComponentClass BLAST
ParticleEffectEntity
void ParticleEffectEntity(IEntitySource src, IEntity parent)
Definition
SCR_RepeatingParticleEffectEntity.c:65
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
IEntity
enum EVehicleType IEntity
Contact
Definition
Contact.c:16
DebugTextWorldSpace
Definition
DebugTextWorldSpace.c:13
DiagMenu
Diagnostic and developer menu system.
Definition
DiagMenu.c:18
GameMaterial
Definition
GameMaterial.c:13
GenericComponent::ClearEventMask
proto external int ClearEventMask(notnull IEntity owner, int mask)
GenericComponent::SetEventMask
proto external int SetEventMask(notnull IEntity owner, int mask)
IEntity
Definition
IEntity.c:13
IEntity::GetWorld
proto external BaseWorld GetWorld()
Math3D
Definition
Math3D.c:13
ParticleEffectEntitySpawnParams
Definition
ParticleEffectEntitySpawnParams.c:13
ParticleEffectInfo
Definition
ParticleEffectInfo.c:13
ResourceName
Definition
ResourceName.c:13
SCR_ParticleContactComponentClass
Definition
SCR_ParticleContactComponent.c:2
SCR_SoundManagerModule
Definition
SCR_SoundManagerModule.c:12
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
ScriptComponent::EOnContact
void EOnContact(IEntity owner, IEntity other, Contact contact)
ScriptComponent::GetOwner
proto external GenericEntity GetOwner()
Get owner entity.
UIWidgets
Definition
attributes.c:40
DebugTextFlags
DebugTextFlags
Definition
DebugTextFlags.c:13
NONE
@ NONE
When Shape is created and not initialized yet.
Definition
ShapeType.c:15
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityEvent
EntityEvent
Various entity events.
Definition
EntityEvent.c:14
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
scripts
Game
Components
SCR_ParticleContactComponent.c
Generated by
1.17.0