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.GetParent());
36 m_SpentUnits =
new Param1<float>( 0 );
40 m_SpentUnits.param1 = 0;
43 m_QuantityUsedPerSecond *=
Math.Min(action_data.m_MainItem.GetLiquidThroughputCoef(),car.GetLiquidThroughputCoef());
45 float coolCapacity = car.GetFluidCapacity(
CarFluid.COOLANT );
46 float currentCool = car.GetFluidFraction(
CarFluid.COOLANT );
47 currentCool = currentCool * coolCapacity;
49 m_EmptySpace = (coolCapacity - currentCool) * 1000;
50 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
52 if ( m_EmptySpace <= m_ItemQuantity )
53 m_ItemQuantity = m_EmptySpace;
60 Car car = Car.Cast(action_data.m_Target.GetParent());
65 if ( !action_data.m_Player )
70 if ( m_ItemQuantity <= 0 )
76 if ( m_SpentQuantity_total < m_ItemQuantity )
78 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus( m_QuantityUsedPerSecond,
m_Action.GetSpecialtyWeight(),
true);
79 m_SpentQuantity += m_AdjustedQuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
80 m_TimeElpased += action_data.m_Player.GetDeltaT();
82 if ( m_TimeElpased >= m_DefaultTimeStep )
84 CalcAndSetQuantity( action_data );
93 CalcAndSetQuantity( action_data );
94 OnCompletePogress(action_data);
103 if ( !action_data.m_Player )
108 CalcAndSetQuantity( action_data );
113 override float GetProgress()
115 if ( m_ItemQuantity <= 0 )
118 return -(m_SpentQuantity_total / m_ItemQuantity);
122 void CalcAndSetQuantity(
ActionData action_data )
125 m_SpentQuantity_total += m_SpentQuantity;
129 m_SpentUnits.param1 = m_SpentQuantity;
130 SetACData(m_SpentUnits);
135 if( action_data.m_MainItem )
136 action_data.m_MainItem.AddQuantity( -m_SpentQuantity );
138 Car car = Car.Cast(action_data.m_Target.GetParent());
140 car.Fill(
CarFluid.COOLANT, (m_SpentQuantity * 0.001) );