3 protected float m_ItemQuantity;
4 protected float m_SpentQuantity;
5 protected float m_SpentQuantity_total;
6 protected float m_EmptySpace;
7 protected float m_TimeElpased;
8 protected float m_QuantityUsedPerSecond;
9 protected float m_AdjustedQuantityUsedPerSecond;
10 protected float m_DefaultTimeStep;
11 protected ref Param1<float> m_SpentUnits;
17 m_QuantityUsedPerSecond = quantity_used_per_second;
18 m_DefaultTimeStep = time_to_progress;
26 Car car = Car.Cast(action_data.m_Target.GetObject());
33 m_SpentUnits =
new Param1<float>( 0 );
37 m_SpentUnits.param1 = 0;
40 m_QuantityUsedPerSecond *=
Math.Min(action_data.m_MainItem.GetLiquidThroughputCoef(),car.GetLiquidThroughputCoef());
42 float fuelCapacity = car.GetFluidCapacity(
CarFluid.FUEL );
43 float currentFuel = car.GetFluidFraction(
CarFluid.FUEL );
44 currentFuel = currentFuel * fuelCapacity;
46 m_EmptySpace = (fuelCapacity - currentFuel) * 1000;
47 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
49 if ( m_EmptySpace <= m_ItemQuantity )
50 m_ItemQuantity = m_EmptySpace;
57 Car car = Car.Cast(action_data.m_Target.GetObject());
59 if ( !action_data.m_Player )
64 if ( m_ItemQuantity <= 0 )
70 if ( m_SpentQuantity_total < m_ItemQuantity )
72 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus( m_QuantityUsedPerSecond,
m_Action.GetSpecialtyWeight(),
true);
73 m_SpentQuantity += m_AdjustedQuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
74 m_TimeElpased += action_data.m_Player.GetDeltaT();
76 if ( m_TimeElpased >= m_DefaultTimeStep )
78 CalcAndSetQuantity( action_data );
87 CalcAndSetQuantity( action_data );
88 OnCompletePogress(action_data);
97 if ( !action_data.m_Player )
102 CalcAndSetQuantity( action_data );
107 override float GetProgress()
109 if ( m_ItemQuantity <= 0 )
112 return -(m_SpentQuantity_total / m_ItemQuantity);
116 void CalcAndSetQuantity(
ActionData action_data )
119 m_SpentQuantity_total += m_SpentQuantity;
123 m_SpentUnits.param1 = m_SpentQuantity;
124 SetACData(m_SpentUnits);
130 Car car = Car.Cast(action_data.m_Target.GetObject());
131 action_data.m_MainItem.AddQuantity( -m_SpentQuantity );
132 car.Fill(
CarFluid.FUEL, (m_SpentQuantity * 0.001) );