Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
inventoryitemtype.c
Go to the documentation of this file.
2 {
3  ref array<ref AnimSoundEvent> m_animSoundEvents;
4 
5  private void InventoryItemType()
6  {
7  LoadSoundEvents();
8  }
9 
10  private void ~InventoryItemType();
11 
12  void LoadSoundEvents()
13  {
14  string cfgPath = "CfgVehicles " + GetName() + " AnimEvents SoundWeapon";
15 
17 
18  int soundCount = GetGame().ConfigGetChildrenCount(cfgPath);
19 
20  if (soundCount <= 0)//try other path
21  {
22  cfgPath = "CfgWeapons " + GetName() + " AnimEvents SoundWeapon";
23  soundCount = GetGame().ConfigGetChildrenCount(cfgPath);
24  }
25 
26  if (soundCount <= 0)//try other path
27  {
28  cfgPath = "CfgMagazines " + GetName() + " AnimEvents SoundWeapon";
29  soundCount = GetGame().ConfigGetChildrenCount(cfgPath);
30  }
31 
32  if (soundCount <= 0)//try other path
33  {
34  cfgPath = "CfgAmmo " + GetName() + " AnimEvents SoundWeapon";
35  soundCount = GetGame().ConfigGetChildrenCount(cfgPath);
36  }
37 
38  for (int i = 0; i < soundCount; i++)
39  {
40  string soundName;
41  GetGame().ConfigGetChildName(cfgPath, i, soundName);
42  string soundPath = cfgPath + " " + soundName + " ";
43  AnimSoundEvent soundEvent = new AnimSoundEvent(soundPath);
44  if (soundEvent.IsValid())
45  m_animSoundEvents.Insert(soundEvent);
46  }
47  }
48 
49 
50  AnimSoundEvent GetSoundEvent(int event_id)
51  {
52  foreach (AnimSoundEvent soundEvent : m_animSoundEvents)
53  {
54  if (soundEvent.m_iID == event_id)
55  return soundEvent;
56  }
57 
58  return null;
59  }
60 
61 
62  proto native owned string GetName();
63 }
GetGame
proto native CGame GetGame()
m_animSoundEvents
private ref array< ref AnimSoundEvent > m_animSoundEvents
Definition: dayzplayercfgsounds.c:291
array< ref AnimSoundEvent >
InventoryItemType
Definition: inventoryitemtype.c:1