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

Protected Member Functions

void CAContinuousQuantityRepeat (float quantity_used_per_second, float time_to_repeat)
 
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_ItemQuantity
 
float m_SpentQuantity
 
float m_ItemMaxQuantity
 
float m_TimeElpased
 
float m_QuantityUsedPerSecond
 
float m_AdjustedQuantityUsedPerSecond
 
float m_DefaultTimeToRepeat
 
ref Param1< floatm_SpentUnits
 

Detailed Description

Definition at line 1 of file CAContinuousQuantityRepeat.c.

Constructor & Destructor Documentation

◆ CAContinuousQuantityRepeat()

void CAContinuousQuantityRepeat::CAContinuousQuantityRepeat ( float quantity_used_per_second,
float time_to_repeat )
inlineprotected

Member Function Documentation

◆ CalcAndSetQuantity()

void CAContinuousQuantityRepeat::CalcAndSetQuantity ( ActionData action_data)
inlineprotected

Definition at line 83 of file CAContinuousQuantityRepeat.c.

84 {
85 if (GetGame().IsServer())
86 {
87 if (m_SpentUnits)
88 {
91 }
92
93 action_data.m_MainItem.AddQuantity(-m_SpentQuantity, false, false);
94 }
95 }
void SetACData(Param units)
Definition CABase.c:38
proto native CGame GetGame()

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

◆ Cancel()

override int CAContinuousQuantityRepeat::Cancel ( ActionData action_data)
inlineprotected

Definition at line 65 of file CAContinuousQuantityRepeat.c.

66 {
67 if (!action_data.m_Player)
68 return UA_ERROR;
69 if (GetProgress() > 0)
71 return UA_CANCEL;
72 }
void CalcAndSetQuantity()
const int UA_ERROR
Definition constants.c:455
const int UA_CANCEL
Definition constants.c:437

References CalcAndSetQuantity(), GetProgress(), UA_CANCEL, and UA_ERROR.

◆ Execute()

override int CAContinuousQuantityRepeat::Execute ( ActionData action_data)
inlineprotected

Definition at line 33 of file CAContinuousQuantityRepeat.c.

34 {
35 if (!action_data.m_Player)
36 return UA_ERROR;
37
38 if (m_ItemQuantity <= 0)
39 return UA_FINISHED;
40 else
41 {
43 {
44 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(m_QuantityUsedPerSecond, m_Action.GetSpecialtyWeight(), true);
46 m_TimeElpased += action_data.m_Player.GetDeltaT();
47
49 {
51 Setup(action_data); //reset data after repeat
52 }
53
54 return UA_PROCESSING;
55 }
56 else
57 {
60 return UA_FINISHED;
61 }
62 }
63 }
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
override void Setup(ActionData action_data)
const int UA_FINISHED
Definition constants.c:436
const int UA_PROCESSING
Definition constants.c:434

References CalcAndSetQuantity(), CABase::m_Action, m_AdjustedQuantityUsedPerSecond, m_DefaultTimeToRepeat, m_ItemQuantity, m_QuantityUsedPerSecond, m_SpentQuantity, m_TimeElpased, CAContinuousBase::OnCompletePogress(), Setup(), UA_ERROR, UA_FINISHED, and UA_PROCESSING.

◆ GetProgress()

override float CAContinuousQuantityRepeat::GetProgress ( )
inlineprotected

Definition at line 74 of file CAContinuousQuantityRepeat.c.

75 {
76 //float progress = ( m_ItemQuantity - m_SpentQuantity ) / m_ItemMaxQuantity;
78 }

References m_ItemMaxQuantity, m_ItemQuantity, and m_SpentQuantity.

Referenced by Cancel().

◆ Setup()

override void CAContinuousQuantityRepeat::Setup ( ActionData action_data)
inlineprotected

Definition at line 18 of file CAContinuousQuantityRepeat.c.

19 {
20 m_TimeElpased = 0;
22
23 if (!m_SpentUnits)
25 else
26 m_SpentUnits.param1 = 0;
27
28 m_ItemMaxQuantity = action_data.m_MainItem.GetQuantityMax();
29 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
30 }

References m_ItemMaxQuantity, m_ItemQuantity, m_SpentQuantity, m_SpentUnits, and m_TimeElpased.

Referenced by Execute().

Member Data Documentation

◆ m_AdjustedQuantityUsedPerSecond

float CAContinuousQuantityRepeat::m_AdjustedQuantityUsedPerSecond
protected

Definition at line 8 of file CAContinuousQuantityRepeat.c.

Referenced by Execute(), and CAContinuousWringClothes::Execute().

◆ m_DefaultTimeToRepeat

◆ m_ItemMaxQuantity

float CAContinuousQuantityRepeat::m_ItemMaxQuantity
protected

Definition at line 5 of file CAContinuousQuantityRepeat.c.

Referenced by GetProgress(), and Setup().

◆ m_ItemQuantity

float CAContinuousQuantityRepeat::m_ItemQuantity
protected

Definition at line 3 of file CAContinuousQuantityRepeat.c.

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

◆ m_QuantityUsedPerSecond

◆ m_SpentQuantity

◆ m_SpentUnits

◆ m_TimeElpased

float CAContinuousQuantityRepeat::m_TimeElpased
protected

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