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());
36 m_SpentUnits =
new Param1<float>( 0 );
40 m_SpentUnits.param1 = 0;
43 float oilCapacity = car.GetFluidCapacity(
CarFluid.OIL );
44 float currentOil = car.GetFluidFraction(
CarFluid.OIL );
45 currentOil = currentOil * oilCapacity;
47 m_EmptySpace = (oilCapacity - currentOil) * 1000;
48 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
50 if ( m_EmptySpace <= m_ItemQuantity )
51 m_ItemQuantity = m_EmptySpace;
58 Car car = Car.Cast(action_data.m_Target.GetObject());
63 if ( !action_data.m_Player )
68 if ( m_ItemQuantity <= 0 )
74 if ( m_SpentQuantity_total < m_ItemQuantity )
76 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus( m_QuantityUsedPerSecond,
m_Action.GetSpecialtyWeight(),
true);
77 m_SpentQuantity += m_AdjustedQuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
78 m_TimeElpased += action_data.m_Player.GetDeltaT();
80 if ( m_TimeElpased >= m_DefaultTimeStep )
82 CalcAndSetQuantity( action_data );
91 CalcAndSetQuantity( action_data );
92 OnCompletePogress(action_data);
101 if ( !action_data.m_Player )
106 CalcAndSetQuantity( action_data );
111 override float GetProgress()
113 if ( m_ItemQuantity <= 0 )
116 return -(m_SpentQuantity_total / m_ItemQuantity);
120 void CalcAndSetQuantity(
ActionData action_data )
123 m_SpentQuantity_total += m_SpentQuantity;
127 m_SpentUnits.param1 = m_SpentQuantity;
128 SetACData(m_SpentUnits);
134 if ( action_data.m_MainItem )
135 action_data.m_MainItem.AddQuantity( -m_SpentQuantity );
137 Car car = Car.Cast(action_data.m_Target.GetObject());
138 car.Fill(
CarFluid.OIL, (m_SpentQuantity * 0.001) );