Dayz Explorer
1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
ammoeffects.c
Go to the documentation of this file.
1
5
class
AmmoEffects
6
{
8
static
ref
map<string, int>
m_AmmoParticles;
9
11
static
ref
map<string, typename>
m_AmmoEffects;
12
13
14
19
21
static
int
GetAmmoParticleID(
string
ammoType)
22
{
23
int
particleID;
24
25
// Search for it in the static map
26
if
( !m_AmmoParticles.Find(ammoType, particleID) )
27
{
28
// Load it in when we can't find it
29
string
particleFileName;
30
GetGame
().ConfigGetText(
string
.Format(
"cfgAmmo %1 particle"
, ammoType), particleFileName);
31
32
// If we found a valid entry, try looking for it in ParticleList
33
if
( particleFileName !=
""
)
34
{
35
particleID =
ParticleList
.GetParticleIDByName(particleFileName);
36
}
37
38
// Store it for next search
39
m_AmmoParticles.Insert(ammoType, particleID);
40
}
41
42
return
particleID;
43
}
44
46
static
bool
PlayAmmoParticle(
string
ammoType,
vector
pos)
47
{
48
int
particleID = GetAmmoParticleID(ammoType);
49
50
if
(
ParticleList
.IsValidId(particleID))
51
{
52
return
ParticleManager
.GetInstance().PlayInWorld(particleID, pos) !=
null
;
53
}
54
55
return
false
;
56
}
57
59
60
61
66
68
static
typename
GetAmmoEffectTypename(
string
ammoType)
69
{
70
typename
typeName;
71
72
// Search for it in the static map
73
if
( !m_AmmoEffects.Find(ammoType, typeName) )
74
{
75
// Load it in when we can't find it
76
string
effectName;
77
GetGame
().ConfigGetText(
string
.Format(
"cfgAmmo %1 effect"
, ammoType), effectName);
78
79
// If we found a valid entry, try looking for it in ParticleList
80
if
( effectName !=
""
)
81
{
82
typeName = effectName.ToType();
83
}
84
85
// Store it for next search
86
m_AmmoEffects.Insert(ammoType, typeName);
87
}
88
89
return
typeName;
90
}
91
93
static
bool
PlayAmmoEffect(
string
ammoType,
vector
pos)
94
{
95
typename
typeName = GetAmmoEffectTypename(ammoType);
96
97
if
( typeName )
98
{
99
Effect
eff =
Effect
.Cast(typeName.Spawn());
100
101
if
( eff )
102
{
103
eff.SetAutodestroy(
true
);
104
return
SEffectManager
.PlayInWorld( eff, pos );
105
}
106
}
107
108
return
false
;
109
}
110
112
113
114
119
121
static
void
Init()
122
{
123
m_AmmoParticles =
new
map<string, int>
();
124
m_AmmoEffects =
new
map<string, typename>
();
125
}
126
128
static
void
Cleanup()
129
{
130
/* These ain't containing no refs, so whatever
131
m_AmmoParticles.Clear();
132
m_AmmoEffects.Clear();
133
*/
134
}
135
137
}
GetGame
proto native CGame GetGame()
ParticleList
Definition:
particlelist.c:11
map
map
Definition:
controlsxboxnew.c:3
vector
Definition:
enconvert.c:105
Effect
void Effect()
ctor
Definition:
effect.c:70
AmmoEffects
Static data holder for certain ammo config values.
Definition:
ammoeffects.c:5
ParticleManager
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition:
particlemanager.c:84
SEffectManager
Manager class for managing Effect (EffectParticle, EffectSound)
Definition:
effectmanager.c:5
DAYZ
scripts_v1.24.157551
scripts
game
ammoeffects.c
Generated by
1.8.17