302 int mi =
m_weapon.GetCurrentMuzzle();
303 if(AcquireCartridgeFromMagazine())
305 if(!PushBulletToChamber(mi))
313 m_magazineType =
string.Empty;
314 m_type =
string.Empty;
328 int mi =
m_weapon.GetCurrentMuzzle();
329 if(PushBulletFromChamberToInternalMagazine(mi))
331 if(AcquireCartridgeFromMagazine())
333 if(!PushBulletToChamber(mi))
341 m_magazineType =
string.Empty;
342 m_type =
string.Empty;
355 int mi =
m_weapon.GetCurrentMuzzle();
356 if(AcquireCartridgeFromMagazine())
361 m_magazineType =
string.Empty;
362 m_type =
string.Empty;
369 int mi =
m_weapon.GetCurrentMuzzle();
371 if(AcquireCartridgeFromMagazine())
373 if(PushBulletToChamber(mi))
375 Magnum_Cylinder cylinder = Magnum_Cylinder.Cast(
m_weapon.GetAttachmentByType(Magnum_Cylinder));
379 string bullet =
"bullet";
380 string bullet_nose =
"bullet_nose";
384 bullet =
string.Format(
"bullet_" + ( mi + 1 ));
385 bullet_nose =
string.Format(
"bullet_nose_" + ( mi + 1 ));
387 cylinder.ShowSelection(bullet);
388 cylinder.ShowSelection(bullet_nose);
397 m_magazineType =
string.Empty;
398 m_type =
string.Empty;
413 for(
int i = 0; i <
m_weapon.GetMuzzleCount(); i++ )
428 int mi =
m_weapon.GetCurrentMuzzle();
429 if(AcquireCartridgeFromMagazine())
435 m_magazineType =
string.Empty;
436 m_type =
string.Empty;
443 for(
int i = 0; i <
m_weapon.GetMuzzleCount(); i++ )
447 if(AcquireCartridgeFromMagazine())
449 if (
m_weapon.PushCartridgeToChamber(i, m_damage, m_type))
459 m_type =
string.Empty;
479 int mi =
m_weapon.GetCurrentMuzzle();
480 if(AcquireCartridgeFromMagazine())
482 if(!PushBulletToInternalMagazine(mi))
489 m_magazineType =
string.Empty;
490 m_type =
string.Empty;
501 int mi =
m_weapon.GetCurrentMuzzle();
502 if(AcquireCartridgeFromMagazine())
504 if(!PushBulletToChamber(mi))
511 m_magazineType =
string.Empty;
512 m_type =
string.Empty;
523 int mi =
m_weapon.GetCurrentMuzzle();
524 if(AcquireCartridgeFromMagazine())
526 if(!PushBulletToInternalMagazine(mi))
533 m_magazineType =
string.Empty;
534 m_type =
string.Empty;
552 ref WeaponChambering_Cartridge
m_chamber;
553 ref WeaponChambering_W4T m_w4t;
554 ref WeaponCharging_CK m_onCK;
556 void WeaponChambering (
Weapon_Base w = NULL,
WeaponStateBase parent = NULL, WeaponActions action = WeaponActions.NONE,
int actionType = -1)
559 m_actionType = actionType;
564 m_w4t =
new WeaponChambering_W4T(
m_weapon,
this);
566 m_onCK =
new WeaponCharging_CK(
m_weapon,
this);
569 WeaponEventAnimBulletInChamber __bc_ =
new WeaponEventAnimBulletInChamber;
570 WeaponEventAnimBulletShow __bs_ =
new WeaponEventAnimBulletShow;
571 WeaponEventAnimBulletEject __be_ =
new WeaponEventAnimBulletEject;
572 WeaponEventAnimCocked __ck_ =
new WeaponEventAnimCocked;
589 m_fsm.SetInitialState(
m_start);
600 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
612 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from inv");
637 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
638 if (leftHandIl.IsValid())
648 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort"); }
660 if(!il || !il.IsValid())
662 if (DayZPlayerUtils.HandleDropMagazine(e.m_player,
m_srcMagazine))
664 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - no inventory space for ammo pile - dropped to ground - abort"); }
667 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
674 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - ammo pile removed from left hand (LHand->inv) - abort"); }
677 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from wpn - abort");
697 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
698 if (leftHandIl.IsValid())
708 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - exit"); }
720 if(!il || !il.IsValid())
722 if (DayZPlayerUtils.HandleDropMagazine(e.m_player,
m_srcMagazine))
724 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, ok - no inventory space for ammo pile - dropped to ground - exit"); }
727 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
737 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from wpn - exit");
751 if (!super.SaveCurrentFSMState(ctx))
756 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
762 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
770 if (!super.LoadCurrentFSMState(ctx, version))
775 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
781 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
810 ref LoopedChambering_Wait4ShowBullet2
m_w4sb2;
832 WeaponEventContinuousLoadBulletStart __lS_ =
new WeaponEventContinuousLoadBulletStart;
833 WeaponEventContinuousLoadBulletEnd __lE_ =
new WeaponEventContinuousLoadBulletEnd;
834 WeaponEventAnimBulletShow __bs_ =
new WeaponEventAnimBulletShow;
835 WeaponEventAnimBulletShow2 _bs2_ =
new WeaponEventAnimBulletShow2;
836 WeaponEventAnimBulletHide __bh_ =
new WeaponEventAnimBulletHide;
837 WeaponEventAnimBulletEject __be_ =
new WeaponEventAnimBulletEject;
838 WeaponEventAnimBulletInChamber __bc_ =
new WeaponEventAnimBulletInChamber;
846 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())));
858 m_fsm.SetInitialState(
m_start);
869 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
881 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from inv");
905 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
906 if (leftHandIl.IsValid())
916 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - ammo pile removed from left hand to previous location (LHand->inv) - exit"); }
928 if(!il || !il.IsValid())
930 if (DayZPlayerUtils.HandleDropMagazine(e.m_player,
m_srcMagazine))
932 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - no inventory space for ammo pile - dropped to ground - exit"); }
935 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
942 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - ammo pile removed from left hand (LHand->inv) - exit"); }
945 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from wpn - exit");
964 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
965 if (leftHandIl.IsValid())
975 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort"); }
987 if(!il || !il.IsValid())
989 if (DayZPlayerUtils.HandleDropMagazine(e.m_player,
m_srcMagazine))
991 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - no inventory space for ammo pile - dropped to ground - abort"); }
994 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
1001 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, ok - ammo pile removed from left hand (LHand->inv) - abort"); }
1004 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from wpn - abort");
1018 if (!super.SaveCurrentFSMState(ctx))
1023 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
1029 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
1037 if (!super.LoadCurrentFSMState(ctx, version))
1042 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
1048 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
1059 bool FindNextFreeMuzzle(
int currentMuzzle, out
int nextMuzzle)
1061 nextMuzzle = currentMuzzle;
1062 int nMuzzles =
m_weapon.GetMuzzleCount();
1064 for (
int i = 0; i < nMuzzles; ++i)
1067 nextMuzzle =
Math.WrapInt(nextMuzzle, 0, nMuzzles);
1068 if (
m_weapon.IsChamberEmpty(nextMuzzle))
1078 if (FindNextFreeMuzzle(
m_weapon.GetCurrentMuzzle(), nextMuzzle))
1081 magnum.SetCylinderRotationAnimationPhase(magnum.GetCylinderRotation(nextMuzzle));
1082 m_weapon.SetCurrentMuzzle(nextMuzzle);
1108 ref WeaponCylinderRotate m_rotate;
1110 ref LoopedChambering_Wait4ShowBullet2
m_w4sb2;
1112 ref BulletHide_W4T m_hideB;
1114 void WeaponMagnumChambering(
Weapon_Base w = NULL,
WeaponStateBase parent = NULL, WeaponActions action = WeaponActions.NONE,
int startActionType = -1,
int endActionType = -1)
1123 m_rotate =
new WeaponCylinderRotate(
m_weapon,
this);
1126 m_hideB =
new BulletHide_W4T(
m_weapon,
this);
1130 WeaponEventContinuousLoadBulletStart __lS_ =
new WeaponEventContinuousLoadBulletStart;
1131 WeaponEventContinuousLoadBulletEnd __lE_ =
new WeaponEventContinuousLoadBulletEnd;
1132 WeaponEventCylinderRotate __cr_ =
new WeaponEventCylinderRotate;
1133 WeaponEventAnimBulletShow __bs_ =
new WeaponEventAnimBulletShow;
1134 WeaponEventAnimBulletHide __bh_ =
new WeaponEventAnimBulletHide;
1135 WeaponEventAnimBulletEject __be_ =
new WeaponEventAnimBulletEject;
1136 WeaponEventAnimBulletInMagazine __bM_ =
new WeaponEventAnimBulletInMagazine;
1137 WeaponEventAnimBulletShow2 _bs2_ =
new WeaponEventAnimBulletShow2;
1149 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())));
1164 m_fsm.SetInitialState(
m_start);
1176 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
1188 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot remove ammo pile from inv");
1194 Print(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering m_srcMagazine = NULL");
1213 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
1214 if (leftHandIl.IsValid())
1224 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - exit"); }
1236 if (!il || !il.IsValid())
1238 if (DayZPlayerUtils.HandleDropMagazine(e.m_player,
m_srcMagazine))
1240 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - no inventory space for ammo pile - dropped to ground - exit"); }
1243 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
1250 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - ammo pile removed from left hand (LHand->inv) - exit"); }
1253 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot remove ammo pile from wpn - exit");
1273 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
1274 if (leftHandIl.IsValid())
1284 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort"); }
1296 if (!il || !il.IsValid())
1298 if (DayZPlayerUtils.HandleDropMagazine(e.m_player,
m_srcMagazine))
1300 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - no inventory space for ammo pile - dropped to ground - abort"); }
1303 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" LoopedChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
1310 if (
LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, ok - ammo pile removed from left hand (LHand->inv) - abort"); }
1313 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" LoopedChambering, error - cannot remove ammo pile from wpn - abort");
1327 if (!super.SaveCurrentFSMState(ctx))
1332 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
1338 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
1347 if (!super.LoadCurrentFSMState(ctx, version))
1352 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
1358 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);