DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousFillFuel.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.GetObject());
27
28 m_TimeElpased = 0;
30
31 if (!m_SpentUnits)
33 else
34 m_SpentUnits.param1 = 0;
35
36 m_QuantityUsedPerSecond *= Math.Min(action_data.m_MainItem.GetLiquidThroughputCoef(), car.GetLiquidThroughputCoef());
37
38 float fuelCapacity = car.GetFluidCapacity(CarFluid.FUEL);
39 float currentFuel = car.GetFluidFraction(CarFluid.FUEL);
41
43 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
44
47
48 }
49
50 //---------------------------------------------------------------------------
52 {
53 Car car = Car.Cast(action_data.m_Target.GetObject());
54
55 if (!action_data.m_Player)
56 return UA_ERROR;
57
58 if (m_ItemQuantity <= 0)
59 return UA_FINISHED;
60 else
61 {
63 {
64 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus(m_QuantityUsedPerSecond, m_Action.GetSpecialtyWeight(), true);
66 m_TimeElpased += action_data.m_Player.GetDeltaT();
67
69 {
71 m_TimeElpased = 0;
72 //Setup(action_data); //reset data after repeat
73 }
74
75 return UA_PROCESSING;
76 }
77 else
78 {
81 return UA_FINISHED;
82 }
83 }
84 }
85
86 //---------------------------------------------------------------------------
88 {
89 if (!action_data.m_Player)
90 return UA_ERROR;
91
93 return UA_INTERRUPT;
94 }
95
96 //---------------------------------------------------------------------------
97 override float GetProgress()
98 {
99 if (m_ItemQuantity <= 0)
100 return 1;
101
103 }
104
105 //---------------------------------------------------------------------------
107 {
108
110
111 if (m_SpentUnits)
112 {
115 }
116
117
118 if (GetGame().IsServer())
119 {
120 Car car = Car.Cast(action_data.m_Target.GetObject());
121 action_data.m_MainItem.AddQuantity(-m_SpentQuantity);
122 car.Fill(CarFluid.FUEL, (m_SpentQuantity * 0.001));
123 }
124
125 m_SpentQuantity = 0;
126 }
127}
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 CalcAndSetQuantity(ActionData action_data)
override float GetProgress()
override int Execute(ActionData action_data)
override int Cancel(ActionData action_data)
ref Param1< float > m_SpentUnits
override void Setup(ActionData action_data)
void CAContinuousFillFuel(float quantity_used_per_second, float time_to_progress)
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