DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousEmptyMagazine Class Reference
Inheritance diagram for CAContinuousEmptyMagazine:
[legend]
Collaboration diagram for CAContinuousEmptyMagazine:
[legend]

Protected Member Functions

void CAContinuousEmptyMagazine (float eject_time)
 
override void Setup (ActionData action_data)
 
override int Execute (ActionData action_data)
 
override int Cancel (ActionData action_data)
 
override float GetProgress ()
 
void CalcAndSetQuantity (ActionData action_data)
 

Protected Attributes

float m_TargetUnits
 
float m_SpentQuantity
 
float m_Time
 
float m_TimeToEjectOneBullet
 
ref Param1< floatm_SpentUnits
 

Detailed Description

Definition at line 1 of file CAContinuousEmptyMagazine.c.

Constructor & Destructor Documentation

◆ CAContinuousEmptyMagazine()

void CAContinuousEmptyMagazine::CAContinuousEmptyMagazine ( float eject_time)
inlineprotected

Member Function Documentation

◆ CalcAndSetQuantity()

void CAContinuousEmptyMagazine::CalcAndSetQuantity ( ActionData action_data)
inlineprotected

Definition at line 73 of file CAContinuousEmptyMagazine.c.

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 }
void SetACData(Param units)
Definition CABase.c:38
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.

References Class::CastTo(), GetGame(), m_SpentQuantity, m_SpentUnits, and CABase::SetACData().

◆ Cancel()

override int CAContinuousEmptyMagazine::Cancel ( ActionData action_data)
inlineprotected

Definition at line 56 of file CAContinuousEmptyMagazine.c.

57 {
58 if (!action_data.m_Player || !action_data.m_MainItem)
59 return UA_ERROR;
60
62 return UA_CANCEL;
63 }
void CalcAndSetQuantity()
const int UA_ERROR
Definition constants.c:455
const int UA_CANCEL
Definition constants.c:437

References CalcAndSetQuantity(), UA_CANCEL, and UA_ERROR.

◆ Execute()

override int CAContinuousEmptyMagazine::Execute ( ActionData action_data)
inlineprotected

Definition at line 28 of file CAContinuousEmptyMagazine.c.

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 }
void OnCompletePogress(ActionData action_data)
const int UA_FINISHED
Definition constants.c:436
const int UA_PROCESSING
Definition constants.c:434

References CalcAndSetQuantity(), m_SpentQuantity, m_TargetUnits, m_Time, m_TimeToEjectOneBullet, CAContinuousBase::OnCompletePogress(), UA_ERROR, UA_FINISHED, and UA_PROCESSING.

◆ GetProgress()

override float CAContinuousEmptyMagazine::GetProgress ( )
inlineprotected

Definition at line 65 of file CAContinuousEmptyMagazine.c.

66 {
67 //float progress = m_SpentQuantity/m_TargetUnits;
69 }

References m_SpentQuantity, and m_TargetUnits.

◆ Setup()

override void CAContinuousEmptyMagazine::Setup ( ActionData action_data)
inlineprotected

Definition at line 15 of file CAContinuousEmptyMagazine.c.

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 }

References Class::CastTo(), m_SpentQuantity, m_SpentUnits, and m_TargetUnits.

Member Data Documentation

◆ m_SpentQuantity

float CAContinuousEmptyMagazine::m_SpentQuantity
protected

Definition at line 4 of file CAContinuousEmptyMagazine.c.

Referenced by CalcAndSetQuantity(), Execute(), GetProgress(), and Setup().

◆ m_SpentUnits

ref Param1<float> CAContinuousEmptyMagazine::m_SpentUnits
protected

Definition at line 7 of file CAContinuousEmptyMagazine.c.

Referenced by CalcAndSetQuantity(), and Setup().

◆ m_TargetUnits

float CAContinuousEmptyMagazine::m_TargetUnits
protected

Definition at line 3 of file CAContinuousEmptyMagazine.c.

Referenced by Execute(), GetProgress(), and Setup().

◆ m_Time

float CAContinuousEmptyMagazine::m_Time
protected

Definition at line 5 of file CAContinuousEmptyMagazine.c.

Referenced by CAContinuousEmptyMagazine(), and Execute().

◆ m_TimeToEjectOneBullet

float CAContinuousEmptyMagazine::m_TimeToEjectOneBullet
protected

Definition at line 6 of file CAContinuousEmptyMagazine.c.

Referenced by CAContinuousEmptyMagazine(), and Execute().


The documentation for this class was generated from the following file: