Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
dayzcreatureaitype.c
Go to the documentation of this file.
2 {
3  ref array<ref AnimSoundEvent> m_animSoundEvents;
4  ref array<ref AnimSoundVoiceEvent> m_animSoundVoiceEvents;
5  ref array<ref AnimStepEvent> m_animStepEvents;
6  ref array<ref AnimDamageEvent> m_animDamageEvents;
7 
8  string m_CfgPath;
9  string m_AnimEventsCfgPath;
10 
11  private void DayZCreatureAIType()
12  {
13  m_CfgPath = "CfgVehicles " + GetName() + " ";
14  m_AnimEventsCfgPath = m_CfgPath + "AnimEvents ";
15  LoadParams();
16  }
17 
18  private void ~DayZCreatureAIType()
19  {
20 
21  }
22 
23  void LoadAnimSoundEvents()
24  {
26 
27  string soundsCfgPath = m_AnimEventsCfgPath + "Sounds ";
28 
29  int soundCount = GetGame().ConfigGetChildrenCount(soundsCfgPath);
30  for (int i = 0; i < soundCount; i++)
31  {
32  string soundName;
33  GetGame().ConfigGetChildName(soundsCfgPath, i, soundName);
34  string soundPath = soundsCfgPath + soundName + " ";
35  AnimSoundEvent soundEvent = new AnimSoundEvent(soundPath);
36  if (soundEvent.IsValid())
37  m_animSoundEvents.Insert(soundEvent);
38  }
39  }
40 
41  void LoadAnimSoundVoiceEvents()
42  {
43  m_animSoundVoiceEvents = new array<ref AnimSoundVoiceEvent>;
44 
45  string soundsCfgPath = m_AnimEventsCfgPath + "SoundVoice ";
46 
47  int soundCount = GetGame().ConfigGetChildrenCount(soundsCfgPath);
48  for (int i = 0; i < soundCount; i++)
49  {
50  string soundName;
51  GetGame().ConfigGetChildName(soundsCfgPath, i, soundName);
52  string soundPath = soundsCfgPath + soundName + " ";
53  AnimSoundVoiceEvent soundEvent = new AnimSoundVoiceEvent(soundPath);
54  if (soundEvent.IsValid())
55  m_animSoundVoiceEvents.Insert(soundEvent);
56  }
57  }
58 
59  void LoadAnimStepEvents()
60  {
61  m_animStepEvents = new array<ref AnimStepEvent>;
62  string stepsCfgPath = m_AnimEventsCfgPath + "Steps ";
63  int stepsCount = GetGame().ConfigGetChildrenCount(stepsCfgPath);
64 
65  for (int i = 0; i < stepsCount; i++)
66  {
67  string stepName;
68  GetGame().ConfigGetChildName(stepsCfgPath, i, stepName);
69  string stepPath = stepsCfgPath + stepName + " ";
70  AnimStepEvent stepEvent = new AnimStepEvent(stepPath);
71  m_animStepEvents.Insert(stepEvent);
72  }
73  }
74 
75  void LoadAnimDamageEvents()
76  {
77  m_animDamageEvents = new array<ref AnimDamageEvent>;
78 
79  string damagesCfgPath = m_AnimEventsCfgPath + "Damages ";
80  int damagesCount = GetGame().ConfigGetChildrenCount(damagesCfgPath);
81 
82  for (int i = 0; i < damagesCount; i++)
83  {
84  string damageName;
85  GetGame().ConfigGetChildName(damagesCfgPath, i, damageName);
86  string damagePath = damagesCfgPath + damageName + " ";
87  AnimDamageEvent damageEvent = new AnimDamageEvent(damagePath);
88  m_animDamageEvents.Insert(damageEvent);
89  }
90  }
91 
92  private void LoadParams()
93  {
94  LoadAnimSoundEvents();
95  LoadAnimSoundVoiceEvents();
96  LoadAnimStepEvents();
97  LoadAnimDamageEvents();
98  }
99 
100  AnimStepEvent GetStepEvent(int event_id)
101  {
102  for (int i = 0; i < m_animStepEvents.Count(); i++)
103  {
104  AnimStepEvent stepEvent = m_animStepEvents.Get(i);
105  if (stepEvent.m_iID == event_id)
106  {
107  return stepEvent;
108  }
109  }
110 
111  return null;
112  }
113 
114  AnimSoundEvent GetSoundEvent(int event_id)
115  {
116  for (int i = 0; i < m_animSoundEvents.Count(); i++)
117  {
118  AnimSoundEvent soundEvent = m_animSoundEvents.Get(i);
119  if (soundEvent.m_iID == event_id)
120  {
121  return soundEvent;
122  }
123  }
124 
125  return null;
126  }
127 
128  AnimSoundVoiceEvent GetSoundVoiceEvent(int event_id)
129  {
130  for (int i = 0; i < m_animSoundVoiceEvents.Count(); i++)
131  {
132  AnimSoundVoiceEvent voiceEvent = m_animSoundVoiceEvents.Get(i);
133  if (voiceEvent.m_iID == event_id)
134  {
135  return voiceEvent;
136  }
137  }
138 
139  return null;
140  }
141 
142  AnimDamageEvent GetDamageEvent(int event_id)
143  {
144  for (int i = 0; i < m_animDamageEvents.Count(); i++)
145  {
146  AnimDamageEvent damageEvent = m_animDamageEvents.Get(i);
147  if (damageEvent.m_iID == event_id)
148  {
149  return damageEvent;
150  }
151  }
152 
153  return null;
154  }
155 
156  proto native owned string GetName();
157 }
GetGame
proto native CGame GetGame()
m_animSoundEvents
private ref array< ref AnimSoundEvent > m_animSoundEvents
Definition: dayzplayercfgsounds.c:291
array< ref AnimSoundEvent >
DayZCreatureAIType
Definition: dayzanimaltype.c:1