6 static float GetAmmoWeightByBulletType(
string bulletType)
8 if (m_AmmoWeightByBulletType.Contains(bulletType))
10 return m_AmmoWeightByBulletType.Get(bulletType);
16 GetGame().ConfigGetText(
string.Format(
"CfgAmmo %1 spawnPileType", bulletType) , ammoTypeName);
18 ammoWeight =
GetGame().ConfigGetFloat(
string.Format(
"CfgMagazines %1 weight", ammoTypeName));
20 ErrorEx(
"empty 'spawnPileType' for bullet type:" + bulletType);
22 m_AmmoWeightByBulletType.Insert(bulletType, ammoWeight);
27 override void SetActions()
34 override bool IsAmmoPile()
39 override protected float GetWeightSpecialized(
bool forceRecalc =
false)
42 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
45 data.SetCalcDetails(
"TAmmo: ("+GetAmmoCount()+
"(Ammo count) * "+ GetConfigWeightModifiedDebugText());
49 return GetAmmoCount() * GetConfigWeightModified();
52 override void SetQuantityToMinimum()
54 ServerSetAmmoCount(1);
59 float dmgPerUse =
GetGame().ConfigGetFloat(
"cfgAmmo " + info.GetAmmoType() +
" dmgPerUse");
60 float totalDmg = info.GetProjectileDamage() + dmgPerUse;
61 float health =
Math.Max(1 - totalDmg, 0);
63 SetQuantityToMinimum();
64 SetHealth01(
"",
"", health);
68 SetCartridgeDamageAtIndex(0, totalDmg);
92 override bool IsInventoryVisible()
95 return CanBeActionTarget();
98 override bool CanBeActionTarget()
100 if (super.CanBeActionTarget())
105 return !parent.IsManagingArrows();
111 override void EEParentedTo(
EntityAI parent)
119 arrowManager.AddArrow(
this);
123 override void EEParentedFrom(
EntityAI parent)
131 arrowManager.RemoveArrow(
this);
166 static void PlayOnHitParticle(
vector position)
176 override bool IsTakeable()
178 return GetAnimationPhase(
"Visibility") == 0;
181 override bool IsInventoryVisible()
183 if (!super.IsInventoryVisible())
194 override bool ShootsExplosiveAmmo()
199 override void OnActivatedByItem(notnull
ItemBase item)
203 DamageSystem.ExplosionDamage(
this,
null,
"Explosion_40mm_Ammo", item.GetPosition(),
DamageType.EXPLOSION);
207 override void EEKilled(
Object killer)
209 super.EEKilled(killer);
210 DamageSystem.ExplosionDamage(
this,
null,
"Explosion_40mm_Ammo",
GetPosition(),
DamageType.EXPLOSION);
214 override void OnDamageDestroyed(
int oldLevel)
216 super.OnDamageDestroyed(oldLevel);
229 GetGame().CreateObject(
"ContaminatedArea_Local", item.GetPosition());
235 super.EEKilled(killer);
242 super.OnDamageDestroyed(oldLevel);
256 protected float m_ParticleLifetime;
257 protected int m_ParticleId;
258 protected bool m_Activated;
262 RegisterNetSyncVariableBool(
"m_Activated");
265 override void OnVariablesSynchronized()
267 super.OnVariablesSynchronized();
272 string particleStrIdentifier =
GetGame().ConfigGetTextOut(
string.Format(
"CfgMagazines %1 particleStrIdentifier",
GetType()));
273 m_ParticleId =
ParticleList.GetParticleIDByName(particleStrIdentifier);
274 if (m_ParticleId > 0)
283 protected void Activate()
285 m_ParticleLifetime =
GetGame().ConfigGetFloat(
string.Format(
"CfgMagazines %1 particleLifeTime",
GetType()));
293 override void EEKilled(
Object killer)
296 GetGame().GetAnalyticsServer().OnEntityKilled(killer,
this);
299 override void EEDelete(
EntityAI parent)
308 super.EEDelete(parent);
311 override bool CanPutInCargo(
EntityAI parent )
316 override void OnActivatedByItem(notnull
ItemBase item)
318 SetHealth(
"",
"", 0.0);