DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
AmmoEffects.c
См. документацию.
1
6{
9
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 {
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}
map
Определения ControlsXboxNew.c:4
void Effect()
ctor
Определения Effect.c:70
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
static bool PlayAmmoEffect(string ammoType, vector pos)
Attempt to play the ammo effect at pos if found, returns true on success.
Определения AmmoEffects.c:93
static ref map< string, typename > m_AmmoEffects
Key: Ammo class name; Data: ParticleList ID.
Определения AmmoEffects.c:11
static ref map< string, int > m_AmmoParticles
Key: Ammo class name; Data: ParticleList ID.
Определения AmmoEffects.c:8
static GetAmmoEffectTypename(string ammoType)
Get the typename for the effect for this ammoType.
Определения AmmoEffects.c:68
static void Cleanup()
Clean up the data.
Определения AmmoEffects.c:128
static bool PlayAmmoParticle(string ammoType, vector pos)
Attempt to play the ammo particle at pos if found, returns true on success.
Определения AmmoEffects.c:46
static void Init()
Initialize the containers: this is done this way, to have these not exist on server.
Определения AmmoEffects.c:121
static int GetAmmoParticleID(string ammoType)
Get the ParticleList ID for the particle for this ammoType.
Определения AmmoEffects.c:21
Static data holder for certain ammo config values.
Определения AmmoEffects.c:6
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
static int GetParticleIDByName(string name)
Returns particle's ID based on the filename (without .ptc suffix)
Определения ParticleList.c:500
static bool IsValidId(int id)
Purely checks for an invalid number, does NOT mean it is actually registered.
Определения ParticleList.c:470
Определения ParticleList.c:12
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
Определения EffectManager.c:47
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
Определения EnConvert.c:106
proto native CGame GetGame()
proto native ToType()
Returns internal type representation. Can be used in runtime, or cached in variables and used for fas...