DayZ 1.24
Loading...
Searching...
No Matches
WeaponFire.c File Reference

Go to the source code of this file.

Classes

class  WeaponStartAction
 simple class starting animation action specified by m_action and m_actionType More...
 
class  WeaponFire
 
class  WeaponFireMultiMuzzle
 

Functions

override bool IsWaitingForActionFinish ()
 
override void OnEntry (WeaponEventBase e)
 
override void OnUpdate (float dt)
 
override void OnExit (WeaponEventBase e)
 
override void OnAbort (WeaponEventBase e)
 

Variables

class WeaponFireWithEject extends WeaponFire m_dtAccumulator
 

Function Documentation

◆ IsWaitingForActionFinish()

override bool IsWaitingForActionFinish ( )

Definition at line 123 of file WeaponFire.c.

123{ return true; }

◆ OnAbort()

Definition at line 188 of file WeaponFire.c.

189 {
190 m_weapon.ResetBurstCount();
191 super.OnAbort(e);
192 }
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Definition Guards.c:602

References m_weapon.

◆ OnEntry()

Definition at line 125 of file WeaponFire.c.

126 {
127 if (e)
128 {
129 m_dtAccumulator = 0;
130
131 if (LogManager.IsWeaponLogEnable()) wpnPrint("[wpnfsm] " + Object.GetDebugName(m_weapon) + " WeaponFire bang bang!");
132
133 int mi = m_weapon.GetCurrentMuzzle();
134 int b = m_weapon.GetCurrentModeBurstSize(mi);
135 if (b > 1)
136 {
137
138 for (int i = 0; i < b; i++)
139 {
141 {
143 if (Class.CastTo(p1, e.m_player))
144 p1.GetAimingModel().SetRecoil(m_weapon);
145 m_weapon.OnFire(i);
146 }
147 }
148 }
149 else
150 {
152 {
154 if (Class.CastTo(p, e.m_player))
155 p.GetAimingModel().SetRecoil(m_weapon);
156 m_weapon.OnFire(mi);
157 }
158 }
159 if (mi >= m_weapon.GetMuzzleCount() - 1)
160 m_weapon.SetCurrentMuzzle(0);
161 else
162 m_weapon.SetCurrentMuzzle(mi + 1);
163 }
164 super.OnEntry(e);
165 }
void wpnPrint(string s)
Definition Debug.c:1
class WeaponFireWithEject extends WeaponFire m_dtAccumulator
proto native bool TryFireWeapon(EntityAI weapon, int muzzleIndex)
Super root of all classes in Enforce script.
Definition EnScript.c:11
static bool IsWeaponLogEnable()
Definition Debug.c:799
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), LogManager::IsWeaponLogEnable(), m_dtAccumulator, m_weapon, TryFireWeapon(), and wpnPrint().

◆ OnExit()

Definition at line 181 of file WeaponFire.c.

182 {
183 if (e)
184 m_dtAccumulator = 0;
185 super.OnExit(e);
186 }

References m_dtAccumulator.

◆ OnUpdate()

override void OnUpdate ( float dt)

Definition at line 167 of file WeaponFire.c.

168 {
170
172 Class.CastTo(p, m_weapon.GetHierarchyParent());
173
174 int muzzleIndex = m_weapon.GetCurrentMuzzle();
175 float reloadTime = m_weapon.GetReloadTime(muzzleIndex);
177 if (m_weapon.CanProcessWeaponEvents())
178 m_weapon.ProcessWeaponEvent(new WeaponEventReloadTimeout(p));
179 }

References Class::CastTo(), m_dtAccumulator, and m_weapon.

Variable Documentation

◆ m_dtAccumulator