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

Private Member Functions

override bool IsWaitingForActionFinish ()
 
override void OnEntry (WeaponEventBase e)
 
override void OnAbort (WeaponEventBase e)
 
override void OnExit (WeaponEventBase e)
 
override void OnEntry (WeaponEventBase e)
 
override void OnAbort (WeaponEventBase e)
 
override void OnExit (WeaponEventBase e)
 

Detailed Description

Definition at line 85 of file WeaponChambering.c.

Member Function Documentation

◆ IsWaitingForActionFinish()

override bool WeaponChambering_Base::IsWaitingForActionFinish ( )
inlineprivate

Definition at line 87 of file WeaponChambering.c.

87{ return true; }

◆ OnAbort() [1/2]

override void WeaponChambering_Base::OnAbort ( WeaponEventBase e)
inlineprivate

Definition at line 113 of file WeaponChambering.c.

114 {
115 int mi = m_weapon.GetCurrentMuzzle();
116
117 string magazineTypeName;
118
119 if (m_magazineType.Length() > 0)
120 magazineTypeName = m_magazineType;
121 else
122 magazineTypeName = m_weapon.GetChamberAmmoTypeName(mi);
123
124 if (GetGame().IsServer())
125 {
126 if (DayZPlayerUtils.HandleDropCartridge(e.m_player, m_damage, m_type, magazineTypeName))
127 {
128 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, ok - aborting, chambering cartridge dropped to ground");
129 }
130 else
131 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - cannot abort removal from wpn (of old mag)");
132 }
133
134 m_weapon.EffectBulletHide(mi);
135 m_weapon.SelectionBulletHide(); // force hide on abort
136
137 m_magazineType = string.Empty;
138 m_type = string.Empty;
139 super.OnAbort(e);
140 }
void wpnDebugPrint(string s)
Definition Debug.c:9
void DayZPlayerUtils()
cannot be instantiated
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition Guards.c:602
static bool IsWeaponLogEnable()
Definition Debug.c:799
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

References DayZPlayerUtils(), Error(), GetGame(), LogManager::IsWeaponLogEnable(), m_weapon, and wpnDebugPrint().

◆ OnAbort() [2/2]

override void WeaponChambering_Base::OnAbort ( WeaponEventBase e)
inlineprivate

Definition at line 311 of file WeaponChambering.c.

312 {
313 int mi = m_weapon.GetCurrentMuzzle();
314 string magazineTypeName;
315
316 if (m_magazineType.Length() > 0)
317 magazineTypeName = m_magazineType;
318 else
319 magazineTypeName = m_weapon.GetChamberAmmoTypeName(mi);
320
321 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
322 {
323 if (DayZPlayerUtils.HandleDropCartridge(e.m_player, m_damage, m_type, magazineTypeName))
324 {
325 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, ok - aborting, chambering cartridge dropped to ground");
326 }
327 else
328 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, error - cannot abort removal from wpn (of old mag)");
329 }
330
331 m_weapon.SelectionBulletHide(); // force hide on abort
332 m_weapon.EffectBulletHide(m_weapon.GetCurrentMuzzle());
333
334 m_magazineType = string.Empty;
335 m_type = string.Empty;
336 super.OnAbort(e);
337 }

References DayZPlayerUtils(), Error(), GetGame(), LogManager::IsWeaponLogEnable(), m_weapon, and wpnDebugPrint().

◆ OnEntry() [1/2]

override void WeaponChambering_Base::OnEntry ( WeaponEventBase e)
inlineprivate

Definition at line 88 of file WeaponChambering.c.

89 {
90 super.OnEntry(e);
91 if (e)
92 {
93 if (m_srcMagazine)
94 {
95 m_magazineType = m_srcMagazine.GetType();
96
97 if (m_srcMagazine.ServerAcquireCartridge(m_damage, m_type))
98 {
99 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, ok - cartridge acquired: dmg=" + m_damage + " type=" + m_type);
100 m_weapon.SelectionBulletShow();
101 m_weapon.ShowBullet(m_weapon.GetCurrentMuzzle());
102 m_weapon.EffectBulletShow(m_weapon.GetCurrentMuzzle(), m_damage, m_type);
103 m_weapon.SetWeaponOpen(false);
104 }
105 else
106 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - cannot take cartridge from magazine");
107 }
108 else
109 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - no magazine to load from (m_srcMagazine=NULL)");
110 }
111 }
Magazine m_srcMagazine

References Error(), LogManager::IsWeaponLogEnable(), m_srcMagazine, m_weapon, and wpnDebugPrint().

◆ OnEntry() [2/2]

override void WeaponChambering_Base::OnEntry ( WeaponEventBase e)
inlineprivate

Definition at line 287 of file WeaponChambering.c.

288 {
289 super.OnEntry(e);
290 if (e)
291 {
292 if (m_srcMagazine)
293 {
294 m_magazineType = m_srcMagazine.GetType();
295
296 if (m_srcMagazine.ServerAcquireCartridge(m_damage, m_type))
297 {
298 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, ok - cartridge acquired: dmg=" + m_damage + " type=" + m_type);
299 }
300 else
301 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, error - cannot take cartridge from magazine");
302 }
303 else
304 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, error - no magazine to load from (m_srcMagazine=NULL)");
305
306 m_weapon.SelectionBulletShow();
307 m_weapon.EffectBulletShow(m_weapon.GetCurrentMuzzle(), m_damage, m_type);
308 }
309 }

References Error(), LogManager::IsWeaponLogEnable(), m_srcMagazine, m_weapon, and wpnDebugPrint().

◆ OnExit() [1/2]

override void WeaponChambering_Base::OnExit ( WeaponEventBase e)
inlineprivate

Definition at line 142 of file WeaponChambering.c.

143 {
144 int mi = m_weapon.GetCurrentMuzzle();
145 //if ( m_weapon.IsChamberFiredOut(mi) )
146 // m_weapon.EjectCasing(mi);
147 if (m_weapon.PushCartridgeToChamber(mi, m_damage, m_type))
148 {
149 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, ok - loaded chamber");
150 }
151 else if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - cannot load chamber chamber!");
152
153 m_weapon.SetCharged(true);
154 m_magazineType = string.Empty;
155 m_type = string.Empty;
156 super.OnExit(e);
157 }

References LogManager::IsWeaponLogEnable(), m_weapon, and wpnDebugPrint().

◆ OnExit() [2/2]

override void WeaponChambering_Base::OnExit ( WeaponEventBase e)
inlineprivate

Definition at line 339 of file WeaponChambering.c.

340 {
341 float ammoDamage;
342 string ammoTypeName;
343 int mi = m_weapon.GetCurrentMuzzle();
344 if (!m_weapon.IsInternalMagazineFull(mi))
345 {
346 if (m_weapon.PushCartridgeToInternalMagazine(mi, m_damage, m_type))
347 {
348 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, ok - loaded chamber");
349 }
350 else if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, error - cannot load chamber chamber!");
351 }
352 m_magazineType = string.Empty;
353 super.OnExit(e);
354 }

References LogManager::IsWeaponLogEnable(), m_weapon, and wpnDebugPrint().


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