DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousWaterPlant.c
Go to the documentation of this file.
2{
3 protected float m_PlantThirstyness;
4 protected float m_TimeToComplete;
5
10
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 }
29
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 }
61
62 override float GetProgress()
63 {
64 //float progress = (m_SpentQuantity*m_QuantityUsedPerSecond)/m_TimeToComplete;
66 }
67};
void CalcAndSetQuantity()
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
ref Param1< float > m_SpentUnits
void CAContinuousWaterPlant(float quantity_used_per_second)
override int Execute(ActionData action_data)
override void Setup(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition EnMath.c:7
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Min(float x, float y)
Returns smaller of two given values.
const int UA_FINISHED
Definition constants.c:436
const int UA_ERROR
Definition constants.c:455
const int UA_PROCESSING
Definition constants.c:434