DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousEmptyMagazine.c
Go to the documentation of this file.
2{
3 protected float m_TargetUnits;
4 protected float m_SpentQuantity;
5 protected float m_Time;
6 protected float m_TimeToEjectOneBullet;
8
14
16 {
17 if (!m_SpentUnits)
19 else
20 m_SpentUnits.param1 = 0;
23 Class.CastTo(itm, action_data.m_MainItem);
24 m_TargetUnits = itm.GetAmmoCount();
25
26 }
27
29 {
30 if (!action_data.m_Player)
31 return UA_ERROR;
32
33 if (m_TargetUnits == 0)
34 return UA_FINISHED;
35 else
36 {
38 {
39 m_Time += action_data.m_Player.GetDeltaT();
41 {
42 m_Time = 0;
43 m_SpentQuantity += 1;
44 }
45 return UA_PROCESSING;
46 }
47 else
48 {
51 return UA_FINISHED;
52 }
53 }
54 }
55
57 {
58 if (!action_data.m_Player || !action_data.m_MainItem)
59 return UA_ERROR;
60
62 return UA_CANCEL;
63 }
64
65 override float GetProgress()
66 {
67 //float progress = m_SpentQuantity/m_TargetUnits;
69 }
70
71 //---------------------------------------------------------------------------
72
74 {
75 if (GetGame().IsServer())
76 {
77 if (action_data.m_MainItem)
78 {
80 Class.CastTo(itm, action_data.m_MainItem);
81 if (m_SpentUnits)
82 {
85 }
86 itm.ServerAddAmmoCount(-m_SpentQuantity);
87 }
88 }
89 }
90};
void CalcAndSetQuantity()
void SetACData(Param units)
Definition CABase.c:38
void OnCompletePogress(ActionData action_data)
override int Execute(ActionData action_data)
void CAContinuousEmptyMagazine(float eject_time)
override void Setup(ActionData action_data)
void CalcAndSetQuantity(ActionData action_data)
override int Cancel(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int UA_FINISHED
Definition constants.c:436
const int UA_ERROR
Definition constants.c:455
const int UA_PROCESSING
Definition constants.c:434
const int UA_CANCEL
Definition constants.c:437