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);
104 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, error - cannot take cartridge from magazine");
108 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, error - no magazine to load from (m_srcMagazine=NULL)");
115 int mi =
m_weapon.GetCurrentMuzzle();
117 string magazineTypeName;
119 if (m_magazineType.Length() > 0)
120 magazineTypeName = m_magazineType;
122 magazineTypeName =
m_weapon.GetChamberAmmoTypeName(mi);
131 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, error - cannot abort removal from wpn (of old mag)");
137 m_magazineType =
string.Empty;
138 m_type =
string.Empty;
144 int mi =
m_weapon.GetCurrentMuzzle();
147 if (
m_weapon.PushCartridgeToChamber(mi, m_damage, m_type))
154 m_magazineType =
string.Empty;
155 m_type =
string.Empty;
167 int mi =
m_weapon.GetCurrentMuzzle();
170 m_weapon.PopCartridgeFromChamber(mi, ammoDamage, ammoTypeName);
171 if (
m_weapon.PushCartridgeToInternalMagazine(mi, ammoDamage, ammoTypeName))
204 int muzzle =
m_weapon.GetCurrentMuzzle();
206 if (!
m_weapon.IsChamberFull(muzzle))
208 if (
m_weapon.PushCartridgeToChamber(muzzle, m_damage, m_type))
210 Magnum_Cylinder cylinder = Magnum_Cylinder.Cast(
m_weapon.GetAttachmentByType(Magnum_Cylinder));
214 string bullet =
"bullet";
215 string bullet_nose =
"bullet_nose";
219 bullet =
string.
Format(
"bullet_" + ( muzzle + 1 ));
220 bullet_nose =
string.
Format(
"bullet_nose_" + ( muzzle + 1 ));
222 cylinder.ShowSelection(bullet);
223 cylinder.ShowSelection(bullet_nose);
229 m_type =
string.Empty;
250 for(
int i = 0; i <
m_weapon.GetMuzzleCount(); i++ )
255 m_weapon.EffectBulletShow(i, m_damage, m_type);
263 for(
int i = 0; i <
m_weapon.GetMuzzleCount(); i++ )
267 if (
m_weapon.PushCartridgeToChamber(i, m_damage, m_type))
273 m_type =
string.Empty;
282class WeaponChambering_MultiMuzzle_W4T
extends WeaponChambering_MultiMuzzle
304 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, error - cannot take cartridge from magazine");
308 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, error - no magazine to load from (m_srcMagazine=NULL)");
318 int mi =
m_weapon.GetCurrentMuzzle();
319 string magazineTypeName;
321 if (m_magazineType.Length() > 0)
322 magazineTypeName = m_magazineType;
324 magazineTypeName =
m_weapon.GetChamberAmmoTypeName(mi);
333 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, error - cannot abort removal from wpn (of old mag)");
339 m_magazineType =
string.Empty;
340 m_type =
string.Empty;
348 int mi =
m_weapon.GetCurrentMuzzle();
349 if (!
m_weapon.IsInternalMagazineFull(mi))
351 if (
m_weapon.PushCartridgeToInternalMagazine(mi, m_damage, m_type))
358 m_magazineType =
string.Empty;
378 ref WeaponChambering_W4T
m_w4t;
379 ref WeaponCharging_CK
m_onCK;
384 m_actionType = actionType;
389 m_w4t =
new WeaponChambering_W4T(
m_weapon,
this);
391 m_onCK =
new WeaponCharging_CK(
m_weapon,
this);
394 WeaponEventAnimBulletInChamber __bc_ =
new WeaponEventAnimBulletInChamber;
395 WeaponEventAnimBulletShow __bs_ =
new WeaponEventAnimBulletShow;
396 WeaponEventAnimBulletEject __be_ =
new WeaponEventAnimBulletEject;
397 WeaponEventAnimCocked __ck_ =
new WeaponEventAnimCocked;
414 m_fsm.SetInitialState(
m_start);
425 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
437 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from inv");
462 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
492 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
502 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from wpn - abort");
522 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
552 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
562 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from wpn - exit");
576 if (!super.SaveCurrentFSMState(ctx))
581 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
587 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
595 if (!super.LoadCurrentFSMState(ctx, version))
600 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
606 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
636 ref LoopedChambering_Wait4ShowBullet2
m_w4sb2;
659 WeaponEventContinuousLoadBulletStart __lS_ =
new WeaponEventContinuousLoadBulletStart;
660 WeaponEventContinuousLoadBulletEnd __lE_ =
new WeaponEventContinuousLoadBulletEnd;
661 WeaponEventAnimBulletShow __bs_ =
new WeaponEventAnimBulletShow;
662 WeaponEventAnimBulletShow2 _bs2_ =
new WeaponEventAnimBulletShow2;
663 WeaponEventAnimBulletHide __bh_ =
new WeaponEventAnimBulletHide;
664 WeaponEventAnimBulletEject __be_ =
new WeaponEventAnimBulletEject;
665 WeaponEventAnimBulletInChamber __bc_ =
new WeaponEventAnimBulletInChamber;
673 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())));
685 m_fsm.SetInitialState(
m_start);
696 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
708 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from inv");
732 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
762 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
772 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from wpn - exit");
791 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
821 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
831 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from wpn - abort");
845 if (!super.SaveCurrentFSMState(ctx))
850 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
856 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
864 if (!super.LoadCurrentFSMState(ctx, version))
869 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
875 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
888 nextMuzzle = currentMuzzle;
889 int nMuzzles =
m_weapon.GetMuzzleCount();
891 for (
int i = 0; i < nMuzzles; ++i)
894 nextMuzzle =
Math.
WrapInt(nextMuzzle, 0, nMuzzles);
895 if (
m_weapon.IsChamberEmpty(nextMuzzle))
908 magnum.SetCylinderRotationAnimationPhase(magnum.GetCylinderRotation(nextMuzzle));
909 m_weapon.SetCurrentMuzzle(nextMuzzle);
937 ref LoopedChambering_Wait4ShowBullet2
m_w4sb2;
950 m_rotate =
new WeaponCylinderRotate(
m_weapon,
this);
953 m_hideB =
new BulletHide_W4T(
m_weapon,
this);
957 WeaponEventContinuousLoadBulletStart __lS_ =
new WeaponEventContinuousLoadBulletStart;
958 WeaponEventContinuousLoadBulletEnd __lE_ =
new WeaponEventContinuousLoadBulletEnd;
959 WeaponEventCylinderRotate __cr_ =
new WeaponEventCylinderRotate;
960 WeaponEventAnimBulletShow __bs_ =
new WeaponEventAnimBulletShow;
961 WeaponEventAnimBulletHide __bh_ =
new WeaponEventAnimBulletHide;
962 WeaponEventAnimBulletEject __be_ =
new WeaponEventAnimBulletEject;
963 WeaponEventAnimBulletInMagazine __bM_ =
new WeaponEventAnimBulletInMagazine;
964 WeaponEventAnimBulletShow2 _bs2_ =
new WeaponEventAnimBulletShow2;
976 m_fsm.AddTransition(
new WeaponTransition(
m_chamber, __bM_,
m_w4sb2, null,
new GuardAnd(
new GuardAnd(
new WeaponGuardHasAmmoInLoopedState(
m_chamber),
new WeaponGuardChamberMultiHasRoomBulltetIgnoreLast(
m_weapon)),
new WeaponGuardWeaponManagerWantContinue())));
991 m_fsm.SetInitialState(
m_start);
1003 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
1015 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot remove ammo pile from inv");
1021 Print(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering m_srcMagazine = NULL");
1040 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
1070 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
1080 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot remove ammo pile from wpn - exit");
1100 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
1130 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" LoopedChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
1140 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" LoopedChambering, error - cannot remove ammo pile from wpn - abort");
1154 if (!super.SaveCurrentFSMState(ctx))
1159 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
1165 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
1174 if (!super.LoadCurrentFSMState(ctx, version))
1179 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
1185 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
void wpnDebugPrint(string s)
private void DayZPlayerUtils()
cannot be instantiated
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
HandStateEquipped OnEntry
FindInventoryLocationType
flags for searching locations in inventory
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
enum FSMTransition WeaponTransition
void ChamberMultiBullet(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int startActionType=-1, int endActionType=-1)
ref LoopedChambering_Wait4ShowBullet2 m_w4sb2
ref BulletShow2_W4T m_showB2
class WeaponChambering_Cartridge_InnerMag extends WeaponChambering_Base IsWaitingForActionFinish
ref InventoryLocation m_srcMagazinePrevLocation
source of the cartridge
ref WeaponEndAction m_endLoop
ref WeaponStateBase m_start
class WeaponEndAction extends WeaponStartAction m_action
ref WeaponChambering_Base m_chamber
ref WeaponChambering_Base m_chamber_end
ref WeaponEjectCasingMultiMuzzle m_eject
ref BulletShow_W4T m_showB
script counterpart to engine's class Inventory
static proto native bool LocationCanMoveEntity(notnull InventoryLocation src, notnull InventoryLocation dst)
queries if the entity contained in inv_loc.m_item can be moved to another location This is a shorthan...
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
synchronously removes item from current inventory location and adds it to destination no anims involv...
override void OnEntry(HandEventBase e)
proto native vector GetPos()
returns position of item in world if type is Ground
proto native bool IsValid()
verify current set inventory location
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
sets current inventory location type to Attachment with slot id set to <slotId>
provides access to slot configuration
static bool IsWeaponLogEnable()
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
override void OnEntry(WeaponEventBase e)
override void OnAbort(WeaponEventBase e)
override void OnExit(WeaponEventBase e)
override void OnEntry(WeaponEventBase e)
override void OnExit(WeaponEventBase e)
override bool IsWaitingForActionFinish()
signalize mechanism manipulation
weapon finite state machine
const float MAX_DROP_MAGAZINE_DISTANCE_SQ
simple class starting animation action specified by m_action and m_actionType
override void OnEntry(WeaponEventBase e)
override bool IsWaitingForActionFinish()
represent weapon state base
void WeaponEjectAllMuzzles(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
ref WeaponEjectCasing m_eject
ref WeaponCharging_CK m_onCK
ref LoopedChambering_Wait4ShowBullet2 m_w4sb2
ref WeaponStateBase m_start
source of the cartridge
Magazine m_srcMagazine
destination of the ejected cartridge
ref WeaponEjectAllMuzzles m_eject
ref InventoryLocation m_srcMagazinePrevLocation
source of the cartridge
override void OnEntry(WeaponEventBase e)
override bool IsWaitingForActionFinish()
waiting for active animation action/actionType finish
ref WeaponChambering_W4T m_w4t
bool FindNextFreeMuzzle(int currentMuzzle, out int nextMuzzle)
override void OnAbort(WeaponEventBase e)
override void OnExit(WeaponEventBase e)
override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
ref WeaponChambering_Base m_chamber
ref BulletHide_W4T m_hideB
int m_actionType
action to be played
ref WeaponStartAction m_endLoop
void WeaponMagnumChambering(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int startActionType=-1, int endActionType=-1)
void WeaponChambering(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int actionType=-1)
ref WeaponCylinderRotate m_rotate
ref WeaponChambering_Cartridge m_chamber
override bool SaveCurrentFSMState(ParamsWriteContext ctx)
source of the cartridge
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
proto void Print(void var)
Prints content of variable to console/log.
static proto int WrapInt(int i, int min, int max)
Returns wrap number to specified interval [min, max[.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.