DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousFillPowerGenerator.c
Go to the documentation of this file.
2{
8
10 {
11 m_TimeElpased = 0;
12
13 if (!m_SpentUnits)
15 else
16 m_SpentUnits.param1 = 0;
17
18 EntityAI pg = EntityAI.Cast(action_data.m_Target.GetObject()); // get power generator
19 m_QuantityFilledPerSecond *= Math.Min(action_data.m_MainItem.GetLiquidThroughputCoef(), pg.GetLiquidThroughputCoef());
20
21 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
22 m_TargetUnits = pg.GetCompEM().GetEnergyMax() - pg.GetCompEM().GetEnergy();
23 m_AdjustedQuantityFilledPerSecond = action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(m_QuantityFilledPerSecond, m_Action.GetSpecialtyWeight(), true);
24 }
25
27 {
28 if (!action_data.m_Player)
29 return UA_ERROR;
30
31 PowerGeneratorBase pg = PowerGeneratorBase.Cast(action_data.m_Target.GetObject()); // get power generator
32
33 if (pg.GetFuel() >= pg.GetMaxFuel())
34 return UA_FINISHED;
35 else
36 {
38 {
40 m_TimeElpased += action_data.m_Player.GetDeltaT();
41
43 {
45 m_TimeElpased = 0;
46 //Setup(action_data); //reset data after repeat
47 }
48 return UA_PROCESSING;
49 }
50 else
51 {
54 return UA_FINISHED;
55 }
56 }
57 }
58
60 {
62
63 if (m_SpentUnits)
64 {
67 }
68
69
70 if (GetGame().IsServer())
71 {
72 PowerGeneratorBase pg = PowerGeneratorBase.Cast(action_data.m_Target.GetObject()); // get power generator
73 int consumed_fuel = pg.AddFuel(m_SpentQuantity);
74 action_data.m_MainItem.AddQuantity(-consumed_fuel);
75 }
76
78 }
79};
void CalcAndSetQuantity()
void SetACData(Param units)
Definition CABase.c:38
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
ref Param1< float > m_SpentUnits
float m_QuantityFilledPerSecond
float m_AdjustedQuantityFilledPerSecond
override void CalcAndSetQuantity(ActionData action_data)
override void Setup(ActionData action_data)
override int Execute(ActionData action_data)
void CAContinuousFillPowerGenerator(float quantity_filled_per_second, int liquid_type)
Definition EnMath.c:7
proto native CGame GetGame()
static proto float Min(float x, float y)
Returns smaller of two given values.
const int UA_FINISHED
Definition constants.c:436
const int UA_ERROR
Definition constants.c:455
const int UA_PROCESSING
Definition constants.c:434