DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
AmmunitionPiles.c
См. документацию.
3{
5
6 static float GetAmmoWeightByBulletType(string bulletType)
7 {
8 if (m_AmmoWeightByBulletType.Contains(bulletType))
9 {
10 return m_AmmoWeightByBulletType.Get(bulletType);
11 }
12 else
13 {
14 float ammoWeight;
15 string ammoTypeName;
16 g_Game.ConfigGetText( string.Format("CfgAmmo %1 spawnPileType", bulletType) , ammoTypeName);
17 if (ammoTypeName)
18 ammoWeight = g_Game.ConfigGetFloat(string.Format("CfgMagazines %1 weight", ammoTypeName));
19 else
20 ErrorEx("empty 'spawnPileType' for bullet type:" + bulletType);
21 if (ammoWeight)
22 m_AmmoWeightByBulletType.Insert(bulletType, ammoWeight);
23 return ammoWeight;
24 }
25 }
26
27 override bool IsAmmoPile()
28 {
29 return true;
30 }
31
32 override protected float GetWeightSpecialized(bool forceRecalc = false)
33 {
34 #ifdef DEVELOPER
35 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
36 {
37 WeightDebugData data = WeightDebug.GetWeightDebug(this);
38 data.SetCalcDetails("TAmmo: ("+GetAmmoCount()+"(Ammo count) * "+ GetConfigWeightModifiedDebugText());
39 }
40 #endif
41
42 return GetAmmoCount() * GetConfigWeightModified();
43 }
44
45 override void SetQuantityToMinimum()
46 {
47 ServerSetAmmoCount(1);
48 }
49
51 {
52 float dmgPerUse = g_Game.ConfigGetFloat("cfgAmmo " + info.GetAmmoType() + " dmgPerUse");
53 float totalDmg = info.GetProjectileDamage() + dmgPerUse;
54 float health = Math.Max(1 - totalDmg, 0);
55
57 SetHealth01("","", health);
58
59 // SetCartridgeDamageAtIndex() MUST be called AFTER SetHealth01()!!
60 // otherwise, decreasing health by less than an entire health level get ignored
61 SetCartridgeDamageAtIndex(0, totalDmg);
62 }
63};
64
84{
85 override bool IsInventoryVisible()
86 {
88 return CanBeActionTarget();
89 }
90
91 override bool CanBeActionTarget()
92 {
93 if (super.CanBeActionTarget())
94 {
95 EntityAI parent = EntityAI.Cast(GetParent());
96 if (parent)
97 {
98 return !parent.IsManagingArrows();
99 }
100 }
101 return true;
102 }
103
104 override void EEParentedTo(EntityAI parent)
105 {
106 if (!parent)
107 return;
108
109 ArrowManagerBase arrowManager = parent.GetArrowManager();
110 if (arrowManager)
111 {
112 arrowManager.AddArrow(this);
113 }
114 }
115
116 override void EEParentedFrom(EntityAI parent)
117 {
118 if (!parent)
119 return;
120
121 ArrowManagerBase arrowManager = parent.GetArrowManager();
122 if (arrowManager)
123 {
124 arrowManager.RemoveArrow(this);
125 }
126 }
127}
128
129class Ammo_DartSyringe: Ammunition_Base {};
135
136//bolts
138
139class Ammo_ImprovisedBolt_1 : Bolt_Base
140{
141 override void SetActions()
142 {
143 super.SetActions();
144
146 }
147}
148
150class Ammo_CupidsBolt : Bolt_Base
151{
152 override void EEParentedTo(EntityAI parent)
153 {
154 Delete();
155 }
156
157 override void EEParentedFrom(EntityAI parent);
158
160 {
161 ParticleManager.GetInstance().PlayInWorld(ParticleList.BOLT_CUPID_HIT, position);
162 }
163}
164
165// 40mm
166
168{
169 override bool IsTakeable()
170 {
171 return GetAnimationPhase("Visibility") == 0;
172 }
173
174 override bool IsInventoryVisible()
175 {
176 if (!super.IsInventoryVisible())
177 {
178 return false;
179 }
180
181 return IsTakeable();
182 }
184
186{
187 override bool IsExplosive()
188 {
189 return true;
190 }
191
192 override void OnActivatedByItem(notnull ItemBase item)
193 {
194 if (g_Game.IsServer())
195 {
196 DamageSystem.ExplosionDamage(this, null, "Explosion_40mm_Ammo", item.GetPosition(), DamageType.EXPLOSION);
197 }
198 }
199
200 override void EEKilled(Object killer)
201 {
202 super.EEKilled(killer);
203 DamageSystem.ExplosionDamage(this, null, "Explosion_40mm_Ammo", GetPosition(), DamageType.EXPLOSION);
204 g_Game.GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( DeleteSafe, 1000, false);
205 }
206
207 override void OnDamageDestroyed(int oldLevel)
208 {
209 super.OnDamageDestroyed(oldLevel);
210 #ifndef SERVER
211 #ifndef NO_GUI
212 ClearFlags(EntityFlags.VISIBLE, false);
213 #endif
214 #endif
215 }
216}
217//class Ammo_40mm_Grenade_Gas: Ammo_40mm_Base {};
218class Ammo_40mm_ChemGas: Ammo_40mm_Base
219{
220 override void OnActivatedByItem(notnull ItemBase item)
222 if (g_Game.IsServer())
223 {
224 g_Game.CreateObject("ContaminatedArea_Local", item.GetPosition());
225 }
226 }
227
228 override void EEKilled(Object killer)
229 {
230 super.EEKilled(killer);
231 g_Game.CreateObject("ContaminatedArea_Local", GetPosition());
232 g_Game.GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( DeleteSafe, 1000, false);
233 }
235 override void OnDamageDestroyed(int oldLevel)
236 {
237 super.OnDamageDestroyed(oldLevel);
238
239 #ifndef SERVER
240 #ifndef NO_GUI
241 ClearFlags(EntityFlags.VISIBLE, false);
242 ParticleManager.GetInstance().PlayInWorld(ParticleList.GRENADE_CHEM_BREAK, GetPosition());
243 #endif
244 #endif
245 }
246
247
248}
249
251{
253 protected float m_ParticleLifetime;
254 protected int m_ParticleId;
255 protected bool m_Activated;
256
258 {
259 RegisterNetSyncVariableBool("m_Activated");
260 }
261
263 {
264 super.OnVariablesSynchronized();
265
266 if (m_Activated)
267 {
268 #ifndef SERVER
269 #ifndef NO_GUI
270 string particleStrIdentifier = g_Game.ConfigGetTextOut(string.Format("CfgMagazines %1 particleStrIdentifier", GetType()));
271 m_ParticleId = ParticleList.GetParticleIDByName(particleStrIdentifier);
272 if (m_ParticleId > 0)
273 {
274 m_ParticleSmoke = ParticleManager.GetInstance().PlayOnObject(m_ParticleId, this);
275 m_ParticleSmoke.SetWiggle(7, 0.3);
276 }
277 #endif
278 #endif
279 }
280 }
281
282 protected void Activate()
283 {
284 m_ParticleLifetime = g_Game.ConfigGetFloat(string.Format("CfgMagazines %1 particleLifeTime", GetType()));
285 m_Activated = true;
286 SetSynchDirty();
287
288 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DeleteSafe, m_ParticleLifetime * 1000);
289 }
290
292 override void EEKilled(Object killer)
293 {
294 //analytics (behaviour from EntityAI)
295 g_Game.GetAnalyticsServer().OnEntityKilled(killer, this);
296 }
297
298 override void EEDelete(EntityAI parent)
299 {
300 #ifndef SERVER
301 #ifndef NO_GUI
302 if (m_ParticleSmoke)
303 {
304 m_ParticleSmoke.Stop();
305 }
306 #endif
307 #endif
308
309 super.EEDelete(parent);
310 }
311
312 override bool CanPutInCargo( EntityAI parent )
313 {
314 return !m_Activated;
315 }
316
317 override void OnActivatedByItem(notnull ItemBase item)
318 {
319 SetHealth("", "", 0.0);
320 Activate();
321 }
322}
323
324class Ammo_40mm_Smoke_Red: Ammo_40mm_Smoke_ColorBase {};
eBleedingSourceType GetType()
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
static void PlayOnHitParticle(vector position)
Определения AmmunitionPiles.c:159
Ammo_HuntingBolt Bolt_Base SetActions()
Определения AmmunitionPiles.c:141
override void EEKilled(Object killer)
Определения AmmunitionPiles.c:234
Ammo_40mm_Explosive Ammo_40mm_Base OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения AmmunitionPiles.c:220
override void OnDamageDestroyed(int oldLevel)
Определения AmmunitionPiles.c:241
Ammo_40mm_Base EEParentedTo
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
class GP5GasMask extends MaskBase ItemBase
Magazine Magazine_Base
Определения Magazine.c:1
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
Определения AmmunitionPiles.c:79
Определения AmmunitionPiles.c:77
Определения AmmunitionPiles.c:66
Определения AmmunitionPiles.c:80
Определения AmmunitionPiles.c:69
override bool IsTakeable()
Определения AmmunitionPiles.c:169
override bool IsInventoryVisible()
Определения AmmunitionPiles.c:174
override void EEKilled(Object killer)
Определения AmmunitionPiles.c:200
override bool IsExplosive()
Определения AmmunitionPiles.c:187
override void OnActivatedByItem(notnull ItemBase item)
Определения AmmunitionPiles.c:192
override void OnDamageDestroyed(int oldLevel)
Определения AmmunitionPiles.c:207
Particle m_ParticleSmoke
Определения AmmunitionPiles.c:252
void Activate()
Определения AmmunitionPiles.c:282
override void OnActivatedByItem(notnull ItemBase item)
Определения AmmunitionPiles.c:317
override void EEKilled(Object killer)
special behaviour - do not call super
Определения AmmunitionPiles.c:292
float m_ParticleLifetime
Определения AmmunitionPiles.c:253
override bool CanPutInCargo(EntityAI parent)
Определения AmmunitionPiles.c:312
override void OnVariablesSynchronized()
Определения AmmunitionPiles.c:262
void Ammo_40mm_Smoke_ColorBase()
Определения AmmunitionPiles.c:257
override void EEDelete(EntityAI parent)
Определения AmmunitionPiles.c:298
Определения AmmunitionPiles.c:65
Определения AmmunitionPiles.c:81
Определения AmmunitionPiles.c:70
Определения AmmunitionPiles.c:74
Определения AmmunitionPiles.c:72
Определения AmmunitionPiles.c:68
Определения AmmunitionPiles.c:76
Определения AmmunitionPiles.c:130
Определения AmmunitionPiles.c:133
Определения AmmunitionPiles.c:132
Определения AmmunitionPiles.c:131
override void SetFromProjectile(ProjectileStoppedInfo info)
Определения AmmunitionPiles.c:50
static float GetAmmoWeightByBulletType(string bulletType)
Определения AmmunitionPiles.c:6
float GetWeightSpecialized(bool forceRecalc=false)
Определения AmmunitionPiles.c:32
override bool IsAmmoPile()
Определения AmmunitionPiles.c:27
static ref map< string, float > m_AmmoWeightByBulletType
Определения AmmunitionPiles.c:4
override void SetQuantityToMinimum()
Определения AmmunitionPiles.c:45
ammo pile base
Определения AmmunitionPiles.c:3
void RemoveArrow(EntityAI arrow)
Определения ArrowManagerBase.c:18
void AddArrow(EntityAI arrow)
Определения ArrowManagerBase.c:13
override void EEParentedTo(EntityAI parent)
Определения AmmunitionPiles.c:104
override bool IsInventoryVisible()
Определения AmmunitionPiles.c:85
override bool CanBeActionTarget()
Определения AmmunitionPiles.c:91
override void EEParentedFrom(EntityAI parent)
Определения AmmunitionPiles.c:116
Определения AmmunitionPiles.c:84
Определения EnMath.c:7
Определения ObjectTyped.c:2
Legacy way of using particles in the game.
Определения Particle.c:7
static const int BOLT_CUPID_HIT
Определения ParticleList.c:359
static int GetParticleIDByName(string name)
Returns particle's ID based on the filename (without .ptc suffix)
Определения ParticleList.c:552
static const int GRENADE_CHEM_BREAK
Определения ParticleList.c:344
Определения ParticleList.c:12
proto native string GetAmmoType()
proto native float GetProjectileDamage()
Определения DayZGame.c:18
void SetCalcDetails(string details)
Определения 3_Game/DayZ/tools/Debug.c:934
Определения Transport.c:70
Определения EnConvert.c:119
class LOD Object
enum ShapeType ErrorEx
EntityFlags
Entity flags.
Определения EnEntity.c:115
static proto float Max(float x, float y)
Returns bigger of two given values.
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:422
proto native int ClearFlags(int flags, bool immedUpdate=true)