24 string m_magazineType;
29 if (!super.SaveCurrentFSMState(ctx))
32 if (!ctx.Write(m_damage))
34 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot write m_damage for weapon=" +
m_weapon);
37 if (!ctx.Write(m_type))
39 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot write m_type for weapon=" +
m_weapon);
42 if (!ctx.Write(m_magazineType))
44 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot write m_magazineType for weapon=" +
m_weapon);
49 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot write m_srcMagazine for weapon=" +
m_weapon);
57 if (!super.LoadCurrentFSMState(ctx, version))
60 if (!ctx.Read(m_damage))
62 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_damage for weapon=" +
m_weapon);
65 if (!ctx.Read(m_type))
67 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_type for weapon=" +
m_weapon);
70 if (!ctx.Read(m_magazineType))
72 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_magazineType for weapon=" +
m_weapon);
77 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
87 override bool IsWaitingForActionFinish () {
return true; }
99 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, ok - cartridge acquired: dmg=" + m_damage +
" type=" + m_type); }
106 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, error - cannot take cartridge from magazine");
110 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, error - no magazine to load from (m_srcMagazine=NULL)");
117 int mi =
m_weapon.GetCurrentMuzzle();
119 string magazineTypeName;
121 if (m_magazineType.Length() > 0)
122 magazineTypeName = m_magazineType;
124 magazineTypeName =
m_weapon.GetChamberAmmoTypeName(mi);
128 if (
DayZPlayerUtils.HandleDropCartridge(e.m_player, m_damage, m_type, magazineTypeName))
130 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, ok - aborting, chambering cartridge dropped to ground"); }
133 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, error - cannot abort removal from wpn (of old mag)");
139 m_magazineType =
string.Empty;
140 m_type =
string.Empty;
146 int mi =
m_weapon.GetCurrentMuzzle();
149 if (
m_weapon.PushCartridgeToChamber(mi, m_damage, m_type))
157 m_magazineType =
string.Empty;
158 m_type =
string.Empty;
170 int mi =
m_weapon.GetCurrentMuzzle();
173 m_weapon.PopCartridgeFromChamber(mi, ammoDamage, ammoTypeName);
174 if (
m_weapon.PushCartridgeToInternalMagazine(mi, ammoDamage, ammoTypeName))
209 int muzzle =
m_weapon.GetCurrentMuzzle();
211 if (!
m_weapon.IsChamberFull(muzzle))
213 if (
m_weapon.PushCartridgeToChamber(muzzle, m_damage, m_type))
215 Magnum_Cylinder cylinder = Magnum_Cylinder.Cast(
m_weapon.GetAttachmentByType(Magnum_Cylinder));
219 string bullet =
"bullet";
220 string bullet_nose =
"bullet_nose";
224 bullet =
string.Format(
"bullet_" + ( muzzle + 1 ));
225 bullet_nose =
string.Format(
"bullet_nose_" + ( muzzle + 1 ));
227 cylinder.ShowSelection(bullet);
228 cylinder.ShowSelection(bullet_nose);
234 m_type =
string.Empty;
255 for(
int i = 0; i <
m_weapon.GetMuzzleCount(); i++ )
260 m_weapon.EffectBulletShow(i, m_damage, m_type);
268 for(
int i = 0; i <
m_weapon.GetMuzzleCount(); i++ )
272 if (
m_weapon.PushCartridgeToChamber(i, m_damage, m_type))
278 m_type =
string.Empty;
287 class WeaponChambering_MultiMuzzle_W4T
extends WeaponChambering_MultiMuzzle
306 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, ok - cartridge acquired: dmg=" + m_damage +
" type=" + m_type); }
309 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, error - cannot take cartridge from magazine");
313 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, error - no magazine to load from (m_srcMagazine=NULL)");
323 int mi =
m_weapon.GetCurrentMuzzle();
324 string magazineTypeName;
326 if (m_magazineType.Length() > 0)
327 magazineTypeName = m_magazineType;
329 magazineTypeName =
m_weapon.GetChamberAmmoTypeName(mi);
333 if (
DayZPlayerUtils.HandleDropCartridge(e.m_player, m_damage, m_type, magazineTypeName))
335 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, ok - aborting, chambering cartridge dropped to ground"); }
338 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, error - cannot abort removal from wpn (of old mag)");
344 m_magazineType =
string.Empty;
345 m_type =
string.Empty;
353 int mi =
m_weapon.GetCurrentMuzzle();
354 if (!
m_weapon.IsInternalMagazineFull(mi))
356 if (
m_weapon.PushCartridgeToInternalMagazine(mi, m_damage, m_type))
363 m_magazineType =
string.Empty;
383 ref WeaponChambering_W4T m_w4t;
384 ref WeaponCharging_CK m_onCK;
389 m_actionType = actionType;
394 m_w4t =
new WeaponChambering_W4T(
m_weapon,
this);
396 m_onCK =
new WeaponCharging_CK(
m_weapon,
this);
399 WeaponEventAnimBulletInChamber __bc_ =
new WeaponEventAnimBulletInChamber;
400 WeaponEventAnimBulletShow __bs_ =
new WeaponEventAnimBulletShow;
401 WeaponEventAnimBulletEject __be_ =
new WeaponEventAnimBulletEject;
402 WeaponEventAnimCocked __ck_ =
new WeaponEventAnimCocked;
419 m_fsm.SetInitialState(
m_start);
430 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
442 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from inv");
467 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
468 if (leftHandIl.IsValid())
478 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort"); }
490 if(!il || !il.IsValid())
494 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - no inventory space for ammo pile - dropped to ground - abort"); }
497 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
504 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - ammo pile removed from left hand (LHand->inv) - abort"); }
507 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from wpn - abort");
527 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
528 if (leftHandIl.IsValid())
538 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - exit"); }
550 if(!il || !il.IsValid())
554 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - no inventory space for ammo pile - dropped to ground - exit"); }
557 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
567 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from wpn - exit");
581 if (!super.SaveCurrentFSMState(ctx))
586 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
592 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
600 if (!super.LoadCurrentFSMState(ctx, version))
605 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
611 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
641 ref LoopedChambering_Wait4ShowBullet2
m_w4sb2;
664 WeaponEventContinuousLoadBulletStart __lS_ =
new WeaponEventContinuousLoadBulletStart;
665 WeaponEventContinuousLoadBulletEnd __lE_ =
new WeaponEventContinuousLoadBulletEnd;
666 WeaponEventAnimBulletShow __bs_ =
new WeaponEventAnimBulletShow;
667 WeaponEventAnimBulletShow2 _bs2_ =
new WeaponEventAnimBulletShow2;
668 WeaponEventAnimBulletHide __bh_ =
new WeaponEventAnimBulletHide;
669 WeaponEventAnimBulletEject __be_ =
new WeaponEventAnimBulletEject;
670 WeaponEventAnimBulletInChamber __bc_ =
new WeaponEventAnimBulletInChamber;
678 m_fsm.AddTransition(
new WeaponTransition(
m_chamber, __bc_,
m_w4sb2, NULL,
new GuardAnd(
new GuardAnd(
new WeaponGuardHasAmmoInLoopedState(
m_chamber),
new WeaponGuardChamberMultiHasRoomBulltet(
m_weapon)),
new WeaponGuardWeaponManagerWantContinue())));
690 m_fsm.SetInitialState(
m_start);
701 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
713 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from inv");
737 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
738 if (leftHandIl.IsValid())
748 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - ammo pile removed from left hand to previous location (LHand->inv) - exit"); }
760 if(!il || !il.IsValid())
764 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - no inventory space for ammo pile - dropped to ground - exit"); }
767 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
774 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - ammo pile removed from left hand (LHand->inv) - exit"); }
777 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from wpn - exit");
796 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
797 if (leftHandIl.IsValid())
807 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort"); }
819 if(!il || !il.IsValid())
823 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - no inventory space for ammo pile - dropped to ground - abort"); }
826 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
833 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - ammo pile removed from left hand (LHand->inv) - abort"); }
836 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from wpn - abort");
850 if (!super.SaveCurrentFSMState(ctx))
855 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
861 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
869 if (!super.LoadCurrentFSMState(ctx, version))
874 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
880 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
891 bool FindNextFreeMuzzle(
int currentMuzzle, out
int nextMuzzle)
893 nextMuzzle = currentMuzzle;
894 int nMuzzles =
m_weapon.GetMuzzleCount();
896 for (
int i = 0; i < nMuzzles; ++i)
899 nextMuzzle =
Math.WrapInt(nextMuzzle, 0, nMuzzles);
900 if (
m_weapon.IsChamberEmpty(nextMuzzle))
910 if (FindNextFreeMuzzle(
m_weapon.GetCurrentMuzzle(), nextMuzzle))
913 magnum.SetCylinderRotationAnimationPhase(magnum.GetCylinderRotation(nextMuzzle));
914 m_weapon.SetCurrentMuzzle(nextMuzzle);
940 ref WeaponCylinderRotate m_rotate;
942 ref LoopedChambering_Wait4ShowBullet2
m_w4sb2;
944 ref BulletHide_W4T m_hideB;
955 m_rotate =
new WeaponCylinderRotate(
m_weapon,
this);
958 m_hideB =
new BulletHide_W4T(
m_weapon,
this);
962 WeaponEventContinuousLoadBulletStart __lS_ =
new WeaponEventContinuousLoadBulletStart;
963 WeaponEventContinuousLoadBulletEnd __lE_ =
new WeaponEventContinuousLoadBulletEnd;
964 WeaponEventCylinderRotate __cr_ =
new WeaponEventCylinderRotate;
965 WeaponEventAnimBulletShow __bs_ =
new WeaponEventAnimBulletShow;
966 WeaponEventAnimBulletHide __bh_ =
new WeaponEventAnimBulletHide;
967 WeaponEventAnimBulletEject __be_ =
new WeaponEventAnimBulletEject;
968 WeaponEventAnimBulletInMagazine __bM_ =
new WeaponEventAnimBulletInMagazine;
969 WeaponEventAnimBulletShow2 _bs2_ =
new WeaponEventAnimBulletShow2;
981 m_fsm.AddTransition(
new WeaponTransition(
m_chamber, __bM_,
m_w4sb2,
null,
new GuardAnd(
new GuardAnd(
new WeaponGuardHasAmmoInLoopedState(
m_chamber),
new WeaponGuardChamberMultiHasRoomBulltet(
m_weapon)),
new WeaponGuardWeaponManagerWantContinue())));
996 m_fsm.SetInitialState(
m_start);
1008 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
1020 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot remove ammo pile from inv");
1026 Print(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering m_srcMagazine = NULL");
1045 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
1046 if (leftHandIl.IsValid())
1056 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - exit"); }
1068 if (!il || !il.IsValid())
1072 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - no inventory space for ammo pile - dropped to ground - exit"); }
1075 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
1082 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - ammo pile removed from left hand (LHand->inv) - exit"); }
1085 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot remove ammo pile from wpn - exit");
1105 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
1106 if (leftHandIl.IsValid())
1116 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort"); }
1128 if (!il || !il.IsValid())
1132 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - no inventory space for ammo pile - dropped to ground - abort"); }
1135 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" LoopedChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
1142 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - ammo pile removed from left hand (LHand->inv) - abort"); }
1145 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" LoopedChambering, error - cannot remove ammo pile from wpn - abort");
1159 if (!super.SaveCurrentFSMState(ctx))
1164 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
1170 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
1179 if (!super.LoadCurrentFSMState(ctx, version))
1184 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
1190 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);