DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousFill.c
Go to the documentation of this file.
2{
3 protected float m_TargetUnits;
4 protected float m_SpentQuantity;
5 protected float m_SpentQuantity_total;
6 protected float m_ItemQuantity;
8 protected float m_QuantityFilledPerSecond;
10 protected float m_TimeElpased;
11 protected float m_DefaultTimeStep = 0.25;
12 protected int m_liquid_type;
13
19
21 {
22 m_TimeElpased = 0;
23
24 if (!m_SpentUnits)
26 else
27 m_SpentUnits.param1 = 0;
28
29 float throughputCoef = action_data.m_MainItem.GetLiquidThroughputCoef();
31 if (action_data.m_Target && action_data.m_Target.GetObject() && Class.CastTo(entity, action_data.m_Target.GetObject()))
32 throughputCoef = Math.Min(throughputCoef, entity.GetLiquidThroughputCoef());
34
35 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
36 m_TargetUnits = action_data.m_MainItem.GetQuantityMax() - action_data.m_MainItem.GetQuantity();
37 m_AdjustedQuantityFilledPerSecond = action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(m_QuantityFilledPerSecond, m_Action.GetSpecialtyWeight(), true);
38 }
39
41 {
42 if (!action_data.m_Player)
43 return UA_ERROR;
44
45 if (action_data.m_MainItem.GetQuantity() >= action_data.m_MainItem.GetQuantityMax())
46 return UA_FINISHED;
47 else
48 {
50 {
52 m_TimeElpased += action_data.m_Player.GetDeltaT();
53
55 {
57 m_TimeElpased = 0;
58 //Setup(action_data); //reset data after repeat
59 }
60 return UA_PROCESSING;
61 }
62 else
63 {
66 return UA_FINISHED;
67 }
68 }
69 }
70
72 {
73 if (!action_data.m_Player || !action_data.m_MainItem)
74 return UA_ERROR;
75
77 return UA_CANCEL;
78 }
79
81 {
82 if (GetGame().IsServer())
83 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(UASoftSkillsWeight.PRECISE_LOW);
84
85 return super.Interrupt(action_data);
86 }
87
88 override float GetProgress()
89 {
91 }
92 //---------------------------------------------------------------------------
93
95 {
97 if (GetGame().IsServer())
98 {
99 if (m_SpentUnits)
100 {
103 }
104
105 bool injectAgents = true;
106 if (action_data.m_Target.GetObject() && (action_data.m_Target.GetObject().GetWaterSourceObjectType() == EWaterSourceObjectType.WELL || action_data.m_Target.GetObject().IsWell()))
107 injectAgents = false;
108
110 }
111
112 m_SpentQuantity = 0;
113 }
114}
EWaterSourceObjectType
void CalcAndSetQuantity()
void SetACData(Param units)
Definition CABase.c:38
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
override int Interrupt(ActionData action_data)
override int Cancel(ActionData action_data)
override int Execute(ActionData action_data)
override void Setup(ActionData action_data)
ref Param1< float > m_SpentUnits
override float GetProgress()
void CalcAndSetQuantity(ActionData action_data)
float m_QuantityFilledPerSecond
void CAContinuousFill(float quantity_filled_per_second, int liquid_type)
float m_AdjustedQuantityFilledPerSecond
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Liquid.c:2
static void FillContainerEnviro(ItemBase container, int liquid_type, float amount, bool inject_agents=false)
Definition Liquid.c:126
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
const int UA_CANCEL
Definition constants.c:437