17 if (!m_magazine || !
m_dst)
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))
63 if (!ctx.Write(m_magazine))
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))
82 if (!ctx.Read(m_magazine))
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
100 bool m_bulletEjected;
106 m_bulletEjected =
false;
109 if (!m_magazine || !
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();
120 m_bulletEjected =
true;
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))
179 if (!ctx.Write(m_magazine))
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))
198 if (!ctx.Read(m_magazine))
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);
225 ref WeaponDetachingMag_Store m_store;
226 ref MagazineHide_W4T m_hideM;
228 void WeaponDetachingMag (
Weapon_Base w = NULL,
WeaponStateBase parent = NULL, WeaponActions action = WeaponActions.NONE,
int actionType = -1)
231 m_actionType = actionType;
235 m_store =
new WeaponDetachingMag_Store(
m_weapon,
this);
236 m_hideM =
new MagazineHide_W4T(
m_weapon,
this);
251 m_fsm.SetInitialState(
m_start);
258 WeaponEventDetachMagazine de;
259 if (
Class.CastTo(de, e))
262 m_magazine = e.m_magazine;
265 m_store.m_magazine = m_magazine;
266 m_store.m_dst =
m_dst;
282 if (!super.SaveCurrentFSMState(ctx))
285 if (!ctx.Write(m_magazine))
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))
304 if (!ctx.Read(m_magazine))
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);
326 ref WeaponDetachingMag_StoreRemoveChamberBullet m_store;
327 ref MagazineHide_W4T m_hideM;
329 void WeaponDetachingMagOpenBolt (
Weapon_Base w = NULL,
WeaponStateBase parent = NULL, WeaponActions action = WeaponActions.NONE,
int actionType = -1)
332 m_actionType = actionType;
336 m_store =
new WeaponDetachingMag_StoreRemoveChamberBullet(
m_weapon,
this);
337 m_hideM =
new MagazineHide_W4T(
m_weapon,
this);
352 m_fsm.SetInitialState(
m_start);
359 WeaponEventDetachMagazine de;
360 if (
Class.CastTo(de, e))
363 m_magazine = e.m_magazine;
366 m_store.m_magazine = m_magazine;
367 m_store.m_dst =
m_dst;
383 if (!super.SaveCurrentFSMState(ctx))
386 if (!ctx.Write(m_magazine))
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))
405 if (!ctx.Read(m_magazine))
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)
synchronously removes item from current inventory location and adds it to destination no anims involv...
Serialization general interface. Serializer API works with:
signalize mechanism manipulation
weapon finite state machine
simple class starting animation action specified by m_action and m_actionType
represent weapon state base
ref InventoryLocation m_dst
void Error(string err)
Messagebox with error message.
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
HandStateEquipped OnEntry
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 WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit
class WeaponEndAction extends WeaponStartAction m_action
override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
override bool SaveCurrentFSMState(ParamsWriteContext ctx)