Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл weapon_utils.c

См. исходные тексты.

Функции

bool pushToChamberFromAttachedMagazine (Weapon_Base weapon, int muzzleIndex)
 
bool pushToChamberFromInnerMagazine (Weapon_Base weapon, int muzzleIndex)
 
void ejectBulletAndStoreInMagazine (Weapon_Base weapon, int muzzleIndex, Magazine mag, DayZPlayer p)
 
bool magazinesHaveEqualSizes (notnull Magazine mag, notnull Magazine mag2)
 

Функции

◆ ejectBulletAndStoreInMagazine()

void ejectBulletAndStoreInMagazine ( Weapon_Base weapon,
int muzzleIndex,
Magazine mag,
DayZPlayer p )

no magazine configured in parent state, looking in inventory

59{
60 float damage = 0;
61 string type = string.Empty;
62 string magazineTypeName = weapon.GetChamberedCartridgeMagazineTypeName(muzzleIndex);
63 if (weapon.EjectCartridge(muzzleIndex, damage, type))
64 {
66 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " ejectBulletAndStoreInMagazine, ejected chambered cartridge");
67 }
68 else
69 Error("[wpnfsm] " + Object.GetDebugName(weapon) + " ejectBulletAndStoreInMagazine, error - cannot eject chambered cartridge!");
70
71 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
72 {
73 if (mag == null)
74 {
76 if (DayZPlayerUtils.HandleStoreCartridge(p, weapon, muzzleIndex, damage, type, magazineTypeName))
77 {
79 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " ejectBulletAndStoreInMagazine, ok - cartridge stored in magazine");
80 }
81 else
82 Error("[wpnfsm] " + Object.GetDebugName(weapon) + " ejectBulletAndStoreInMagazine, error - cannot store cartridge!");
83 }
84 else
85 {
86 if (mag.ServerStoreCartridge(damage, type))
87 {
88 mag.SetSynchDirty();
90 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " ejectBulletAndStoreInMagazine, ok - cartridge stored in user defined magazine");
91 }
92 else
93 Error("[wpnfsm] " + Object.GetDebugName(weapon) + " ejectBulletAndStoreInMagazine, error - cannot store cartridge in magazine");
94 }
95 }
96}
void wpnDebugPrint(string s)
Definition Debug.c:9
void DayZPlayerUtils()
cannot be instantiated
Definition DayZPlayerUtils.c:461
Definition Debug.c:735
static bool IsWeaponLogEnable()
Definition Debug.c:859
Definition ObjectTyped.c:2
Definition EntityAI.c:95
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки DayZPlayerUtils(), Error(), GetGame(), LogManager::IsWeaponLogEnable() и wpnDebugPrint().

Используется в WeaponStateBase::OnEntry().

◆ magazinesHaveEqualSizes()

bool magazinesHaveEqualSizes ( notnull Magazine mag,
notnull Magazine mag2 )
99{
100 int w, h;
101 GetGame().GetInventoryItemSize(mag, w, h);
102 int w2, h2;
103 GetGame().GetInventoryItemSize(mag2, w2, h2);
104 if (w == w2 && h == h2)
105 {
106 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] guard - same inventory sizes"); }
107 return true;
108 }
109
110 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] guard - different inventory sizes"); }
111 return false;
112}

Перекрестные ссылки GetGame(), LogManager::IsWeaponLogEnable() и wpnDebugPrint().

Используется в WeaponGuardBase::GuardCondition().

◆ pushToChamberFromAttachedMagazine()

bool pushToChamberFromAttachedMagazine ( Weapon_Base weapon,
int muzzleIndex )
2{
3 Magazine mag = weapon.GetMagazine(muzzleIndex);
4 if (mag && !mag.IsDamageDestroyed())
5 {
6 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromAttachedMagazine, using attached magazine mag=" + mag.ToString()); }
7 float damage;
8 string type;
9 if (mag && mag.LocalAcquireCartridge(damage, type))
10 {
11 weapon.SelectionBulletShow();
12 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromAttachedMagazine, ok - cartridge acquired: dmg=" + damage + " type=" + type); }
13 }
14 else
15 Error("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromAttachedMagazine, error - cannot take cartridge from magazine");
16
17 if (weapon.PushCartridgeToChamber(muzzleIndex, damage, type))
18 {
19 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromAttachedMagazine, ok - loaded chamber"); }
20 return true;
21 }
22 else
23 Error("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromAttachedMagazine, error - cannot load chamber!");
24 }
25 else
26 {
27 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromAttachedMagazine - magazine destroyer or no attached"); }
28 //Error("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromAttachedMagazine, error - no magazine attached");
29 }
30 return false;
31}

Перекрестные ссылки Error(), LogManager::IsWeaponLogEnable() и wpnDebugPrint().

Используется в WeaponEjectAllMuzzles::OnAbort(), WeaponStateBase::OnEntry(), WeaponEjectCasing::OnEntry(), WeaponFire::OnEntry(), WeaponStateBase::OnExit() и WeaponEjectAllMuzzles::OnExit().

◆ pushToChamberFromInnerMagazine()

bool pushToChamberFromInnerMagazine ( Weapon_Base weapon,
int muzzleIndex )
34{
35
36 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromInnerMagazine, using inner magazine."); }
37 float damage;
38 string type;
39 if (weapon.PopCartridgeFromInternalMagazine(muzzleIndex,damage, type))
40 {
41 weapon.SelectionBulletShow();
42 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromInnerMagazine, ok - cartridge acquired: dmg=" + damage + " type=" + type); }
43 }
44 else
45 Error("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromInnerMagazine, error - cannot take cartridge from magazine");
46
47 if (weapon.PushCartridgeToChamber(muzzleIndex, damage, type))
48 {
49 if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromInnerMagazine, ok - loaded chamber"); }
50 return true;
51 }
52 else
53 Error("[wpnfsm] " + Object.GetDebugName(weapon) + " chamberFromInnerMagazine, error - cannot load chamber!");
54
55 return false;
56}

Перекрестные ссылки Error(), LogManager::IsWeaponLogEnable() и wpnDebugPrint().

Используется в WeaponStateBase::OnEntry() и WeaponFire::OnEntry().