DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousQuantityEdible.c
Go to the documentation of this file.
2{
3 protected float m_InitItemQuantity;
4 protected float m_SpentQuantityTotal;
5
13
15 {
16 super.Setup(action_data);
17
18 if (m_InitItemQuantity < 0)
19 m_InitItemQuantity = action_data.m_MainItem.GetQuantity();
20 }
21
23 {
24 //Print("Munch!");
25 if (m_SpentUnits)
26 {
29
31 }
32 //m_SpentQuantity = Math.Floor(m_SpentQuantity);
33
34 PlayerBase ntarget = PlayerBase.Cast(action_data.m_Target.GetObject());
35 if (ntarget)
36 {
37 if (GetGame().IsServer())
38 {
39 //action_data.m_MainItem.Consume(targetObject, m_SpentQuantity);
40 ntarget.Consume(action_data.m_MainItem, m_SpentQuantity, EConsumeType.ITEM_CONTINUOUS);
41
42 }
43 }
44 else
45 {
46 if (GetGame().IsServer())
47 {
48 //action_data.m_MainItem.Consume(action_data.m_Player, m_SpentQuantity);
49 action_data.m_Player.Consume(action_data.m_MainItem, m_SpentQuantity, EConsumeType.ITEM_CONTINUOUS);
50 }
51 }
52 }
53
54 override float GetProgress()
55 {
56 //return super.GetProgress();
57 if (m_SpentQuantity > 0)
59 else
61 }
62};
EConsumeType
Definition EConsumeType.c:2
void SetACData(Param units)
Definition CABase.c:38
void CAContinuousQuantityEdible(float quantity_used_per_second, float time_to_repeat)
override void Setup(ActionData action_data)
override void CalcAndSetQuantity(ActionData action_data)
Definition EnMath.c:7
proto native CGame GetGame()
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.