DayZ 1.24
Loading...
Searching...
No Matches
Ammunition_Base Class Reference

ammo pile base More...

Inheritance diagram for Ammunition_Base:
[legend]
Collaboration diagram for Ammunition_Base:
[legend]

Protected Member Functions

float GetWeightSpecialized (bool forceRecalc=false)
 
override void SetQuantityToMinimum ()
 
override void SetFromProjectile (ProjectileStoppedInfo info)
 

Private Member Functions

override void SetActions ()
 
override bool IsAmmoPile ()
 

Static Private Member Functions

static float GetAmmoWeightByBulletType (string bulletType)
 

Static Private Attributes

static ref map< string, floatm_AmmoWeightByBulletType = new map<string, float>()
 

Detailed Description

ammo pile base

Definition at line 2 of file AmmunitionPiles.c.

Member Function Documentation

◆ GetAmmoWeightByBulletType()

static float Ammunition_Base::GetAmmoWeightByBulletType ( string bulletType)
inlinestaticprivate

Definition at line 6 of file AmmunitionPiles.c.

7 {
10 else
11 {
12 float ammoWeight;
13 string ammoTypeName;
14 GetGame().ConfigGetText(string.Format("CfgAmmo %1 spawnPileType", bulletType), ammoTypeName);
15 if (ammoTypeName)
16 ammoWeight = GetGame().ConfigGetFloat(string.Format("CfgMagazines %1 weight", ammoTypeName));
17 else
18 ErrorEx("empty 'spawnPileType' for bullet type:" + bulletType);
19 if (ammoWeight)
21 return ammoWeight;
22 }
23 }
static ref map< string, float > m_AmmoWeightByBulletType
proto native CGame GetGame()
enum ShapeType ErrorEx

References ErrorEx, GetGame(), and m_AmmoWeightByBulletType.

Referenced by Weapon::GetWeightSpecialized().

◆ GetWeightSpecialized()

float Ammunition_Base::GetWeightSpecialized ( bool forceRecalc = false)
inlineprotected

Definition at line 37 of file AmmunitionPiles.c.

38 {
39#ifdef DEVELOPER
40 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
41 {
42 WeightDebugData data = WeightDebug.GetWeightDebug(this);
43 data.SetCalcDetails("TAmmo: (" + GetAmmoCount() + "(Ammo count) * " + GetConfigWeightModifiedDebugText());
44 }
45#endif
46
47 return GetAmmoCount() * GetConfigWeightModified();
48 }

◆ IsAmmoPile()

override bool Ammunition_Base::IsAmmoPile ( )
inlineprivate

Definition at line 32 of file AmmunitionPiles.c.

33 {
34 return true;
35 }

◆ SetActions()

override void Ammunition_Base::SetActions ( )
inlineprivate

Definition at line 25 of file AmmunitionPiles.c.

26 {
27 super.SetActions();
28
30 }
void AddAction(typename actionName)

References AddAction().

◆ SetFromProjectile()

override void Ammunition_Base::SetFromProjectile ( ProjectileStoppedInfo info)
inlineprotected

Definition at line 55 of file AmmunitionPiles.c.

56 {
57 float dmgPerUse = GetGame().ConfigGetFloat("cfgAmmo " + info.GetAmmoType() + " dmgPerUse");
58 float totalDmg = info.GetProjectileDamage() + dmgPerUse;
59 float health = Math.Max(1 - totalDmg, 0);
60
62 SetHealth01("", "", health);
63
64 // SetCartridgeDamageAtIndex() MUST be called AFTER SetHealth01()!!
65 // otherwise, decreasing health by less than an entire health level get ignored
67 }
override void SetQuantityToMinimum()
Definition EnMath.c:7
static proto float Max(float x, float y)
Returns bigger of two given values.

References GetGame(), Math::Max(), and SetQuantityToMinimum().

◆ SetQuantityToMinimum()

override void Ammunition_Base::SetQuantityToMinimum ( )
inlineprotected

Definition at line 50 of file AmmunitionPiles.c.

51 {
53 }

Referenced by SetFromProjectile().

Member Data Documentation

◆ m_AmmoWeightByBulletType

ref map<string, float> Ammunition_Base::m_AmmoWeightByBulletType = new map<string, float>()
staticprivate

Definition at line 4 of file AmmunitionPiles.c.

Referenced by GetAmmoWeightByBulletType().


The documentation for this class was generated from the following file: