19 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store, error - no magazine to load from (m_magazine=NULL)");
35 if (
m_magazine.GetInventory().GetCurrentInventoryLocation(il))
45 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store, error - cannot store detached magazine!");
50 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store, error - cannot get curr location");
60 if (!super.SaveCurrentFSMState(ctx))
65 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store.SaveCurrentFSMState: cannot write m_magazine for weapon=" +
m_weapon);
71 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store.SaveCurrentFSMState: cannot write m_st for weapon=" +
m_weapon);
79 if (!super.LoadCurrentFSMState(ctx, version))
84 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store.LoadCurrentFSMState: cannot read m_magazine for weapon=" +
m_weapon);
89 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store.LoadCurrentFSMState: cannot read m_dst for weapon=" +
m_weapon);
96class WeaponDetachingMag_StoreRemoveChamberBullet
extends WeaponStateBase
99 ref InventoryLocation
m_dst;
111 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store, error - no magazine to load from (m_magazine=NULL)");
115 int mi =
m_weapon.GetCurrentMuzzle();
135 int mi =
m_weapon.GetCurrentMuzzle();
151 if (
m_magazine.GetInventory().GetCurrentInventoryLocation(il))
161 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store, error - cannot store detached magazine!");
166 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store, error - cannot get curr location");
176 if (!super.SaveCurrentFSMState(ctx))
181 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store.SaveCurrentFSMState: cannot write m_magazine for weapon=" +
m_weapon);
187 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store.SaveCurrentFSMState: cannot write m_st for weapon=" +
m_weapon);
195 if (!super.LoadCurrentFSMState(ctx, version))
200 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store.LoadCurrentFSMState: cannot read m_magazine for weapon=" +
m_weapon);
205 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store.LoadCurrentFSMState: cannot read m_dst for weapon=" +
m_weapon);
222 ref InventoryLocation
m_dst;
258 WeaponEventDetachMagazine de;
282 if (!super.SaveCurrentFSMState(ctx))
287 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag.SaveCurrentFSMState: cannot write m_magazine for weapon=" +
m_weapon);
293 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag.SaveCurrentFSMState: cannot write m_st for weapon=" +
m_weapon);
301 if (!super.LoadCurrentFSMState(ctx, version))
306 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag.LoadCurrentFSMState: cannot read m_magazine for weapon=" +
m_weapon);
311 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag.LoadCurrentFSMState: cannot read m_dst for weapon=" +
m_weapon);
323 ref InventoryLocation
m_dst;
326 ref WeaponDetachingMag_StoreRemoveChamberBullet
m_store;
336 m_store =
new WeaponDetachingMag_StoreRemoveChamberBullet(
m_weapon,
this);
359 WeaponEventDetachMagazine de;
383 if (!super.SaveCurrentFSMState(ctx))
388 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMagOpenBolt.SaveCurrentFSMState: cannot write m_magazine for weapon=" +
m_weapon);
394 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMagOpenBolt.SaveCurrentFSMState: cannot write m_st for weapon=" +
m_weapon);
402 if (!super.LoadCurrentFSMState(ctx, version))
407 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMagOpenBolt.LoadCurrentFSMState: cannot read m_magazine for weapon=" +
m_weapon);
412 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMagOpenBolt.LoadCurrentFSMState: cannot read m_dst for weapon=" +
m_weapon);
void wpnDebugPrint(string s)
Super root of all classes in Enforce script.
script counterpart to engine's class Inventory
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
static bool IsWeaponLogEnable()
proto bool Write(void value_out)
proto bool Read(void value_in)
signalize mechanism manipulation
weapon finite state machine
simple class starting animation action specified by m_action and m_actionType
represent weapon state base
ref MagazineHide_W4T m_hideM
ref WeaponStateBase m_start
source of the cartridge
override void OnEntry(WeaponEventBase e)
void WeaponDetachingMagOpenBolt(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int actionType=-1)
ref WeaponFSM m_fsm
hierarchical parent state of this state (or null)
void WeaponDetachingMag(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int actionType=-1)
override void OnAbort(WeaponEventBase e)
void WeaponStateBase(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
internal state id used for load/restore
override void OnExit(WeaponEventBase e)
override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
int m_actionType
action to be played
ref WeaponDetachingMag_Store m_store
ref InventoryLocation m_dst
magazine that will be detached
override bool SaveCurrentFSMState(ParamsWriteContext ctx)
ref InventoryLocation m_dst
Serializer ParamsReadContext
Serializer ParamsWriteContext
void Error(string err)
Messagebox with error message.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
InventoryLocationType
types of Inventory Location
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
enum FSMTransition WeaponTransition
void ejectBulletAndStoreInMagazine(Weapon_Base weapon, int muzzleIndex, Magazine mag, DayZPlayer p)
bool pushToChamberFromAttachedMagazine(Weapon_Base weapon, int muzzleIndex)
ref WeaponStateBase m_start
class WeaponEndAction extends WeaponStartAction m_action