Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
weaponreplacingmagandchambernext.c
Go to the documentation of this file.
1 
6 {
7  Magazine m_oldMagazine;
8  ref InventoryLocation m_newDst;
9 
10  void DetachOldMagazine (Weapon_Base w = NULL, WeaponStateBase parent = NULL)
11  {
12  m_oldMagazine = NULL;
13  m_newDst = NULL;
14  }
15 
16  override void OnEntry (WeaponEventBase e)
17  {
18  super.OnEntry(e);
19  }
20 
21  override void OnAbort (WeaponEventBase e)
22  {
23  super.OnAbort(e);
24  m_oldMagazine = NULL;
25  m_newDst = NULL;
26  }
27 
28  override void OnExit (WeaponEventBase e)
29  {
30  if (m_oldMagazine)
31  {
33  e.m_player.GetInventory().FindFreeLocationFor( m_oldMagazine , FindInventoryLocationType.CARGO, il );
34 
35  if (!m_newDst || !m_newDst.IsValid() || m_newDst.GetType() == InventoryLocationType.GROUND)
36  {
37  if (DayZPlayerUtils.HandleDropMagazine(e.m_player, m_oldMagazine))
38  {
39  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, ok - no inventory space for old magazine - dropped to ground"); }
40  }
41  else
42  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, error - cannot drop magazine from left hand after not found inventory space for old magazine");
43 
44  }
45  else
46  {
47  InventoryLocation oldSrc = new InventoryLocation();
48  m_oldMagazine.GetInventory().GetCurrentInventoryLocation(oldSrc);
49 
50  if (GameInventory.LocationSyncMoveEntity(oldSrc, m_newDst))
51  {
52  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, ok - old magazine removed from wpn (LHand->inv)"); }
53  }
54  else
55  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, error - cannot remove old mag from wpn");
56  }
57  }
58 
59  m_weapon.HideMagazine();
60  m_oldMagazine = NULL;
61  m_newDst = null;
62  super.OnExit(e);
63  }
64 
65  override bool SaveCurrentFSMState (ParamsWriteContext ctx)
66  {
67  if (!super.SaveCurrentFSMState(ctx))
68  return false;
69 
70  if (!ctx.Write(m_oldMagazine))
71  {
72  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.SaveCurrentFSMState: cannot write m_oldMagazine for weapon=" + m_weapon);
73  return false;
74  }
75 
76 
77  if (!OptionalLocationWriteToContext(m_newDst, ctx))
78  {
79  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.SaveCurrentFSMState: cannot write m_newDst for weapon=" + m_weapon);
80  return false;
81  }
82 
83  return true;
84  }
85 
86  override bool LoadCurrentFSMState (ParamsReadContext ctx, int version)
87  {
88  if (!super.LoadCurrentFSMState(ctx, version))
89  return false;
90 
91  if (!ctx.Read(m_oldMagazine))
92  {
93  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.LoadCurrentFSMState: cannot read m_oldMagazine for weapon=" + m_weapon);
94  return false;
95  }
96 
97  if (!OptionalLocationReadFromContext(m_newDst, ctx))
98  {
99  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.LoadCurrentFSMState: cannot read m_newDst for weapon=" + m_weapon);
100  return false;
101  }
102  return true;
103  }
104 };
105 
111 {
112 };
113 
122 {
123  Magazine m_newMagazine;
124  ref InventoryLocation m_newDst;
125 
126  override void OnEntry (WeaponEventBase e)
127  {
128  super.OnEntry(e);
129 
130  if( e )
131  {
132  if (!m_newMagazine || !m_newDst || !m_newDst.IsValid())
133  {
134  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " SwapOldAndNewMagazine, error - m_newMagazine(" + m_newMagazine + ") or destination(" + InventoryLocation.DumpToStringNullSafe(m_newDst) + ") is not set ");
135  }
136  else
137  {
138  e.m_player.GetInventory().ClearInventoryReservationEx( m_newMagazine , m_newDst );
139  m_weapon.ShowMagazine();
140  InventoryLocation lhand = new InventoryLocation();
141  lhand.SetAttachment(e.m_player, m_newMagazine, InventorySlots.LEFTHAND);
142 
143  if (GameInventory.LocationSyncMoveEntity(lhand, m_newDst))
144  {
145  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " SwapOldAndNewMagazine, ok - new magazine removed from inv (LHand->Att)"); }
146  }
147  else
148  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " SwapOldAndNewMagazine, error - cannot remove new mag from LHand");
149  }
150  }
151  }
152 
153  override void OnAbort (WeaponEventBase e)
154  {
155  //m_weapon.HideMagazine();
156 
157  m_newMagazine = NULL;
158  m_newDst = NULL;
159 
160  super.OnAbort(e);
161  }
162 
163  override void OnExit (WeaponEventBase e)
164  {
165  m_newMagazine = NULL;
166  m_newDst = NULL;
167 
168  super.OnExit(e);
169  }
170 
171  override bool SaveCurrentFSMState (ParamsWriteContext ctx)
172  {
173  if (!super.SaveCurrentFSMState(ctx))
174  return false;
175 
176  if (!ctx.Write(m_newMagazine))
177  {
178  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " SwapOldAndNewMagazine.SaveCurrentFSMState: cannot write m_newMagazine for weapon=" + m_weapon);
179  return false;
180  }
181 
182  if (!OptionalLocationWriteToContext(m_newDst, ctx))
183  {
184  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " SwapOldAndNewMagazine.SaveCurrentFSMState: cannot write m_newDst for weapon=" + m_weapon);
185  return false;
186  }
187 
188  return true;
189  }
190 
191  override bool LoadCurrentFSMState (ParamsReadContext ctx, int version)
192  {
193  if (!super.LoadCurrentFSMState(ctx, version))
194  return false;
195 
196  if (!ctx.Read(m_newMagazine))
197  {
198  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " SwapOldAndNewMagazine.LoadCurrentFSMState: cannot read m_newMagazine for weapon=" + m_weapon);
199  return false;
200  }
201  if (!OptionalLocationReadFromContext(m_newDst, ctx))
202  {
203  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " SwapOldAndNewMagazine.LoadCurrentFSMState: cannot read m_newDst for weapon=" + m_weapon);
204  return false;
205  }
206 
207  return true;
208  }
209 };
210 
215 {
216  Magazine m_newMagazine;
217  ref InventoryLocation m_newDst;
218 
219  void AttachNewMagazine (Weapon_Base w = NULL, WeaponStateBase parent = NULL)
220  {
221  m_newMagazine = NULL;
222  m_newDst = NULL;
223  }
224 
225  override bool IsWaitingForActionFinish ()
226  {
227  return true;
228  }
229 
230  override void OnEntry (WeaponEventBase e)
231  {
232  super.OnEntry(e);
233  if (e)
234  {
235  if (m_newMagazine && m_newDst)
236  {
238  if (m_newMagazine.GetInventory().GetCurrentInventoryLocation(il))
239  {
240  InventoryLocation lhand = new InventoryLocation();
241  lhand.SetAttachment(e.m_player, m_newMagazine, InventorySlots.LEFTHAND);
242  if (GameInventory.LocationSyncMoveEntity(il, m_newDst))
243  {
244  m_weapon.ShowMagazine();
245  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " AttachNewMagazine, ok - attached new magazine (LHand->dst)"); }
246  }
247  else
248  {
249  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " AttachNewMagazine, error - cannot attach new magazine!"); }
250  }
251  }
252  else
253  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " AttachNewMagazine, error - cannot get curr location");
254  }
255  else
256  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " AttachNewMagazine, error - no magazines configured for replace (m_new=NULL)");
257  }
258  }
259 
260  override void OnAbort (WeaponEventBase e)
261  {
262  if (m_newMagazine && m_newDst)
263  {
264  if (DayZPlayerUtils.HandleDropMagazine(e.m_player, m_newMagazine))
265  {
266  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponDetachingMag_Store, ok - aborting, detached magazine dropped to ground"); }
267  }
268  else
269  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponDetachingMag_Store, error - cannot abort detaching of magazine");
270 
271  m_weapon.HideMagazine(); // force hide on abort
272  }
273 
274  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " AttachNewMagazine, aborting, but attached new magazine already in place"); }
275  m_newMagazine = NULL;
276  m_newDst = NULL;
277 
278  super.OnAbort(e);
279  }
280 
281  override void OnExit (WeaponEventBase e)
282  {
283  m_newMagazine = NULL;
284  m_newDst = NULL;
285  super.OnExit(e);
286  }
287 
288  override bool SaveCurrentFSMState (ParamsWriteContext ctx)
289  {
290  if (!super.SaveCurrentFSMState(ctx))
291  return false;
292 
293  if (!ctx.Write(m_newMagazine))
294  {
295  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " AttachNewMagazine.SaveCurrentFSMState: cannot write m_newMagazine for weapon=" + m_weapon);
296  return false;
297  }
298 
299  if (!OptionalLocationWriteToContext(m_newDst, ctx))
300  {
301  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " AttachNewMagazine.SaveCurrentFSMState: cannot write m_newDst for weapon=" + m_weapon);
302  return false;
303  }
304  return true;
305  }
306 
307  override bool LoadCurrentFSMState (ParamsReadContext ctx, int version)
308  {
309  if (!super.LoadCurrentFSMState(ctx, version))
310  return false;
311 
312  if (!ctx.Read(m_newMagazine))
313  {
314  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " AttachNewMagazine.LoadCurrentFSMState: cannot read m_newMagazine for weapon=" + m_weapon);
315  return false;
316  }
317  if (!OptionalLocationReadFromContext(m_newDst, ctx))
318  {
319  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " AttachNewMagazine.LoadCurrentFSMState: cannot read m_newDst for weapon=" + m_weapon);
320  return false;
321  }
322  return true;
323  }
324 };
325 
326 class AttachNewMagazine_W4T extends WeaponStateBase
327 {
328  override bool IsWaitingForActionFinish () { return true; }
329 };
330 
331 
339 {
341  int m_actionType;
342 
344  ref DetachOldMagazine m_detach;
345  ref OldMagazineHide m_hideOld;
346  ref SwapOldAndNewMagazine m_swapMags;
347  ref AttachNewMagazine_W4T m_attach;
348  ref WeaponChamberFromAttMag_W4T m_chamber;
349  ref WeaponCharging_CK m_onCK;
351 
352  // substates configuration
353  Magazine m_oldMagazine;
354  Magazine m_newMagazine;
355  ref InventoryLocation m_newDst;
356 
357  void WeaponReplacingMagAndChamberNext (Weapon_Base w = NULL, WeaponStateBase parent = NULL, WeaponActions action = WeaponActions.NONE, int actionType = -1)
358  {
359  m_action = action;
360  m_actionType = actionType;
361  m_newMagazine = NULL;
362 
363  // setup nested state machine
364  m_start = new WeaponStartAction(m_weapon, this, m_action, m_actionType);
365  m_eject = new WeaponEjectCasing(m_weapon,this);
366  m_detach = new DetachOldMagazine(m_weapon, this);
367  m_hideOld = new OldMagazineHide(m_weapon, this);
368  m_swapMags = new SwapOldAndNewMagazine(m_weapon, this);
369  m_attach = new AttachNewMagazine_W4T(m_weapon, this);
370  m_chamber = new WeaponChamberFromAttMag_W4T(m_weapon, this);
371  m_onCK = new WeaponCharging_CK(m_weapon, this);
372 
373  // events
374  WeaponEventBase __so_ = new WeaponEventAnimSliderOpen;
375  WeaponEventBase __md_ = new WeaponEventAnimMagazineDetached;
376  WeaponEventBase __mh_ = new WeaponEventAnimMagazineHide;
377  WeaponEventBase __ms_ = new WeaponEventAnimMagazineShow;
378  WeaponEventBase __ma_ = new WeaponEventAnimMagazineAttached;
379  WeaponEventBase __ck_ = new WeaponEventAnimCocked;
380  WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
381 
382  m_fsm = new WeaponFSM(this); // @NOTE: set owner of the submachine fsm
383  m_fsm.AddTransition(new WeaponTransition( m_start, __md_, m_detach));
384  m_fsm.AddTransition(new WeaponTransition( m_start, __so_, m_eject));
385  m_fsm.AddTransition(new WeaponTransition( m_eject, __md_, m_detach));
386  m_fsm.AddTransition(new WeaponTransition( m_detach, __mh_, m_hideOld));
387  m_fsm.AddTransition(new WeaponTransition( m_hideOld, __ms_, m_swapMags));
388  m_fsm.AddTransition(new WeaponTransition(m_swapMags, __ma_, m_attach));
389  m_fsm.AddTransition(new WeaponTransition( m_attach, __ck_, m_chamber, NULL, new GuardAnd(new WeaponGuardCurrentChamberEmpty(m_weapon), new WeaponGuardHasAmmo(m_weapon))));
390  m_fsm.AddTransition(new WeaponTransition( m_attach, __ck_, m_onCK));
391 
392  m_fsm.AddTransition(new WeaponTransition( m_attach, _fin_, NULL));
393  m_fsm.AddTransition(new WeaponTransition( m_chamber, _fin_, NULL));
394  m_fsm.AddTransition(new WeaponTransition( m_onCK, _fin_, NULL));
395 
396  // Safety exits
397  m_fsm.AddTransition(new WeaponTransition(m_swapMags, _fin_, null));
398  m_fsm.AddTransition(new WeaponTransition(m_hideOld, _fin_, null));
399  m_fsm.AddTransition(new WeaponTransition(m_detach, _fin_, null));
400  m_fsm.AddTransition(new WeaponTransition(m_eject, _fin_, null));
401  m_fsm.AddTransition(new WeaponTransition(m_start, _fin_, null));
402 
403  m_fsm.SetInitialState(m_start);
404  }
405 
406  override void OnEntry (WeaponEventBase e)
407  {
408  if (e != NULL)
409  {
410  WeaponEventSwapMagazine se;
411  if (Class.CastTo(se, e))
412  {
413  int mi = m_weapon.GetCurrentMuzzle();
414  m_oldMagazine = m_weapon.GetMagazine(mi);
415  m_newMagazine = se.m_magazine;
416  m_newDst = se.m_dst;
417 
418  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponReplacingMagAndChamberNext, m_oldMagazine= " + m_oldMagazine + " m_newMagazine= " + m_newMagazine + " m_oldMagazineDst= " + typename.EnumToString(InventoryLocationType, se.m_dst.GetType())); }
419 
420  InventoryLocation oldSrc = new InventoryLocation();
421  InventoryLocation newSrc = new InventoryLocation();
422 
423  if (!m_newMagazine.GetInventory().GetCurrentInventoryLocation(newSrc))
424  {
425  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponReplacingMagAndChamberNext cannot get curr inv loc of NEW mag=" + Object.GetDebugName(m_newMagazine));
426  }
427  if (!m_oldMagazine.GetInventory().GetCurrentInventoryLocation(oldSrc))
428  {
429  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponReplacingMagAndChamberNext cannot get curr inv loc of OLD mag=" + Object.GetDebugName(m_oldMagazine));
430  }
431 
432  // move to LH
433  InventoryLocation lhand = new InventoryLocation();
434  lhand.SetAttachment(e.m_player, m_newMagazine, InventorySlots.LEFTHAND);
435 
436  if (GameInventory.LocationSyncMoveEntity(newSrc, lhand))
437  {
438  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " RemoveNewMagazineFromInventory, ok - new magazine removed from inv (inv->LHand)"); }
439  }
440  else
441  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " RemoveNewMagazineFromInventory, error - cannot new remove mag from inv");
442 
443  m_detach.m_oldMagazine = m_oldMagazine;
444  m_detach.m_newDst = m_newDst;
445 
446  m_swapMags.m_newMagazine = m_newMagazine;
447 
448  oldSrc.SetItem(m_newMagazine);
449  m_swapMags.m_newDst = oldSrc;
450  }
451  }
452  super.OnEntry(e);
453  }
454 
455  override void OnExit (WeaponEventBase e)
456  {
457  super.OnExit(e);
458 
459  EntityAI leftHandItem = e.m_player.GetInventory().FindAttachment(InventorySlots.LEFTHAND);
460  Magazine mag = Magazine.Cast(leftHandItem);
461 
462  if(mag)
463  {
464  if (m_newMagazine)
465  e.m_player.GetInventory().ClearInventoryReservationEx( m_newMagazine , null );
466  if (m_oldMagazine)
467  e.m_player.GetInventory().ClearInventoryReservationEx( m_oldMagazine , null );
468 
470 
471  e.m_player.GetInventory().FindFreeLocationFor(mag, FindInventoryLocationType.CARGO, il);
472 
473  if (!il.IsValid())
474  {
475  if (DayZPlayerUtils.HandleDropMagazine(e.m_player, mag))
476  {
477  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, ok - no inventory space for old magazine - dropped to ground - exit"); }
478  }
479  else
480  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, error - cannot drop magazine from left hand after not found inventory space for old magazine - exit");
481 
482  }
483  else
484  {
485  InventoryLocation oldSrc = new InventoryLocation();
486  mag.GetInventory().GetCurrentInventoryLocation(oldSrc);
487 
488  if (GameInventory.LocationSyncMoveEntity(oldSrc, il))
489  {
490  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, ok - old magazine removed from wpn (LHand->inv) - exit"); }
491  }
492  else
493  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, error - cannot remove old mag from wpn - exit");
494  }
495  }
496 
497  m_oldMagazine = NULL;
498  m_newMagazine = NULL;
499  m_newDst = NULL;
500  }
501 
502  override void OnAbort(WeaponEventBase e)
503  {
504  super.OnAbort(e);
505 
506  EntityAI leftHandItem = e.m_player.GetInventory().FindAttachment(InventorySlots.LEFTHAND);
507  Magazine mag = Magazine.Cast(leftHandItem);
508 
509  if (mag)
510  {
511  if (m_newMagazine)
512  e.m_player.GetInventory().ClearInventoryReservationEx( m_newMagazine , null );
513  if (m_oldMagazine)
514  e.m_player.GetInventory().ClearInventoryReservationEx( m_oldMagazine , null );
515 
517 
518  e.m_player.GetInventory().FindFreeLocationFor(mag, FindInventoryLocationType.CARGO, il);
519 
520  if (!il.IsValid())
521  {
522  if (DayZPlayerUtils.HandleDropMagazine(e.m_player, mag))
523  {
524  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, ok - no inventory space for old magazine - dropped to ground - abort"); }
525  }
526  else
527  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, error - cannot drop magazine from left hand after not found inventory space for old magazine - abort");
528 
529  }
530  else
531  {
532  InventoryLocation oldSrc = new InventoryLocation();
533  mag.GetInventory().GetCurrentInventoryLocation(oldSrc);
534 
535  if (GameInventory.LocationSyncMoveEntity(oldSrc, il))
536  {
537  if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, ok - old magazine removed from wpn (LHand->inv) - abort"); }
538  }
539  else
540  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine, error - cannot remove old mag from wpn - abort");
541  }
542  }
543  }
544 
545  override bool SaveCurrentFSMState (ParamsWriteContext ctx)
546  {
547  if (!super.SaveCurrentFSMState(ctx))
548  return false;
549 
550  if (!ctx.Write(m_newMagazine))
551  {
552  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.SaveCurrentFSMState: cannot write m_newMagazine for weapon=" + m_weapon);
553  return false;
554  }
555 
556  if (!ctx.Write(m_oldMagazine))
557  {
558  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.SaveCurrentFSMState: cannot write m_oldMagazine for weapon=" + m_weapon);
559  return false;
560  }
561 
562  if (!m_newDst.WriteToContext(ctx))
563  {
564  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.SaveCurrentFSMState: cannot write m_newDst for weapon=" + m_weapon);
565  return false;
566  }
567 
568  return true;
569  }
570 
571  override bool LoadCurrentFSMState (ParamsReadContext ctx, int version)
572  {
573  if (!super.LoadCurrentFSMState(ctx, version))
574  return false;
575 
576  if (!ctx.Read(m_newMagazine))
577  {
578  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.LoadCurrentFSMState: cannot read m_newMagazine for weapon=" + m_weapon);
579  return false;
580  }
581  if (!ctx.Read(m_oldMagazine))
582  {
583  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.LoadCurrentFSMState: cannot read m_oldMagazine for weapon=" + m_weapon);
584  return false;
585  }
586  m_newDst = new InventoryLocation;
587 
588  if (!m_newDst.ReadFromContext(ctx))
589  {
590  Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " DetachOldMagazine.LoadCurrentFSMState: cannot read m_newDst for weapon=" + m_weapon);
591  return false;
592  }
593 
594  return true;
595  }
596 };
597 
LoadCurrentFSMState
override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
Definition: weaponchambering.c:867
Error
void Error(string err)
Messagebox with error message.
Definition: endebug.c:90
OnAbort
override void OnAbort()
Definition: remotedetonator.c:300
LogManager
Definition: debug.c:734
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
DayZPlayerUtils
private void DayZPlayerUtils()
cannot be instantiated
Definition: dayzplayerutils.c:461
OptionalLocationReadFromContext
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
Definition: inventorylocation.c:605
OnExit
override void OnExit(HandEventBase e)
Definition: hand_states.c:28
wpnDebugPrint
void wpnDebugPrint(string s)
Definition: debug.c:9
m_eject
ref WeaponEjectCasingMultiMuzzle m_eject
Definition: weaponchambering.c:638
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
m_chamber
ref WeaponChambering_Base m_chamber
Definition: weaponchambering.c:639
OldMagazineHide
hides old magazine, but keep it in LH
Definition: weaponreplacingmagandchambernext.c:110
WeaponReplacingMagAndChamberNext
replace current magazine with new one
DetachOldMagazine
detaches old magazine from weapon and stores it in left hand (LH)
m_action
class WeaponEndAction extends WeaponStartAction m_action
WeaponStartAction
simple class starting animation action specified by m_action and m_actionType
Definition: weaponchambering.c:2
SwapOldAndNewMagazine
old magazine to inventory, new to left hand
WeaponActions
WeaponActions
actions
Definition: human.c:808
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
OptionalLocationWriteToContext
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
Definition: inventorylocation.c:583
IsWaitingForActionFinish
class WeaponChambering_Cartridge_InnerMag extends WeaponChambering_Base IsWaitingForActionFinish
Definition: weaponchambering.c:190
m_start
ref WeaponStateBase m_start
Definition: weaponchambering.c:637
SaveCurrentFSMState
override bool SaveCurrentFSMState(ParamsWriteContext ctx)
Definition: weaponchambering.c:848
InventoryLocationType
InventoryLocationType
types of Inventory Location
Definition: inventorylocation.c:3
m_oldMagazine
Magazine m_oldMagazine
Definition: firearmactionattachmagazine.c:8
Object
Definition: objecttyped.c:1
WeaponTransition
enum FSMTransition WeaponTransition
FindInventoryLocationType
FindInventoryLocationType
flags for searching locations in inventory
Definition: inventorylocation.c:15
WeaponGuardHasAmmo
void WeaponGuardHasAmmo(Weapon_Base w=NULL)
Definition: guards.c:99
WeaponEventBase
signalize mechanism manipulation
Definition: events.c:34
WeaponStateBase
represent weapon state base
Definition: bullethide.c:1
m_weapon
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition: guards.c:583
Weapon_Base
shorthand
Definition: boltactionrifle_base.c:5
AttachNewMagazine
attach mag in LH into weapon
MagazineHide
Definition: magazinehide.c:15
WeaponFSM
weapon finite state machine
WeaponEjectCasing
Definition: weaponejectcasingandchamberfromattmag.c:126
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
EntityAI
Definition: building.c:5
OnEntry
HandStateEquipped OnEntry
Definition: weaponchambering.c:208
GameInventory
script counterpart to engine's class Inventory
Definition: inventory.c:78