DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
AmmoTypes.c
См. документацию.
2{
4
5 private void AmmoTypesAPI() {}
6 private void ~AmmoTypesAPI() {}
7
9 static proto bool Exists(string ammoType);
11 static proto bool GetAmmoType(string magazineType, out string ammoType);
12
14 static bool MagazineTypeToAmmoType(string magazineType, out string ammoType)
15 {
16 if ( !AmmoTypesAPI.Exists(magazineType) )
17 {
18 if ( !AmmoTypesAPI.GetAmmoType(magazineType, ammoType) )
19 {
20 ErrorEx(string.Format("%1 is not a magazineType or ammoType or has no default 'ammo' set up in config.", magazineType));
21 return false;
22 }
23 return true;
24 }
25 else
26 {
27 // This is already an ammoType
28 ammoType = magazineType;
29 return true;
30 }
31 }
32
33 static void Init()
34 {
36 {
38
39 AddExplosionParticleEffect("Explosion_40mm_Ammo", "Hit_Snow", ParticleList.EXPLOSION_GRENADE_SNOW);
40 AddExplosionParticleEffect("Explosion_40mm_Ammo", "Hit_Ice", ParticleList.EXPLOSION_GRENADE_ICE);
41 AddExplosionParticleEffect("Explosion_40mm_Ammo", "default", ParticleList.EXPLOSION_LANDMINE);
42 }
43 }
44
45 static void AddExplosionParticleEffect(string ammoName, string surfaceName, int particleID)
46 {
47 map<string, int>> surfaceNameToEffectIDMap;
48 if (!m_TypeToSurfaceParticleIDMap.Find(ammoName, surfaceNameToEffectIDMap))
49 {
50 surfaceNameToEffectIDMap = new map<string, int>>;
51 m_TypeToSurfaceParticleIDMap.Insert(ammoName, surfaceNameToEffectIDMap);
52 }
53
54 surfaceNameToEffectIDMap.Insert(surfaceName, particleID);
55 }
56
57 static int GetExplosionParticleID(string ammoName, string surfaceName)
58 {
59 int result;
60 map<string, int>> surfaceNameToEffectIDMap = m_TypeToSurfaceParticleIDMap.Get(ammoName);
61 if (surfaceNameToEffectIDMap)
62 {
63 if (!surfaceNameToEffectIDMap.Find(surfaceName, result))
64 {
65 if(!surfaceNameToEffectIDMap.Find("default", result))
66 {
67 result = -1;
68 }
69 }
70 }
71 return result;
72 }
73
74 static void Cleanup()
75 {
77 {
79 }
80 }
81}
map
Определения ControlsXboxNew.c:4
static proto bool Exists(string ammoType)
Check if ammoType exists (registered in cfgAmmoTypes)
void AmmoTypesAPI()
Определения AmmoTypes.c:5
static int GetExplosionParticleID(string ammoName, string surfaceName)
Определения AmmoTypes.c:57
static proto bool GetAmmoType(string magazineType, out string ammoType)
Get the default ammoType of a magazine.
static void Cleanup()
Определения AmmoTypes.c:74
static void AddExplosionParticleEffect(string ammoName, string surfaceName, int particleID)
Определения AmmoTypes.c:45
static void Init()
Определения AmmoTypes.c:33
void ~AmmoTypesAPI()
Определения AmmoTypes.c:6
static bool MagazineTypeToAmmoType(string magazineType, out string ammoType)
Helper method.
Определения AmmoTypes.c:14
ref map< string, ref map< string, int > > m_TypeToSurfaceParticleIDMap
Определения AmmoTypes.c:3
static const int EXPLOSION_LANDMINE
Определения ParticleList.c:267
static const int EXPLOSION_GRENADE_ICE
Определения ParticleList.c:136
static const int EXPLOSION_GRENADE_SNOW
Определения ParticleList.c:135
Определения ParticleList.c:12
enum ShapeType ErrorEx