42 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine, error - cannot drop magazine from left hand after not found inventory space for old magazine");
55 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine, error - cannot remove old mag from wpn");
72 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.SaveCurrentFSMState: cannot write m_oldMagazine for weapon=" +
m_weapon);
79 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.SaveCurrentFSMState: cannot write m_newDst for weapon=" +
m_weapon);
88 if (!
super.LoadCurrentFSMState(
ctx, version))
93 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.LoadCurrentFSMState: cannot read m_oldMagazine for weapon=" +
m_weapon);
99 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.LoadCurrentFSMState: cannot read m_newDst for weapon=" +
m_weapon);
132 if (!m_newMagazine || !m_newDst || !m_newDst.IsValid())
136 e.m_player.GetInventory().ClearInventoryReservationEx(m_newMagazine, m_newDst);
146 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" SwapOldAndNewMagazine, error - cannot remove new mag from LHand");
155 m_newMagazine =
NULL;
163 m_newMagazine =
NULL;
171 if (!
super.SaveCurrentFSMState(
ctx))
174 if (!
ctx.Write(m_newMagazine))
176 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" SwapOldAndNewMagazine.SaveCurrentFSMState: cannot write m_newMagazine for weapon=" +
m_weapon);
182 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" SwapOldAndNewMagazine.SaveCurrentFSMState: cannot write m_newDst for weapon=" +
m_weapon);
191 if (!
super.LoadCurrentFSMState(
ctx, version))
194 if (!
ctx.Read(m_newMagazine))
196 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" SwapOldAndNewMagazine.LoadCurrentFSMState: cannot read m_newMagazine for weapon=" +
m_weapon);
201 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" SwapOldAndNewMagazine.LoadCurrentFSMState: cannot read m_newDst for weapon=" +
m_weapon);
219 m_newMagazine =
NULL;
233 if (m_newMagazine && m_newDst)
236 if (m_newMagazine.GetInventory().GetCurrentInventoryLocation(
il))
251 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" AttachNewMagazine, error - cannot get curr location");
254 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" AttachNewMagazine, error - no magazines configured for replace (m_new=NULL)");
260 if (m_newMagazine && m_newDst)
267 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponDetachingMag_Store, error - cannot abort detaching of magazine");
273 m_newMagazine =
NULL;
281 m_newMagazine =
NULL;
288 if (!
super.SaveCurrentFSMState(
ctx))
291 if (!
ctx.Write(m_newMagazine))
293 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" AttachNewMagazine.SaveCurrentFSMState: cannot write m_newMagazine for weapon=" +
m_weapon);
299 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" AttachNewMagazine.SaveCurrentFSMState: cannot write m_newDst for weapon=" +
m_weapon);
307 if (!
super.LoadCurrentFSMState(
ctx, version))
310 if (!
ctx.Read(m_newMagazine))
312 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" AttachNewMagazine.LoadCurrentFSMState: cannot read m_newMagazine for weapon=" +
m_weapon);
317 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" AttachNewMagazine.LoadCurrentFSMState: cannot read m_newDst for weapon=" +
m_weapon);
359 m_newMagazine =
NULL;
401 m_fsm.SetInitialState(
m_start);
408 WeaponEventSwapMagazine
se;
413 m_newMagazine =
se.m_magazine;
421 if (!m_newMagazine.GetInventory().GetCurrentInventoryLocation(
newSrc))
422 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" WeaponReplacingMagAndChamberNext cannot get curr inv loc of NEW mag=" +
Object.GetDebugName(m_newMagazine));
435 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" RemoveNewMagazineFromInventory, error - cannot new remove mag from inv");
438 m_detach.m_newDst = m_newDst;
440 m_swapMags.m_newMagazine = m_newMagazine;
442 oldSrc.SetItem(m_newMagazine);
443 m_swapMags.m_newDst =
oldSrc;
459 e.m_player.GetInventory().ClearInventoryReservationEx(m_newMagazine,
null);
474 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine, error - cannot drop magazine from left hand after not found inventory space for old magazine - exit");
480 mag.GetInventory().GetCurrentInventoryLocation(
oldSrc);
487 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine, error - cannot remove old mag from wpn - exit");
492 m_newMagazine =
NULL;
506 e.m_player.GetInventory().ClearInventoryReservationEx(m_newMagazine,
null);
521 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine, error - cannot drop magazine from left hand after not found inventory space for old magazine - abort");
527 mag.GetInventory().GetCurrentInventoryLocation(
oldSrc);
534 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine, error - cannot remove old mag from wpn - abort");
541 if (!
super.SaveCurrentFSMState(
ctx))
544 if (!
ctx.Write(m_newMagazine))
546 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.SaveCurrentFSMState: cannot write m_newMagazine for weapon=" +
m_weapon);
552 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.SaveCurrentFSMState: cannot write m_oldMagazine for weapon=" +
m_weapon);
556 if (!m_newDst.WriteToContext(
ctx))
558 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.SaveCurrentFSMState: cannot write m_newDst for weapon=" +
m_weapon);
567 if (!
super.LoadCurrentFSMState(
ctx, version))
570 if (!
ctx.Read(m_newMagazine))
572 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.LoadCurrentFSMState: cannot read m_newMagazine for weapon=" +
m_weapon);
577 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.LoadCurrentFSMState: cannot read m_oldMagazine for weapon=" +
m_weapon);
582 if (!m_newDst.ReadFromContext(
ctx))
584 Error(
"[wpnfsm] " +
Object.GetDebugName(
m_weapon) +
" DetachOldMagazine.LoadCurrentFSMState: cannot read m_newDst for weapon=" +
m_weapon);
void wpnDebugPrint(string s)
void DayZPlayerUtils()
cannot be instantiated
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
void WeaponGuardHasAmmo(Weapon_Base w=NULL)
FindInventoryLocationType
flags for searching locations in inventory
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
InventoryLocationType
types of Inventory Location
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
enum FSMTransition WeaponTransition
ref WeaponStateBase m_start
class WeaponEndAction extends WeaponStartAction m_action
ref WeaponChambering_Base m_chamber
ref WeaponEjectCasingMultiMuzzle m_eject
attach mag in LH into weapon
Super root of all classes in Enforce script.
detaches old magazine from weapon and stores it in left hand (LH)
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 string DumpToStringNullSafe(InventoryLocation loc)
provides access to slot configuration
static bool IsWeaponLogEnable()
hides old magazine, but keep it in LH
Serialization general interface. Serializer API works with:
old magazine to inventory, new to left hand
signalize mechanism manipulation
weapon finite state machine
replace current magazine with new one
simple class starting animation action specified by m_action and m_actionType
represent weapon state base
void AttachNewMagazine(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
ref OldMagazineHide m_hideOld
ref AttachNewMagazine_W4T m_attach
ref DetachOldMagazine m_detach
void DetachOldMagazine(Weapon_Base w=NULL, WeaponStateBase parent=NULL)
override bool IsWaitingForActionFinish()
override void OnEntry(WeaponEventBase e)
ref SwapOldAndNewMagazine m_swapMags
ref InventoryLocation m_newDst
magazine that will be detached
override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
void WeaponReplacingMagAndChamberNext(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int actionType=-1)
override void OnAbort(WeaponEventBase e)
override void OnExit(WeaponEventBase e)
override bool SaveCurrentFSMState(ParamsWriteContext ctx)
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.