DayZ 1.24
Loading...
Searching...
No Matches
AmmoEffects.c
Go to the documentation of this file.
1
6{
9
12
13
18
20 static int GetAmmoParticleID(string ammoType)
21 {
22 int particleID;
23
24 // Search for it in the static map
26 {
27 // Load it in when we can't find it
28 string particleFileName;
29 GetGame().ConfigGetText(string.Format("cfgAmmo %1 particle", ammoType), particleFileName);
30
31 // If we found a valid entry, try looking for it in ParticleList
32 if (particleFileName != "")
34
35 // Store it for next search
37 }
38
39 return particleID;
40 }
41
43 static bool PlayAmmoParticle(string ammoType, vector pos)
44 {
46
48 return ParticleManager.GetInstance().PlayInWorld(particleID, pos) != null;
49
50 return false;
51 }
52
54
55
60
62 static typename GetAmmoEffectTypename(string ammoType)
63 {
64 typename typeName;
65
66 // Search for it in the static map
68 {
69 // Load it in when we can't find it
70 string effectName;
71 GetGame().ConfigGetText(string.Format("cfgAmmo %1 effect", ammoType), effectName);
72
73 // If we found a valid entry, try looking for it in ParticleList
74 if (effectName != "")
75 typeName = effectName.ToType();
76
77 // Store it for next search
79 }
80
81 return typeName;
82 }
83
85 static bool PlayAmmoEffect(string ammoType, vector pos)
86 {
88
89 if (typeName)
90 {
91 Effect eff = Effect.Cast(typeName.Spawn());
92
93 if (eff)
94 {
95 eff.SetAutodestroy(true);
96 return SEffectManager.PlayInWorld(eff, pos);
97 }
98 }
99
100 return false;
101 }
102
104
105
110
112 static void Init()
113 {
116 }
117
119 static void Cleanup()
120 {
121 /* These ain't containing no refs, so whatever
122 m_AmmoParticles.Clear();
123 m_AmmoEffects.Clear();
124 */
125 }
126
128}
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Static data holder for certain ammo config values.
Definition AmmoEffects.c:6
static bool PlayAmmoEffect(string ammoType, vector pos)
Attempt to play the ammo effect at pos if found, returns true on success.
Definition AmmoEffects.c:85
static ref map< string, typename > m_AmmoEffects
Key: Ammo class name; Data: ParticleList ID.
Definition AmmoEffects.c:11
static ref map< string, int > m_AmmoParticles
Key: Ammo class name; Data: ParticleList ID.
Definition AmmoEffects.c:8
static GetAmmoEffectTypename(string ammoType)
Get the typename for the effect for this ammoType.
Definition AmmoEffects.c:62
static void Cleanup()
Clean up the data.
static bool PlayAmmoParticle(string ammoType, vector pos)
Attempt to play the ammo particle at pos if found, returns true on success.
Definition AmmoEffects.c:43
static void Init()
Initialize the containers: this is done this way, to have these not exist on server.
static int GetAmmoParticleID(string ammoType)
Get the ParticleList ID for the particle for this ammoType.
Definition AmmoEffects.c:20
static int GetParticleIDByName(string name)
Returns particle's ID based on the filename (without .ptc suffix)
static bool IsValidId(int id)
Purely checks for an invalid number, does NOT mean it is actually registered.
Manager class for managing Effect (EffectParticle, EffectSound)
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
proto native CGame GetGame()