3 protected int m_TendencyDrain;
4 protected float m_ItemQuantity;
5 protected float m_SpentQuantity;
6 protected float m_SpentQuantity_total;
7 protected float m_ItemMaxQuantity;
8 protected float m_TimeElpased;
9 protected float m_QuantityUsedPerSecond;
10 protected float m_AdjustedQuantityUsedPerSecond;
11 protected float m_DefaultTimeStep;
12 protected ref Param1<float> m_SpentUnits;
16 m_QuantityUsedPerSecond = quantity_used_per_second;
17 m_DefaultTimeStep = time_to_progress;
18 m_TendencyDrain = drain;
30 m_SpentUnits =
new Param1<float>(0);
34 m_SpentUnits.param1 = 0;
37 m_QuantityUsedPerSecond *=
Math.Min(action_data.m_MainItem.GetLiquidThroughputCoef(),target_item.GetLiquidThroughputCoef());
39 if (m_TendencyDrain == 1)
41 if (target_item.GetQuantity() > (action_data.m_MainItem.GetQuantityMax() - action_data.m_MainItem.GetQuantity()))
43 m_ItemMaxQuantity = action_data.m_MainItem.GetQuantityMax() - action_data.m_MainItem.GetQuantity();
47 m_ItemMaxQuantity = target_item.GetQuantity();
50 m_ItemQuantity = m_ItemMaxQuantity;
52 else if (m_TendencyDrain == 0)
54 if (action_data.m_MainItem.GetQuantity() > (target_item.GetQuantityMax() - target_item.GetQuantity()))
56 m_ItemMaxQuantity = target_item.GetQuantityMax() - target_item.GetQuantity();
60 m_ItemMaxQuantity = action_data.m_MainItem.GetQuantity();
63 m_ItemQuantity = m_ItemMaxQuantity;
72 if (!action_data.m_Player || m_TendencyDrain == -1 || !action_data.m_Target)
77 if (m_ItemQuantity <= 0)
83 if (m_SpentQuantity_total < m_ItemQuantity)
85 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(m_QuantityUsedPerSecond,
m_Action.GetSpecialtyWeight(),
true);
86 m_SpentQuantity += m_AdjustedQuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
87 m_TimeElpased += action_data.m_Player.GetDeltaT();
89 if (m_TimeElpased >= m_DefaultTimeStep)
91 CalcAndSetQuantity(action_data);
99 CalcAndSetQuantity(action_data);
100 OnCompletePogress(action_data);
108 if (!action_data.m_Player || m_TendencyDrain == -1 || !action_data.m_Target || !action_data.m_Target.GetObject())
113 CalcAndSetQuantity(action_data);
117 override float GetProgress()
121 return m_SpentQuantity_total / m_ItemMaxQuantity;
125 return -(m_SpentQuantity_total / m_ItemMaxQuantity);
131 void CalcAndSetQuantity(
ActionData action_data)
134 m_SpentQuantity_total += m_SpentQuantity;
140 m_SpentUnits.param1 = m_SpentQuantity;
141 SetACData(m_SpentUnits);
147 Liquid.Transfer(target_item, action_data.m_MainItem, m_SpentQuantity);
151 Liquid.Transfer(action_data.m_MainItem, target_item, m_SpentQuantity);