DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousFertilizeGardenSlot.c
Go to the documentation of this file.
2{
3 protected float m_SlotFertilizerNeed;
4 protected float m_TimeToComplete;
5 protected float m_SpentQuantityTotal;
6 protected float m_StartQuantity;
7 protected Slot m_Slot;
8 protected string m_Selection;
9
15
17 {
19 if (Class.CastTo(target_GB, action_data.m_Target.GetObject()))
20 {
22 m_StartQuantity = action_data.m_MainItem.GetQuantity();
23
24 if (!m_SpentUnits)
26 else
27 m_SpentUnits.param1 = 0;
28
29 if (action_data.m_MainItem)
30 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
31
32 if (target_GB)
33 {
34 /*string selection = target_GB.GetActionComponentName(action_data.m_Target.GetComponentIndex());
35
36 Slot slot = target_GB.GetSlotBySelection( selection );*/
37
39 target_GB.GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selections);
40
41 for (int s = 0; s < selections.Count(); s++)
42 {
43 //string selection = selections[s];
45 m_Slot = target_GB.GetSlotBySelection(m_Selection);
46 if (m_Slot)
47 break;
48 }
49
50
51 string item_type = action_data.m_MainItem.GetType();
52 float consumed_quantity = GetGame().ConfigGetFloat("cfgVehicles " + item_type + " Horticulture ConsumedQuantity");
53
54 float max = m_Slot.GetFertilizerQuantityMax();
55
57 }
59 }
60 }
61
62
64 {
65 if (!action_data.m_Player)
66 return UA_ERROR;
67
69 return UA_FINISHED;
70 else
71 {
73 {
74 m_SpentQuantity += m_QuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
75 float val = action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(m_SpentQuantity, m_Action.GetSpecialtyWeight(), true);
77 Class.CastTo(garden_base, action_data.m_Target.GetObject());
78 //string selection = garden_base.GetActionComponentName(action_data.m_Target.GetComponentIndex());
79
81
82 if (GetGame().IsServer())
83 action_data.m_MainItem.AddQuantity(-m_SpentQuantity);
84
85 garden_base.Fertilize(action_data.m_Player, action_data.m_MainItem, val, m_Selection);
86
87 return UA_PROCESSING;
88 }
89 else
90 {
93 return UA_FINISHED;
94 }
95 }
96 }
97
98 override float GetProgress()
99 {
100 /*if ( m_TimeToComplete == 0) //Prevent division by 0 case
101 {
102 return -1;
103 }*/
105 //return (m_SpentQuantity)/m_ItemQuantity;///(m_TimeToComplete * m_QuantityUsedPerSecond)/m_ItemQuantity;
106 }
107};
void CalcAndSetQuantity()
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
void CAContinuousFertilizeGardenSlot(float quantity_used_per_second)
override int Execute(ActionData action_data)
override void Setup(ActionData action_data)
ref Param1< float > m_SpentUnits
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition EnMath.c:7
proto native CGame GetGame()
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