DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousQuantityRepeat.c
Go to the documentation of this file.
2{
3 protected float m_ItemQuantity;
4 protected float m_SpentQuantity;
5 protected float m_ItemMaxQuantity;
6 protected float m_TimeElpased;
7 protected float m_QuantityUsedPerSecond;
9 protected float m_DefaultTimeToRepeat;
11
17
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 }
31
32
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 }
64
66 {
67 if (!action_data.m_Player)
68 return UA_ERROR;
69 if (GetProgress() > 0)
71 return UA_CANCEL;
72 }
73
74 override float GetProgress()
75 {
76 //float progress = ( m_ItemQuantity - m_SpentQuantity ) / m_ItemMaxQuantity;
78 }
79
80 //---------------------------------------------------------------------------
81
82
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 }
96}
void CalcAndSetQuantity()
void SetACData(Param units)
Definition CABase.c:38
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
override void Setup(ActionData action_data)
void CalcAndSetQuantity(ActionData action_data)
override int Cancel(ActionData action_data)
override int Execute(ActionData action_data)
void CAContinuousQuantityRepeat(float quantity_used_per_second, float time_to_repeat)
proto native CGame GetGame()
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