Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
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
g_Game
.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
g_Game
.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
}
AmmoEffects
Static data holder for certain ammo config values.
Definition
ammoeffects.c:6
AmmoEffects::PlayAmmoEffect
static bool PlayAmmoEffect(string ammoType, vector pos)
Attempt to play the ammo effect at pos if found, returns true on success.
Definition
ammoeffects.c:93
AmmoEffects::Init
static void Init()
Initialize the containers: this is done this way, to have these not exist on server.
Definition
ammoeffects.c:121
AmmoEffects::GetAmmoEffectTypename
static GetAmmoEffectTypename(string ammoType)
Get the typename for the effect for this ammoType.
Definition
ammoeffects.c:68
AmmoEffects::Cleanup
static void Cleanup()
Clean up the data.
Definition
ammoeffects.c:128
AmmoEffects::m_AmmoEffects
static ref map< string, typename > m_AmmoEffects
Key: Ammo class name; Data: ParticleList ID.
Definition
ammoeffects.c:11
AmmoEffects::PlayAmmoParticle
static bool PlayAmmoParticle(string ammoType, vector pos)
Attempt to play the ammo particle at pos if found, returns true on success.
Definition
ammoeffects.c:46
AmmoEffects::m_AmmoParticles
static ref map< string, int > m_AmmoParticles
Key: Ammo class name; Data: ParticleList ID.
Definition
ammoeffects.c:8
AmmoEffects::GetAmmoParticleID
static int GetAmmoParticleID(string ammoType)
Get the ParticleList ID for the particle for this ammoType.
Definition
ammoeffects.c:21
ParticleList
Definition
particlelist.c:12
ParticleList::IsValidId
static bool IsValidId(int id)
Purely checks for an invalid number, does NOT mean it is actually registered.
Definition
particlelist.c:476
ParticleList::GetParticleIDByName
static int GetParticleIDByName(string name)
Returns particle's ID based on the filename (without .ptc suffix).
Definition
particlelist.c:506
SEffectManager
Manager class for managing Effect (EffectParticle, EffectSound).
Definition
effectmanager.c:6
SEffectManager::PlayInWorld
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
Definition
effectmanager.c:47
map
Definition
cachedequipmentstorage.c:4
vector
Definition
enconvert.c:119
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Effect
void Effect()
ctor
Definition
effect.c:72
string::ToType
proto native ToType()
Returns internal type representation.
ParticleManager
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor).
Definition
particlemanager.c:88
Games
Dayz
scripts
3_game
ammoeffects.c
Generated by
1.17.0