DayZ 1.24
Loading...
Searching...
No Matches
WeaponFireAndChamberNextFromInnerMag.c
Go to the documentation of this file.
1class WeaponFireAndChamberNextFromInnerMag extends WeaponStateBase
2{
4 int m_actionType;
5
6 float m_dtAccumulator;
8
10 {
12 m_actionType = actionType;
13
14 // setup nested state machine
15 m_fire = new WeaponFireAndChamber(m_weapon, this, m_action, m_actionType);
16
17 // events
18 WeaponEventBase _fin_ = new WeaponEventHumanCommandActionFinished;
19 WeaponEventAnimBulletEject __be_ = new WeaponEventAnimBulletEject;
20 WeaponEventReloadTimeout __to_ = new WeaponEventReloadTimeout;
21
22 m_fsm = new WeaponFSM(this); // @NOTE: set owner of the submachine fsm
23
24 // transitions
25 m_fsm.AddTransition(new WeaponTransition(m_fire, _fin_, NULL));
26 m_fsm.AddTransition(new WeaponTransition(m_fire, __to_, NULL));
27
28 m_fsm.SetInitialState(m_fire);
29 }
30
31 override void OnEntry(WeaponEventBase e)
32 {
33 super.OnEntry(e);
34 if (e)
36 }
37
38 override void OnUpdate(float dt)
39 {
42 Class.CastTo(p, m_weapon.GetHierarchyParent());
43 if (p)
44 {
45 HumanInputController hic = p.GetInputController();
46
47 int muzzleIndex = m_weapon.GetCurrentMuzzle();
48 float reloadTime = m_weapon.GetReloadTime(muzzleIndex);
49 if (hic.IsAttackButton() && m_dtAccumulator >= reloadTime)
50 if (m_weapon.CanProcessWeaponEvents())
51 m_weapon.ProcessWeaponEvent(new WeaponEventReloadTimeout(p));
52 }
53 }
54
55 override void OnExit(WeaponEventBase e)
56 {
58 super.OnExit(e);
59 }
60};
61
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition Guards.c:602
enum FSMTransition WeaponTransition
class WeaponEndAction extends WeaponStartAction m_action
class WeaponFireWithEject extends WeaponFire m_dtAccumulator
Super root of all classes in Enforce script.
Definition EnScript.c:11
signalize mechanism manipulation
Definition Events.c:35
weapon finite state machine
represent weapon state base
Definition BulletHide.c:2
int m_actionType
action to be played
WeaponActions m_action
override void OnEntry(WeaponEventBase e)
override void OnExit(WeaponEventBase e)
void WeaponFireAndChamberNextFromInnerMag(Weapon_Base w=NULL, WeaponStateBase parent=NULL, WeaponActions action=WeaponActions.NONE, int actionType=-1)
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
WeaponActions
actions
Definition human.c:796