DayZ 1.24
Loading...
Searching...
No Matches
WeaponChambering.c
Go to the documentation of this file.
1// load 1 bullet
3{
4 override void OnEntry(WeaponEventBase e)
5 {
6 super.OnEntry(e);
7 if (e)
8 {
9 m_weapon.SelectionBulletHide();
10 m_weapon.ForceSyncSelectionState();
11 }
12 }
13
15 {
16 return true;
17 }
18};
19
21{
22 float m_damage;
23 string m_type;
26
28 {
29 if (!super.SaveCurrentFSMState(ctx))
30 return false;
31
32 if (!ctx.Write(m_damage))
33 {
34 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.SaveCurrentFSMState: cannot write m_damage for weapon=" + m_weapon);
35 return false;
36 }
37 if (!ctx.Write(m_type))
38 {
39 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.SaveCurrentFSMState: cannot write m_type for weapon=" + m_weapon);
40 return false;
41 }
42 if (!ctx.Write(m_magazineType))
43 {
44 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.SaveCurrentFSMState: cannot write m_magazineType for weapon=" + m_weapon);
45 return false;
46 }
47 if (!ctx.Write(m_srcMagazine))
48 {
49 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.SaveCurrentFSMState: cannot write m_srcMagazine for weapon=" + m_weapon);
50 return false;
51 }
52 return true;
53 }
54
55 override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
56 {
57 if (!super.LoadCurrentFSMState(ctx, version))
58 return false;
59
60 if (!ctx.Read(m_damage))
61 {
62 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.LoadCurrentFSMState: cannot read m_damage for weapon=" + m_weapon);
63 return false;
64 }
65 if (!ctx.Read(m_type))
66 {
67 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.LoadCurrentFSMState: cannot read m_type for weapon=" + m_weapon);
68 return false;
69 }
70 if (!ctx.Read(m_magazineType))
71 {
72 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.LoadCurrentFSMState: cannot read m_magazineType for weapon=" + m_weapon);
73 return false;
74 }
75 if (!ctx.Read(m_srcMagazine))
76 {
77 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" + m_weapon);
78 return false;
79 }
80 return true;
81 }
82};
83
84
86{
87 override bool IsWaitingForActionFinish() { return true; }
88 override void OnEntry(WeaponEventBase e)
89 {
90 super.OnEntry(e);
91 if (e)
92 {
93 if (m_srcMagazine)
94 {
95 m_magazineType = m_srcMagazine.GetType();
96
97 if (m_srcMagazine.ServerAcquireCartridge(m_damage, m_type))
98 {
99 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, ok - cartridge acquired: dmg=" + m_damage + " type=" + m_type);
100 m_weapon.SelectionBulletShow();
101 m_weapon.ShowBullet(m_weapon.GetCurrentMuzzle());
102 m_weapon.EffectBulletShow(m_weapon.GetCurrentMuzzle(), m_damage, m_type);
103 m_weapon.SetWeaponOpen(false);
104 }
105 else
106 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - cannot take cartridge from magazine");
107 }
108 else
109 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - no magazine to load from (m_srcMagazine=NULL)");
110 }
111 }
112
113 override void OnAbort(WeaponEventBase e)
114 {
115 int mi = m_weapon.GetCurrentMuzzle();
116
117 string magazineTypeName;
118
119 if (m_magazineType.Length() > 0)
120 magazineTypeName = m_magazineType;
121 else
122 magazineTypeName = m_weapon.GetChamberAmmoTypeName(mi);
123
124 if (GetGame().IsServer())
125 {
126 if (DayZPlayerUtils.HandleDropCartridge(e.m_player, m_damage, m_type, magazineTypeName))
127 {
128 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, ok - aborting, chambering cartridge dropped to ground");
129 }
130 else
131 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - cannot abort removal from wpn (of old mag)");
132 }
133
134 m_weapon.EffectBulletHide(mi);
135 m_weapon.SelectionBulletHide(); // force hide on abort
136
137 m_magazineType = string.Empty;
138 m_type = string.Empty;
139 super.OnAbort(e);
140 }
141
142 override void OnExit(WeaponEventBase e)
143 {
144 int mi = m_weapon.GetCurrentMuzzle();
145 //if ( m_weapon.IsChamberFiredOut(mi) )
146 // m_weapon.EjectCasing(mi);
147 if (m_weapon.PushCartridgeToChamber(mi, m_damage, m_type))
148 {
149 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, ok - loaded chamber");
150 }
151 else if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - cannot load chamber chamber!");
152
153 m_weapon.SetCharged(true);
154 m_magazineType = string.Empty;
155 m_type = string.Empty;
156 super.OnExit(e);
157 }
158
159};
160
162{
163 override void OnExit(WeaponEventBase e)
164 {
165 float ammoDamage;
166 string ammoTypeName;
167 int mi = m_weapon.GetCurrentMuzzle();
168 if (m_weapon.IsChamberFull(mi))
169 {
170 m_weapon.PopCartridgeFromChamber(mi, ammoDamage, ammoTypeName);
171 if (m_weapon.PushCartridgeToInternalMagazine(mi, ammoDamage, ammoTypeName))
172 {
173 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, ok - loaded chamber");
174 }
175 else if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - cannot load chamber chamber!");
176 }
177
178 m_weapon.SetWeaponOpen(false);
179 super.OnExit(e);
180 }
181}
182
183//-----------MAGNUM-----------
185{
186 override bool IsWaitingForActionFinish() { return false; }
187 override void OnEntry(WeaponEventBase e)
188 {
189 super.OnEntry(e);
190
191 /*for(int i = 0; i < m_weapon.GetMuzzleCount(); i++ )
192 {
193 if(!m_weapon.IsChamberFull(i))
194 {
195 m_weapon.ShowBullet(i);
196 m_weapon.EffectBulletShow(i, m_damage, m_type);
197 return;
198 }
199 }*/
200 }
201
202 override void OnExit(WeaponEventBase e)
203 {
204 m_weapon.SelectionBulletHide();
205 int muzzle = m_weapon.GetCurrentMuzzle();
206
207 if (!m_weapon.IsChamberFull(muzzle))
208 {
209 if (m_weapon.PushCartridgeToChamber(muzzle, m_damage, m_type))
210 {
212
213 if (cylinder)
214 {
215 string bullet = "bullet";
216 string bullet_nose = "bullet_nose";
217
218 if (muzzle > 0)
219 {
220 bullet = string.Format("bullet_" + (muzzle + 1));
221 bullet_nose = string.Format("bullet_nose_" + (muzzle + 1));
222 }
223 cylinder.ShowSelection(bullet);
224 cylinder.ShowSelection(bullet_nose);
225 }
226 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_MultiMuzzleMagnum, ok - loaded chamber");
227 }
228 else if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_MultiMuzzleMagnum, error - cannot load chamber chamber!");
229 m_type = string.Empty;
230 return;
231 }
232 else if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_MultiMuzzleMagnum, error - cannot load chamber chamber!");
233
234 //super.OnExit(e);
235 }
236}
237
238
239//----------------------------
240
242{
243 override bool IsWaitingForActionFinish() { return true; }
244 override void OnEntry(WeaponEventBase e)
245 {
246 super.OnEntry(e);
247
248 for (int i = 0; i < m_weapon.GetMuzzleCount(); i++)
249 {
250 if (!m_weapon.IsChamberFull(i))
251 {
252 m_weapon.ShowBullet(i);
253 m_weapon.EffectBulletShow(i, m_damage, m_type);
254 return;
255 }
256 }
257 }
258
259 override void OnExit(WeaponEventBase e)
260 {
261 for (int i = 0; i < m_weapon.GetMuzzleCount(); i++)
262 {
263 if (!m_weapon.IsChamberFull(i))
264 {
265 if (m_weapon.PushCartridgeToChamber(i, m_damage, m_type))
266 {
267 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, ok - loaded chamber");
268 }
269 else if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge, error - cannot load chamber chamber!");
270 m_type = string.Empty;
271 return;
272 }
273 }
274
275 super.OnExit(e);
276 }
277}
278
280{
281 override bool IsWaitingForActionFinish() { return true; }
282};
284
286{
287 override void OnEntry(WeaponEventBase e)
288 {
289 super.OnEntry(e);
290 if (e)
291 {
292 if (m_srcMagazine)
293 {
294 m_magazineType = m_srcMagazine.GetType();
295
296 if (m_srcMagazine.ServerAcquireCartridge(m_damage, m_type))
297 {
298 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, ok - cartridge acquired: dmg=" + m_damage + " type=" + m_type);
299 }
300 else
301 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, error - cannot take cartridge from magazine");
302 }
303 else
304 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, error - no magazine to load from (m_srcMagazine=NULL)");
305
306 m_weapon.SelectionBulletShow();
307 m_weapon.EffectBulletShow(m_weapon.GetCurrentMuzzle(), m_damage, m_type);
308 }
309 }
310
311 override void OnAbort(WeaponEventBase e)
312 {
313 int mi = m_weapon.GetCurrentMuzzle();
314 string magazineTypeName;
315
316 if (m_magazineType.Length() > 0)
317 magazineTypeName = m_magazineType;
318 else
319 magazineTypeName = m_weapon.GetChamberAmmoTypeName(mi);
320
321 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
322 {
323 if (DayZPlayerUtils.HandleDropCartridge(e.m_player, m_damage, m_type, magazineTypeName))
324 {
325 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, ok - aborting, chambering cartridge dropped to ground");
326 }
327 else
328 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, error - cannot abort removal from wpn (of old mag)");
329 }
330
331 m_weapon.SelectionBulletHide(); // force hide on abort
332 m_weapon.EffectBulletHide(m_weapon.GetCurrentMuzzle());
333
334 m_magazineType = string.Empty;
335 m_type = string.Empty;
336 super.OnAbort(e);
337 }
338
339 override void OnExit(WeaponEventBase e)
340 {
341 float ammoDamage;
342 string ammoTypeName;
343 int mi = m_weapon.GetCurrentMuzzle();
344 if (!m_weapon.IsInternalMagazineFull(mi))
345 {
346 if (m_weapon.PushCartridgeToInternalMagazine(mi, m_damage, m_type))
347 {
348 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, ok - loaded chamber");
349 }
350 else if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering_Cartridge_InnerMag, error - cannot load chamber chamber!");
351 }
352 m_magazineType = string.Empty;
353 super.OnExit(e);
354 }
355};
356
358{
359 override bool IsWaitingForActionFinish() { return true; }
360};
361
362class WeaponChambering extends WeaponStateBase
363{
365 int m_actionType;
368
374
376 {
378 m_actionType = actionType;
379
380 // setup nested state machine
381 m_start = new WeaponChambering_Start(m_weapon, this, m_action, m_actionType);
383 m_w4t = new WeaponChambering_W4T(m_weapon, this);
385 m_onCK = new WeaponCharging_CK(m_weapon, this);
386 // events
387 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
388 WeaponEventAnimBulletInChamber __bc_ = new WeaponEventAnimBulletInChamber;
389 WeaponEventAnimBulletShow __bs_ = new WeaponEventAnimBulletShow;
390 WeaponEventAnimBulletEject __be_ = new WeaponEventAnimBulletEject;
391 WeaponEventAnimCocked __ck_ = new WeaponEventAnimCocked;
392
393 m_fsm = new WeaponFSM(this); // @NOTE: set owner of the submachine fsm
394 m_fsm.AddTransition(new WeaponTransition(m_start, __be_, m_eject));
395 m_fsm.AddTransition(new WeaponTransition(m_start, __ck_, m_onCK));
396 m_fsm.AddTransition(new WeaponTransition(m_start, __bs_, m_chamber));
397 m_fsm.AddTransition(new WeaponTransition(m_onCK, __be_, m_eject));
398 m_fsm.AddTransition(new WeaponTransition(m_onCK, __bs_, m_chamber));
399 m_fsm.AddTransition(new WeaponTransition(m_eject, __bs_, m_chamber));
400 m_fsm.AddTransition(new WeaponTransition(m_chamber, __bc_, m_w4t));
401 m_fsm.AddTransition(new WeaponTransition(m_w4t, _fin_, null));
402
403 // Safety exits
404 m_fsm.AddTransition(new WeaponTransition(m_chamber, _fin_, null));
405 m_fsm.AddTransition(new WeaponTransition(m_eject, _fin_, null));
406 m_fsm.AddTransition(new WeaponTransition(m_start, _fin_, null));
407
408 m_fsm.SetInitialState(m_start);
409 }
410
411 override void OnEntry(WeaponEventBase e)
412 {
413 if (e != NULL)
414 {
415 m_srcMagazine = e.m_magazine;
416 if (m_srcMagazine != NULL)
417 {
419 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
420
422
423 // move to LH
425 lhand.SetAttachment(e.m_player, m_srcMagazine, InventorySlots.LEFTHAND);
427 {
428 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, ok - ammo pile removed from inv (inv->LHand)");
429 }
430 else
431 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, error - cannot remove ammo pile from inv");
432
433 m_chamber.m_srcMagazine = m_srcMagazine;
434 }
435 else
436 {
437 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering m_srcMagazine = NULL");
438 }
439 }
440 else
441 {
442 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering (e=NULL), m_srcMagazine=" + m_srcMagazine.ToString());
443 }
444
445 super.OnEntry(e); // @NOTE: super at the end (prevent override from submachine start)
446 }
447
448 override void OnAbort(WeaponEventBase e)
449 {
450 bool done = false;
451 if (m_srcMagazine)
452 {
453 e.m_player.GetInventory().ClearInventoryReservationEx(m_srcMagazine, m_srcMagazinePrevLocation);
454
456 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
457 if (leftHandIl.IsValid())
458 {
460 {
462 {
464 {
466 {
467 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort");
468 done = true;
469 }
470 }
471 }
472 }
473
474 if (!done)
475 {
477 e.m_player.GetInventory().FindFreeLocationFor(m_srcMagazine, FindInventoryLocationType.CARGO, il);
478
479 if (!il || !il.IsValid())
480 {
481 if (DayZPlayerUtils.HandleDropMagazine(e.m_player, m_srcMagazine))
482 {
483 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, ok - no inventory space for ammo pile - dropped to ground - abort");
484 }
485 else
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");
487
488 }
489 else
490 {
492 {
493 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, ok - ammo pile removed from left hand (LHand->inv) - abort");
494 }
495 else
496 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, error - cannot remove ammo pile from wpn - abort");
497 }
498 }
499 }
500 }
501
502 super.OnAbort(e);
504 m_chamber.m_srcMagazine = NULL;
506 }
507
508 override void OnExit(WeaponEventBase e)
509 {
510 bool done = false;
511 if (m_srcMagazine)
512 {
513 e.m_player.GetInventory().ClearInventoryReservationEx(m_srcMagazine, m_srcMagazinePrevLocation);
514
516 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
517 if (leftHandIl.IsValid())
518 {
520 {
522 {
524 {
526 {
527 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - exit");
528 done = true;
529 }
530 }
531 }
532 }
533
534 if (!done)
535 {
537 e.m_player.GetInventory().FindFreeLocationFor(m_srcMagazine, FindInventoryLocationType.CARGO, il);
538
539 if (!il || !il.IsValid())
540 {
541 if (DayZPlayerUtils.HandleDropMagazine(e.m_player, m_srcMagazine))
542 {
543 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, ok - no inventory space for ammo pile - dropped to ground - exit");
544 }
545 else
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");
547
548 }
549 else
550 {
552 {
553 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, ok - ammo pile removed from left hand (LHand->inv) - exit");
554 }
555 else
556 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering, error - cannot remove ammo pile from wpn - exit");
557 }
558 }
559 }
560 }
561
562 super.OnExit(e);
564 m_chamber.m_srcMagazine = NULL;
566 }
567
569 {
570 if (!super.SaveCurrentFSMState(ctx))
571 return false;
572
573 if (!ctx.Write(m_srcMagazine))
574 {
575 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" + m_weapon);
576 return false;
577 }
578
580 {
581 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" + m_weapon);
582 return false;
583 }
584 return true;
585 }
586
587 override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
588 {
589 if (!super.LoadCurrentFSMState(ctx, version))
590 return false;
591
592 if (!ctx.Read(m_srcMagazine))
593 {
594 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" + m_weapon);
595 return false;
596 }
597
599 {
600 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" + m_weapon);
601 return false;
602 }
603 return true;
604 }
605};
606
607//----------------------------------------------
608//----------------------------------------------
609//----------------------------------------------
611{
613 {
614 return true;
615 }
616}
617
619{
625
634
636 {
640
641 // setup nested state machine
647 m_showB = new BulletShow_W4T(m_weapon, this);
648 m_showB2 = new BulletShow2_W4T(m_weapon, this);
649
650 m_endLoop = new WeaponEndAction(m_weapon, this, m_action, m_endActionType); // @NOTE: termination playing action - dummy?
651 // events
652 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
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;
660
661 m_fsm = new WeaponFSM(this); // @NOTE: set owner of the submachine fsm
662 m_fsm.AddTransition(new WeaponTransition(m_start, __be_, m_eject));
663
664 m_fsm.AddTransition(new WeaponTransition(m_start, __bs_, m_chamber));
665 m_fsm.AddTransition(new WeaponTransition(m_eject, __bs_, m_chamber));
666
667 m_fsm.AddTransition(new WeaponTransition(m_chamber, __bc_, m_w4sb2, NULL, new GuardAnd(new GuardAnd(new WeaponGuardHasAmmoInLoopedState(m_chamber), new WeaponGuardChamberMultiHasRoomBulltet(m_weapon)), new WeaponGuardWeaponManagerWantContinue())));
668 m_fsm.AddTransition(new WeaponTransition(m_chamber, __bc_, m_endLoop));
669 m_fsm.AddTransition(new WeaponTransition(m_w4sb2, __bs_, m_chamber));
670
671 m_fsm.AddTransition(new WeaponTransition(m_w4sb2, _fin_, NULL));
672 m_fsm.AddTransition(new WeaponTransition(m_chamber, _fin_, NULL));
673 m_fsm.AddTransition(new WeaponTransition(m_endLoop, _fin_, NULL));
674
675 // Safety exits
676 m_fsm.AddTransition(new WeaponTransition(m_eject, _fin_, null));
677 m_fsm.AddTransition(new WeaponTransition(m_start, _fin_, null));
678
679 m_fsm.SetInitialState(m_start);
680 }
681
682 override void OnEntry(WeaponEventBase e)
683 {
684 if (e != NULL)
685 {
686 m_srcMagazine = e.m_magazine;
687 if (m_srcMagazine != NULL)
688 {
690 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
691
693
694 // move to LH
696 lhand.SetAttachment(e.m_player, m_srcMagazine, InventorySlots.LEFTHAND);
698 {
699 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - ammo pile removed from inv (inv->LHand)");
700 }
701 else
702 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, error - cannot remove ammo pile from inv");
703
704 m_chamber.m_srcMagazine = m_srcMagazine;
705 }
706 else
707 {
708 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet m_srcMagazine = NULL");
709 }
710 }
711 else
712 {
713 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet (e=NULL), m_srcMagazine=" + m_srcMagazine.ToString());
714 }
715
716 super.OnEntry(e); // @NOTE: super at the end (prevent override from submachine start)
717 }
718 override void OnExit(WeaponEventBase e)
719 {
720 bool done = false;
721 if (m_srcMagazine)
722 {
723 e.m_player.GetInventory().ClearInventoryReservationEx(m_srcMagazine, m_srcMagazinePrevLocation);
724
726 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
727 if (leftHandIl.IsValid())
728 {
730 {
732 {
734 {
736 {
737 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - ammo pile removed from left hand to previous location (LHand->inv) - exit");
738 done = true;
739 }
740 }
741 }
742 }
743
744 if (!done)
745 {
747 e.m_player.GetInventory().FindFreeLocationFor(m_srcMagazine, FindInventoryLocationType.CARGO, il);
748
749 if (!il || !il.IsValid())
750 {
751 if (DayZPlayerUtils.HandleDropMagazine(e.m_player, m_srcMagazine))
752 {
753 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - no inventory space for ammo pile - dropped to ground - exit");
754 }
755 else
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");
757
758 }
759 else
760 {
762 {
763 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - ammo pile removed from left hand (LHand->inv) - exit");
764 }
765 else
766 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, error - cannot remove ammo pile from wpn - exit");
767 }
768 }
769 }
770 }
771
772 super.OnExit(e);
774 m_chamber.m_srcMagazine = NULL;
776 }
777 override void OnAbort(WeaponEventBase e)
778 {
779 bool done = false;
780 if (m_srcMagazine)
781 {
782 e.m_player.GetInventory().ClearInventoryReservationEx(m_srcMagazine, m_srcMagazinePrevLocation);
783
785 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
786 if (leftHandIl.IsValid())
787 {
789 {
791 {
793 {
795 {
796 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort");
797 done = true;
798 }
799 }
800 }
801 }
802
803 if (!done)
804 {
806 e.m_player.GetInventory().FindFreeLocationFor(m_srcMagazine, FindInventoryLocationType.CARGO, il);
807
808 if (!il || !il.IsValid())
809 {
810 if (DayZPlayerUtils.HandleDropMagazine(e.m_player, m_srcMagazine))
811 {
812 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - no inventory space for ammo pile - dropped to ground - abort");
813 }
814 else
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");
816
817 }
818 else
819 {
821 {
822 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, ok - ammo pile removed from left hand (LHand->inv) - abort");
823 }
824 else
825 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet, error - cannot remove ammo pile from wpn - abort");
826 }
827 }
828 }
829 }
830
831 super.OnAbort(e);
833 m_chamber.m_srcMagazine = NULL;
835 }
836
838 {
839 if (!super.SaveCurrentFSMState(ctx))
840 return false;
841
842 if (!ctx.Write(m_srcMagazine))
843 {
844 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" + m_weapon);
845 return false;
846 }
847
849 {
850 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" + m_weapon);
851 return false;
852 }
853 return true;
854 }
855
856 override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
857 {
858 if (!super.LoadCurrentFSMState(ctx, version))
859 return false;
860
861 if (!ctx.Read(m_srcMagazine))
862 {
863 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" + m_weapon);
864 return false;
865 }
866
868 {
869 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " ChamberMultiBullet.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" + m_weapon);
870 return false;
871 }
872 return true;
873 }
874};
875//------------------------------------------------------
876//------------------ROTATE------------------------------
877//------------------------------------------------------
879{
881 {
883 int nMuzzles = m_weapon.GetMuzzleCount();
884
885 for (int i = 0; i < nMuzzles; ++i)
886 {
887 --nextMuzzle;
889 if (m_weapon.IsChamberEmpty(nextMuzzle))
890 return true;
891 }
892
893 return false;
894 }
895
896 override void OnEntry(WeaponEventBase e)
897 {
898 int nextMuzzle;
899 if (FindNextFreeMuzzle(m_weapon.GetCurrentMuzzle(), nextMuzzle))
900 {
902 magnum.SetCylinderRotationAnimationPhase(magnum.GetCylinderRotation(nextMuzzle));
903 m_weapon.SetCurrentMuzzle(nextMuzzle);
904 }
905 else
906 Print("WTF");
907
908 super.OnEntry(e); // @NOTE: super at the end (prevent override from submachine start)
909 }
910
911};
912
913
914//------------------------------------------------------
915//------------------MAGNUM------------------------------
916//------------------------------------------------------
917class WeaponMagnumChambering extends WeaponStateBase
918{
924
932
934 {
938
939 // setup nested state machine
942 m_rotate = new WeaponCylinderRotate(m_weapon, this);
945 m_hideB = new BulletHide_W4T(m_weapon, this);
946 m_endLoop = new LoopedChambering_EndLoop(m_weapon, this, m_action, m_endActionType); // @NOTE: termination playing action - dummy?
947 // events
948 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
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;
957
958 m_fsm = new WeaponFSM(this); // @NOTE: set owner of the submachine fsm
959 m_fsm.AddTransition(new WeaponTransition(m_start, __be_, m_eject));
960 m_fsm.AddTransition(new WeaponTransition(m_start, __cr_, m_rotate));
961
962 m_fsm.AddTransition(new WeaponTransition(m_eject, __cr_, m_rotate));
963 m_fsm.AddTransition(new WeaponTransition(m_rotate, __be_, m_eject));
964
965 m_fsm.AddTransition(new WeaponTransition(m_eject, __bs_, m_chamber));
966 m_fsm.AddTransition(new WeaponTransition(m_rotate, __bs_, m_chamber));
967
968 m_fsm.AddTransition(new WeaponTransition(m_chamber, __bM_, m_w4sb2, null, new GuardAnd(new GuardAnd(new WeaponGuardHasAmmoInLoopedState(m_chamber), new WeaponGuardChamberMultiHasRoomBulltet(m_weapon)), new WeaponGuardWeaponManagerWantContinue())));
969 m_fsm.AddTransition(new WeaponTransition(m_chamber, __bM_, m_endLoop));
970 //m_fsm.AddTransition(new WeaponTransition(m_rotate, __bh_, m_chamber));
971 //m_fsm.AddTransition(new WeaponTransition(m_w4sb2, __bh_, m_hideB));
972 m_fsm.AddTransition(new WeaponTransition(m_w4sb2, __cr_, m_rotate));
973
974 m_fsm.AddTransition(new WeaponTransition(m_endLoop, _fin_, null));
975
976 // Safety exits
977 m_fsm.AddTransition(new WeaponTransition(m_w4sb2, _fin_, null));
978 m_fsm.AddTransition(new WeaponTransition(m_chamber, _fin_, null));
979 m_fsm.AddTransition(new WeaponTransition(m_rotate, _fin_, null));
980 m_fsm.AddTransition(new WeaponTransition(m_eject, _fin_, null));
981 m_fsm.AddTransition(new WeaponTransition(m_start, _fin_, null));
982
983 m_fsm.SetInitialState(m_start);
984 }
985
986 override void OnEntry(WeaponEventBase e)
987 {
988 if (e != NULL)
989 {
990
991 m_srcMagazine = e.m_magazine;
992 if (m_srcMagazine != NULL)
993 {
995 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(newSrc);
996
998
999 // move to LH
1001 lhand.SetAttachment(e.m_player, m_srcMagazine, InventorySlots.LEFTHAND);
1003 {
1004 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering, ok - ammo pile removed from inv (inv->LHand)");
1005 }
1006 else
1007 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering, error - cannot remove ammo pile from inv");
1008
1009 m_chamber.m_srcMagazine = m_srcMagazine;
1010 }
1011 else
1012 Print("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering m_srcMagazine = NULL");
1013 }
1014 else
1015 Print("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering (e=NULL), m_srcMagazine=" + m_srcMagazine.ToString());
1016
1017 super.OnEntry(e); // @NOTE: super at the end (prevent override from submachine start)
1018 }
1019
1020 override void OnExit(WeaponEventBase e)
1021 {
1022 bool done = false;
1023 if (m_srcMagazine)
1024 {
1025 e.m_player.GetInventory().ClearInventoryReservationEx(m_srcMagazine, m_srcMagazinePrevLocation);
1026
1028 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
1029 if (leftHandIl.IsValid())
1030 {
1032 {
1034 {
1036 {
1038 {
1039 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - exit");
1040 done = true;
1041 }
1042 }
1043 }
1044 }
1045
1046 if (!done)
1047 {
1049 e.m_player.GetInventory().FindFreeLocationFor(m_srcMagazine, FindInventoryLocationType.CARGO, il);
1050
1051 if (!il || !il.IsValid())
1052 {
1053 if (DayZPlayerUtils.HandleDropMagazine(e.m_player, m_srcMagazine))
1054 {
1055 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering, ok - no inventory space for ammo pile - dropped to ground - exit");
1056 }
1057 else
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");
1059
1060 }
1061 else
1062 {
1064 {
1065 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering, ok - ammo pile removed from left hand (LHand->inv) - exit");
1066 }
1067 else
1068 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering, error - cannot remove ammo pile from wpn - exit");
1069 }
1070 }
1071 }
1072 }
1073
1074 super.OnExit(e);
1076 m_chamber.m_srcMagazine = NULL;
1078 }
1079
1081 {
1082 bool done = false;
1083 if (m_srcMagazine)
1084 {
1085 e.m_player.GetInventory().ClearInventoryReservationEx(m_srcMagazine, m_srcMagazinePrevLocation);
1086
1088 m_srcMagazine.GetInventory().GetCurrentInventoryLocation(leftHandIl);
1089 if (leftHandIl.IsValid())
1090 {
1092 {
1094 {
1096 {
1098 {
1099 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering, ok - ammo pile removed from left hand to previous location (LHand->inv) - abort");
1100 done = true;
1101 }
1102 }
1103 }
1104 }
1105
1106 if (!done)
1107 {
1109 e.m_player.GetInventory().FindFreeLocationFor(m_srcMagazine, FindInventoryLocationType.CARGO, il);
1110
1111 if (!il || !il.IsValid())
1112 {
1113 if (DayZPlayerUtils.HandleDropMagazine(e.m_player, m_srcMagazine))
1114 {
1115 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering, ok - no inventory space for ammo pile - dropped to ground - abort");
1116 }
1117 else
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");
1119
1120 }
1121 else
1122 {
1124 {
1125 if (LogManager.IsWeaponLogEnable()) wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering, ok - ammo pile removed from left hand (LHand->inv) - abort");
1126 }
1127 else
1128 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " LoopedChambering, error - cannot remove ammo pile from wpn - abort");
1129 }
1130 }
1131 }
1132 }
1133
1134 super.OnAbort(e);
1136 m_chamber.m_srcMagazine = NULL;
1138 }
1139
1141 {
1142 if (!super.SaveCurrentFSMState(ctx))
1143 return false;
1144
1145 if (!ctx.Write(m_srcMagazine))
1146 {
1147 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering.SaveCurrentFSMState: cannot save m_srcMagazine for weapon=" + m_weapon);
1148 return false;
1149 }
1150
1152 {
1153 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering.SaveCurrentFSMState: cannot write m_srcMagazinePrevLocation for weapon=" + m_weapon);
1154 return false;
1155 }
1156
1157 return true;
1158 }
1159
1160 override bool LoadCurrentFSMState(ParamsReadContext ctx, int version)
1161 {
1162 if (!super.LoadCurrentFSMState(ctx, version))
1163 return false;
1164
1165 if (!ctx.Read(m_srcMagazine))
1166 {
1167 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazine for weapon=" + m_weapon);
1168 return false;
1169 }
1170
1172 {
1173 Error("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponMagnumChambering.LoadCurrentFSMState: cannot read m_srcMagazinePrevLocation for weapon=" + m_weapon);
1174 return false;
1175 }
1176 return true;
1177 }
1178};
void wpnDebugPrint(string s)
Definition Debug.c:9
void DayZPlayerUtils()
cannot be instantiated
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition Guards.c:602
override void OnExit(HandEventBase e)
Definition Hand_States.c:28
HandStateEquipped OnEntry
FindInventoryLocationType
flags for searching locations in inventory
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
override void OnAbort()
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
int m_startActionType
class WeaponChambering_Cartridge_InnerMag extends WeaponChambering_Base IsWaitingForActionFinish
int m_endActionType
Magazine m_srcMagazine
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
Definition Inventory.c:79
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...
InventoryLocation.
provides access to slot configuration
static bool IsWeaponLogEnable()
Definition Debug.c:799
Definition EnMath.c:7
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
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
Definition Events.c:35
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
Definition BulletHide.c:2
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
WeaponActions m_action
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.
Definition EnDebug.c:90
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[.
WeaponActions
actions
Definition human.c:796