Dayz Explorer 1.28.160049
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
6 void CAContinuousWaterPlant( float quantity_used_per_second )
7 {
8 m_QuantityUsedPerSecond = quantity_used_per_second;
9 }
10
11 override void Setup( ActionData action_data )
12 {
13 PlantBase target_PB;
14 if (Class.CastTo(target_PB, action_data.m_Target.GetObject()))
15 {
17 if ( !m_SpentUnits )
18 {
19 m_SpentUnits = new Param1<float>(0);
20 }
21 else
22 {
23 m_SpentUnits.param1 = 0;
24 }
25 if ( action_data.m_MainItem )
26 {
27 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
28 }
29 if ( target_PB )
30 {
31 m_PlantThirstyness = target_PB.GetWaterMax() - target_PB.GetWater();
32 }
33
35 }
36 }
37
38 override int Execute( ActionData action_data )
39 {
40 if ( !action_data.m_Player )
41 {
42 return UA_ERROR;
43 }
44
45 if ( m_ItemQuantity <= 0 )
46 {
47 return UA_FINISHED;
48 }
49 else
50 {
52 {
54 m_SpentQuantity += m_QuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
55
56 if ( m_Action )
57 {
58 PlantBase plant;
59 Class.CastTo(plant, action_data.m_Target.GetObject() );
60 Slot slot = plant.GetSlot();
61 slot.GiveWater( m_SpentQuantity );
62 }
63 return UA_PROCESSING;
64 }
65 else
66 {
67 CalcAndSetQuantity( action_data );
68 OnCompletePogress(action_data);
69 return UA_FINISHED;
70 }
71 }
72 }
73
74 override float GetProgress()
75 {
76 //float progress = (m_SpentQuantity*m_QuantityUsedPerSecond)/m_TimeToComplete;
78 }
79};
ActionBase m_Action
Definition cabase.c:3
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
void CalcAndSetQuantity()
const int UA_FINISHED
Definition constants.c:466
const int UA_ERROR
Definition constants.c:485
const int UA_PROCESSING
Definition constants.c:464