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);
106 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, error - cannot take cartridge from magazine");
109 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge, error - no magazine to load from (m_srcMagazine=NULL)");
119 if (m_magazineType.Length() > 0)
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;
147 if (
m_weapon.PushCartridgeToChamber(
mi, m_damage, m_type))
154 m_magazineType =
string.Empty;
155 m_type =
string.Empty;
229 m_type =
string.Empty;
248 for (
int i = 0;
i <
m_weapon.GetMuzzleCount();
i++)
253 m_weapon.EffectBulletShow(
i, m_damage, m_type);
261 for (
int i = 0;
i <
m_weapon.GetMuzzleCount();
i++)
265 if (
m_weapon.PushCartridgeToChamber(
i, m_damage, m_type))
270 m_type =
string.Empty;
301 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, error - cannot take cartridge from magazine");
304 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, error - no magazine to load from (m_srcMagazine=NULL)");
316 if (m_magazineType.Length() > 0)
328 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering_Cartridge_InnerMag, error - cannot abort removal from wpn (of old mag)");
334 m_magazineType =
string.Empty;
335 m_type =
string.Empty;
346 if (
m_weapon.PushCartridgeToInternalMagazine(
mi, m_damage, m_type))
352 m_magazineType =
string.Empty;
388 WeaponEventAnimBulletInChamber
__bc_ =
new WeaponEventAnimBulletInChamber;
389 WeaponEventAnimBulletShow
__bs_ =
new WeaponEventAnimBulletShow;
390 WeaponEventAnimBulletEject
__be_ =
new WeaponEventAnimBulletEject;
391 WeaponEventAnimCocked
__ck_ =
new WeaponEventAnimCocked;
408 m_fsm.SetInitialState(
m_start);
431 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from inv");
479 if (!
il || !
il.IsValid())
486 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
496 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from wpn - abort");
539 if (!
il || !
il.IsValid())
546 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
556 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering, error - cannot remove ammo pile from wpn - exit");
570 if (!
super.SaveCurrentFSMState(
ctx))
575 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
581 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
589 if (!
super.LoadCurrentFSMState(
ctx, version))
594 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
600 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
653 WeaponEventContinuousLoadBulletStart
__lS_ =
new WeaponEventContinuousLoadBulletStart;
654 WeaponEventContinuousLoadBulletEnd
__lE_ =
new WeaponEventContinuousLoadBulletEnd;
655 WeaponEventAnimBulletShow
__bs_ =
new WeaponEventAnimBulletShow;
656 WeaponEventAnimBulletShow2
_bs2_ =
new WeaponEventAnimBulletShow2;
657 WeaponEventAnimBulletHide
__bh_ =
new WeaponEventAnimBulletHide;
658 WeaponEventAnimBulletEject
__be_ =
new WeaponEventAnimBulletEject;
659 WeaponEventAnimBulletInChamber
__bc_ =
new WeaponEventAnimBulletInChamber;
679 m_fsm.SetInitialState(
m_start);
702 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from inv");
749 if (!
il || !
il.IsValid())
756 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
766 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from wpn - exit");
808 if (!
il || !
il.IsValid())
815 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
825 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet, error - cannot remove ammo pile from wpn - abort");
839 if (!
super.SaveCurrentFSMState(
ctx))
844 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
850 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
858 if (!
super.LoadCurrentFSMState(
ctx, version))
863 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
869 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
949 WeaponEventContinuousLoadBulletStart
__lS_ =
new WeaponEventContinuousLoadBulletStart;
950 WeaponEventContinuousLoadBulletEnd
__lE_ =
new WeaponEventContinuousLoadBulletEnd;
951 WeaponEventCylinderRotate
__cr_ =
new WeaponEventCylinderRotate;
952 WeaponEventAnimBulletShow
__bs_ =
new WeaponEventAnimBulletShow;
953 WeaponEventAnimBulletHide
__bh_ =
new WeaponEventAnimBulletHide;
954 WeaponEventAnimBulletEject
__be_ =
new WeaponEventAnimBulletEject;
955 WeaponEventAnimBulletInMagazine
__bM_ =
new WeaponEventAnimBulletInMagazine;
956 WeaponEventAnimBulletShow2
_bs2_ =
new WeaponEventAnimBulletShow2;
983 m_fsm.SetInitialState(
m_start);
1007 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot remove ammo pile from inv");
1012 Print(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering m_srcMagazine = NULL");
1051 if (!
il || !
il.IsValid())
1058 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - exit");
1068 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering, error - cannot remove ammo pile from wpn - exit");
1111 if (!
il || !
il.IsValid())
1118 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" LoopedChambering, error - cannot drop ammo pile from left hand after not found inventory space for ammo pile - abort");
1128 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" LoopedChambering, error - cannot remove ammo pile from wpn - abort");
1142 if (!
super.SaveCurrentFSMState(
ctx))
1147 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" +
m_weapon);
1153 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" +
m_weapon);
1162 if (!
super.LoadCurrentFSMState(
ctx, version))
1167 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" +
m_weapon);
1173 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" +
m_weapon);
void wpnDebugPrint(string s)
void DayZPlayerUtils()
cannot be instantiated
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
override void OnExit(HandEventBase e)
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 LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
synchronously removes item from current inventory location and adds it to destination no anims involv...
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...
provides access to slot configuration
static bool IsWeaponLogEnable()
Serialization general interface. Serializer API works with:
override void OnEntry(WeaponEventBase e)
override void OnExit(WeaponEventBase e)
override bool IsWaitingForActionFinish()
override void OnAbort(WeaponEventBase e)
override void OnExit(WeaponEventBase e)
override void OnEntry(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
ref BulletHide_W4T m_hideB
ref WeaponCylinderRotate m_rotate
int m_actionType
action to be played
ref WeaponChambering_W4T m_w4t
ref WeaponStartAction m_endLoop
void WeaponEjectCasingMultiMuzzle(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
override bool IsWaitingForActionFinish()
waiting for active animation action/actionType finish
Magazine m_srcMagazine
destination of the ejected cartridge
ref LoopedChambering_Wait4ShowBullet2 m_w4sb2
bool FindNextFreeMuzzle(int currentMuzzle, out int nextMuzzle)
ref WeaponEjectAllMuzzles m_eject
void WeaponChambering(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int actionType=-1)
ref WeaponChambering_Cartridge m_chamber
override void OnEntry(WeaponEventBase e)
ref WeaponCharging_CK m_onCK
ref WeaponStateBase m_start
source of the cartridge
override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
void WeaponMagnumChambering(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int startActionType=-1, int endActionType=-1)
ref WeaponEjectCasing m_eject
ref WeaponChambering_Base m_chamber
ref InventoryLocation m_srcMagazinePrevLocation
source of the cartridge
void WeaponEjectAllMuzzles(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
override void OnAbort(WeaponEventBase e)
void WeaponEjectCasing(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
override void OnExit(WeaponEventBase e)
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[.