DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousFillCoolant.c
Go to the documentation of this file.
2{
3 protected float m_ItemQuantity;
4 protected float m_SpentQuantity;
5 protected float m_SpentQuantity_total;
6 protected float m_EmptySpace; //basically free capacity
7 protected float m_TimeElpased;
8 protected float m_QuantityUsedPerSecond;
10 protected float m_DefaultTimeStep;
12
14
20
21 //---------------------------------------------------------------------------
23 {
24 m_Player = action_data.m_Player;
25
26 Car car = Car.Cast(action_data.m_Target.GetParent());
27
28 if (!car)
29 return;
30
31 m_TimeElpased = 0;
33
34 if (!m_SpentUnits)
36 else
37 m_SpentUnits.param1 = 0;
38
39 m_QuantityUsedPerSecond *= Math.Min(action_data.m_MainItem.GetLiquidThroughputCoef(), car.GetLiquidThroughputCoef());
40
41 float coolCapacity = car.GetFluidCapacity(CarFluid.COOLANT);
42 float currentCool = car.GetFluidFraction(CarFluid.COOLANT);
44
46 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
47
50
51 }
52
53 //---------------------------------------------------------------------------
55 {
56 Car car = Car.Cast(action_data.m_Target.GetParent());
57
58 if (!car)
59 return UA_ERROR;
60
61 if (!action_data.m_Player)
62 return UA_ERROR;
63
64 if (m_ItemQuantity <= 0)
65 return UA_FINISHED;
66 else
67 {
69 {
70 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus(m_QuantityUsedPerSecond, m_Action.GetSpecialtyWeight(), true);
72 m_TimeElpased += action_data.m_Player.GetDeltaT();
73
75 {
77 m_TimeElpased = 0;
78 //Setup(action_data); //reset data after repeat
79 }
80
81 return UA_PROCESSING;
82 }
83 else
84 {
87 return UA_FINISHED;
88 }
89 }
90 }
91
92 //---------------------------------------------------------------------------
94 {
95 if (!action_data.m_Player)
96 return UA_ERROR;
97
99 return UA_INTERRUPT;
100 }
101
102 //---------------------------------------------------------------------------
103 override float GetProgress()
104 {
105 if (m_ItemQuantity <= 0)
106 return 1;
107
109 }
110
111 //---------------------------------------------------------------------------
113 {
114
116
117 if (m_SpentUnits)
118 {
121 }
122
123 if (GetGame().IsServer())
124 {
125 if (action_data.m_MainItem)
126 action_data.m_MainItem.AddQuantity(-m_SpentQuantity);
127
128 Car car = Car.Cast(action_data.m_Target.GetParent());
129 if (car)
130 car.Fill(CarFluid.COOLANT, (m_SpentQuantity * 0.001));
131 }
132
133 m_SpentQuantity = 0;
134 }
135}
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:18
void CalcAndSetQuantity()
void SetACData(Param units)
Definition CABase.c:38
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
void CAContinuousFillCoolant(float quantity_used_per_second, float time_to_progress)
override int Cancel(ActionData action_data)
override int Execute(ActionData action_data)
override void Setup(ActionData action_data)
void CalcAndSetQuantity(ActionData action_data)
Definition EnMath.c:7
proto native CGame GetGame()
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_INTERRUPT
Definition constants.c:438
const int UA_PROCESSING
Definition constants.c:434