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

Protected Member Functions

void CAContinuousQuantityEdible (float quantity_used_per_second, float time_to_repeat)
 
override void Setup (ActionData action_data)
 
override void CalcAndSetQuantity (ActionData action_data)
 
override float GetProgress ()
 

Protected Attributes

float m_InitItemQuantity
 
float m_SpentQuantityTotal
 

Additional Inherited Members

- Private Member Functions inherited from CAContinuousQuantityRepeat
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)
 
- Private Attributes inherited from CAContinuousQuantityRepeat
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 CAContinuousQuantityEdible.c.

Constructor & Destructor Documentation

◆ CAContinuousQuantityEdible()

Member Function Documentation

◆ CalcAndSetQuantity()

override void CAContinuousQuantityEdible::CalcAndSetQuantity ( ActionData action_data)
inlineprotected

Definition at line 22 of file CAContinuousQuantityEdible.c.

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 }
EConsumeType
Definition EConsumeType.c:2
void SetACData(Param units)
Definition CABase.c:38
proto native CGame GetGame()

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

◆ GetProgress()

override float CAContinuousQuantityEdible::GetProgress ( )
inlineprotected

Definition at line 54 of file CAContinuousQuantityEdible.c.

55 {
56 //return super.GetProgress();
57 if (m_SpentQuantity > 0)
59 else
61 }
Definition EnMath.c:7
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'.

References Math::Clamp(), m_InitItemQuantity, CAContinuousQuantityRepeat::m_SpentQuantity, and m_SpentQuantityTotal.

◆ Setup()

override void CAContinuousQuantityEdible::Setup ( ActionData action_data)
inlineprotected

Definition at line 14 of file CAContinuousQuantityEdible.c.

15 {
16 super.Setup(action_data);
17
18 if (m_InitItemQuantity < 0)
19 m_InitItemQuantity = action_data.m_MainItem.GetQuantity();
20 }

References m_InitItemQuantity.

Member Data Documentation

◆ m_InitItemQuantity

float CAContinuousQuantityEdible::m_InitItemQuantity
protected

Definition at line 3 of file CAContinuousQuantityEdible.c.

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

◆ m_SpentQuantityTotal

float CAContinuousQuantityEdible::m_SpentQuantityTotal
protected

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