DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousFillOil.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 if (!car)
29 return;
30
31 m_TimeElpased = 0;
33
34 if (!m_SpentUnits)
36 else
37 m_SpentUnits.param1 = 0;
38
39 float oilCapacity = car.GetFluidCapacity(CarFluid.OIL);
40 float currentOil = car.GetFluidFraction(CarFluid.OIL);
42
44 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
45
48
49 }
50
51 //---------------------------------------------------------------------------
53 {
54 Car car = Car.Cast(action_data.m_Target.GetObject());
55
56 if (!car)
57 return UA_ERROR;
58
59 if (!action_data.m_Player)
60 return UA_ERROR;
61
62 if (m_ItemQuantity <= 0)
63 return UA_FINISHED;
64 else
65 {
67 {
68 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus(m_QuantityUsedPerSecond, m_Action.GetSpecialtyWeight(), true);
70 m_TimeElpased += action_data.m_Player.GetDeltaT();
71
73 {
75 m_TimeElpased = 0;
76 //Setup(action_data); //reset data after repeat
77 }
78
79 return UA_PROCESSING;
80 }
81 else
82 {
85 return UA_FINISHED;
86 }
87 }
88 }
89
90 //---------------------------------------------------------------------------
92 {
93 if (!action_data.m_Player)
94 return UA_ERROR;
95
97 return UA_INTERRUPT;
98 }
99
100 //---------------------------------------------------------------------------
101 override float GetProgress()
102 {
103 if (m_ItemQuantity <= 0)
104 return 1;
105
107 }
108
109 //---------------------------------------------------------------------------
111 {
112
114
115 if (m_SpentUnits)
116 {
119 }
120
121
122 if (GetGame().IsServer())
123 {
124 if (action_data.m_MainItem) // Item EngineOil gets deleted after full consumption
125 action_data.m_MainItem.AddQuantity(-m_SpentQuantity);
126
127 Car car = Car.Cast(action_data.m_Target.GetObject());
128 car.Fill(CarFluid.OIL, (m_SpentQuantity * 0.001));
129 }
130
131 m_SpentQuantity = 0;
132 }
133}
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)
override float GetProgress()
override int Execute(ActionData action_data)
void CalcAndSetQuantity(ActionData action_data)
void CAContinuousFillOil(float quantity_used_per_second, float time_to_progress)
ref Param1< float > m_SpentUnits
override int Cancel(ActionData action_data)
override void Setup(ActionData action_data)
proto native CGame GetGame()
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