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

Protected Member Functions

void CAContinuousWaterPlant (float quantity_used_per_second)
 
override void Setup (ActionData action_data)
 
override int Execute (ActionData action_data)
 
override float GetProgress ()
 

Protected Attributes

float m_PlantThirstyness
 
float m_TimeToComplete
 

Additional Inherited Members

- Private Member Functions inherited from CAContinuousQuantity
void CAContinuousQuantity (float quantity_used_per_second)
 
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 CAContinuousQuantity
float m_ItemQuantity
 
float m_SpentQuantity
 
float m_ItemMaxQuantity
 
float m_QuantityUsedPerSecond
 
float m_AdjustedQuantityUsedPerSecond
 
ref Param1< floatm_SpentUnits
 

Detailed Description

Definition at line 1 of file CAContinuousWaterPlant.c.

Constructor & Destructor Documentation

◆ CAContinuousWaterPlant()

void CAContinuousWaterPlant::CAContinuousWaterPlant ( float quantity_used_per_second)
inlineprotected

Member Function Documentation

◆ Execute()

override int CAContinuousWaterPlant::Execute ( ActionData action_data)
inlineprotected

Definition at line 30 of file CAContinuousWaterPlant.c.

31 {
32 if (!action_data.m_Player)
33 return UA_ERROR;
34
35 if (m_ItemQuantity <= 0)
36 return UA_FINISHED;
37 else
38 {
40 {
41 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(m_QuantityUsedPerSecond, m_Action.GetSpecialtyWeight(), true);
42 m_SpentQuantity += m_QuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
43
44 if (m_Action)
45 {
46 PlantBase plant;
47 Class.CastTo(plant, action_data.m_Target.GetObject());
48 Slot slot = plant.GetSlot();
49 slot.GiveWater(m_SpentQuantity);
50 }
51 return UA_PROCESSING;
52 }
53 else
54 {
57 return UA_FINISHED;
58 }
59 }
60 }
void CalcAndSetQuantity()
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int UA_FINISHED
Definition constants.c:436
const int UA_ERROR
Definition constants.c:455
const int UA_PROCESSING
Definition constants.c:434

References CalcAndSetQuantity(), Class::CastTo(), CABase::m_Action, CAContinuousQuantity::m_AdjustedQuantityUsedPerSecond, CAContinuousQuantity::m_ItemQuantity, m_PlantThirstyness, CAContinuousQuantity::m_QuantityUsedPerSecond, CAContinuousQuantity::m_SpentQuantity, CAContinuousBase::OnCompletePogress(), UA_ERROR, UA_FINISHED, and UA_PROCESSING.

◆ GetProgress()

override float CAContinuousWaterPlant::GetProgress ( )
inlineprotected

Definition at line 62 of file CAContinuousWaterPlant.c.

63 {
64 //float progress = (m_SpentQuantity*m_QuantityUsedPerSecond)/m_TimeToComplete;
66 }

References CAContinuousQuantity::m_QuantityUsedPerSecond, CAContinuousQuantity::m_SpentQuantity, and m_TimeToComplete.

◆ Setup()

override void CAContinuousWaterPlant::Setup ( ActionData action_data)
inlineprotected

Definition at line 11 of file CAContinuousWaterPlant.c.

12 {
13 PlantBase target_PB;
14 if (Class.CastTo(target_PB, action_data.m_Target.GetObject()))
15 {
17 if (!m_SpentUnits)
19 else
20 m_SpentUnits.param1 = 0;
21 if (action_data.m_MainItem)
22 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
23 if (target_PB)
24 m_PlantThirstyness = target_PB.GetWaterMax() - target_PB.GetWater();
25
27 }
28 }
ref Param1< float > m_SpentUnits
Definition EnMath.c:7
static proto float Min(float x, float y)
Returns smaller of two given values.

References Class::CastTo(), CAContinuousQuantity::m_ItemQuantity, m_PlantThirstyness, CAContinuousQuantity::m_QuantityUsedPerSecond, CAContinuousQuantity::m_SpentQuantity, CAContinuousQuantity::m_SpentUnits, m_TimeToComplete, and Math::Min().

Member Data Documentation

◆ m_PlantThirstyness

float CAContinuousWaterPlant::m_PlantThirstyness
protected

Definition at line 3 of file CAContinuousWaterPlant.c.

Referenced by Execute(), and Setup().

◆ m_TimeToComplete

float CAContinuousWaterPlant::m_TimeToComplete
protected

Definition at line 4 of file CAContinuousWaterPlant.c.

Referenced by GetProgress(), and Setup().


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