DayZ 1.24
Loading...
Searching...
No Matches
AmmoEffects Class Reference

Static data holder for certain ammo config values. More...

Static Private Member Functions

Ammo particles

Methods regarding getting/playing ammo particle

static int GetAmmoParticleID (string ammoType)
 Get the ParticleList ID for the particle for this ammoType.
 
static bool PlayAmmoParticle (string ammoType, vector pos)
 Attempt to play the ammo particle at pos if found, returns true on success.
 
Ammo effects

Methods regarding getting/playing ammo effect

static GetAmmoEffectTypename (string ammoType)
 Get the typename for the effect for this ammoType.
 
static bool PlayAmmoEffect (string ammoType, vector pos)
 Attempt to play the ammo effect at pos if found, returns true on success.
 
Lifetime

Creation and cleanup

static void Init ()
 Initialize the containers: this is done this way, to have these not exist on server.
 
static void Cleanup ()
 Clean up the data.
 

Static Private Attributes

static ref map< string, intm_AmmoParticles
 Key: Ammo class name; Data: ParticleList ID.
 
static ref map< string, typenamem_AmmoEffects
 Key: Ammo class name; Data: ParticleList ID.
 

Detailed Description

Static data holder for certain ammo config values.

Note
Kept the names similar to what is in config, but it might be a little deceiving as this is mainly used for explosives

Definition at line 5 of file AmmoEffects.c.

Member Function Documentation

◆ Cleanup()

static void AmmoEffects::Cleanup ( )
inlinestaticprivate

Clean up the data.

Definition at line 119 of file AmmoEffects.c.

120 {
121 /* These ain't containing no refs, so whatever
122 m_AmmoParticles.Clear();
123 m_AmmoEffects.Clear();
124 */
125 }

Referenced by CGame::~CGame().

◆ GetAmmoEffectTypename()

static AmmoEffects::GetAmmoEffectTypename ( string ammoType)
inlinestaticprivate

Get the typename for the effect for this ammoType.

Definition at line 62 of file AmmoEffects.c.

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 }
static ref map< string, typename > m_AmmoEffects
Key: Ammo class name; Data: ParticleList ID.
Definition AmmoEffects.c:11
proto native CGame GetGame()

References GetGame(), and m_AmmoEffects.

Referenced by PlayAmmoEffect().

◆ GetAmmoParticleID()

static int AmmoEffects::GetAmmoParticleID ( string ammoType)
inlinestaticprivate

Get the ParticleList ID for the particle for this ammoType.

Definition at line 20 of file AmmoEffects.c.

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 }
static ref map< string, int > m_AmmoParticles
Key: Ammo class name; Data: ParticleList ID.
Definition AmmoEffects.c:8
static int GetParticleIDByName(string name)
Returns particle's ID based on the filename (without .ptc suffix)

References GetGame(), ParticleList::GetParticleIDByName(), and m_AmmoParticles.

Referenced by PlayAmmoParticle().

◆ Init()

static void AmmoEffects::Init ( )
inlinestaticprivate

Initialize the containers: this is done this way, to have these not exist on server.

Definition at line 112 of file AmmoEffects.c.

References m_AmmoEffects, and m_AmmoParticles.

Referenced by CGame::CGame().

◆ PlayAmmoEffect()

static bool AmmoEffects::PlayAmmoEffect ( string ammoType,
vector pos )
inlinestaticprivate

Attempt to play the ammo effect at pos if found, returns true on success.

Definition at line 85 of file AmmoEffects.c.

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 }
static GetAmmoEffectTypename(string ammoType)
Get the typename for the effect for this ammoType.
Definition AmmoEffects.c:62
Manager class for managing Effect (EffectParticle, EffectSound)
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.

References GetAmmoEffectTypename(), and SEffectManager::PlayInWorld().

Referenced by IEntity::OnExplodeClient().

◆ PlayAmmoParticle()

static bool AmmoEffects::PlayAmmoParticle ( string ammoType,
vector pos )
inlinestaticprivate

Attempt to play the ammo particle at pos if found, returns true on success.

Definition at line 43 of file AmmoEffects.c.

44 {
46
48 return ParticleManager.GetInstance().PlayInWorld(particleID, pos) != null;
49
50 return false;
51 }
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
static int GetAmmoParticleID(string ammoType)
Get the ParticleList ID for the particle for this ammoType.
Definition AmmoEffects.c:20
static bool IsValidId(int id)
Purely checks for an invalid number, does NOT mean it is actually registered.

References GetAmmoParticleID(), ParticleList::IsValidId(), and ParticleManager().

Referenced by IEntity::OnExplodeClient().

Member Data Documentation

◆ m_AmmoEffects

ref map<string, typename> AmmoEffects::m_AmmoEffects
staticprivate

Key: Ammo class name; Data: ParticleList ID.

Definition at line 11 of file AmmoEffects.c.

Referenced by GetAmmoEffectTypename(), and Init().

◆ m_AmmoParticles

ref map<string, int> AmmoEffects::m_AmmoParticles
staticprivate

Key: Ammo class name; Data: ParticleList ID.

Definition at line 8 of file AmmoEffects.c.

Referenced by GetAmmoParticleID(), and Init().


The documentation for this class was generated from the following file: