DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousFillPowerGenerator Class Reference
Inheritance diagram for CAContinuousFillPowerGenerator:
[legend]
Collaboration diagram for CAContinuousFillPowerGenerator:
[legend]

Private Member Functions

void CAContinuousFillPowerGenerator (float quantity_filled_per_second, int liquid_type)
 
override void Setup (ActionData action_data)
 
override int Execute (ActionData action_data)
 
override void CalcAndSetQuantity (ActionData action_data)
 
- Private Member Functions inherited from CAContinuousFill
void CAContinuousFill (float quantity_filled_per_second, int liquid_type)
 
override void Setup (ActionData action_data)
 
override int Execute (ActionData action_data)
 
override int Cancel (ActionData action_data)
 
override int Interrupt (ActionData action_data)
 
override float GetProgress ()
 
void CalcAndSetQuantity (ActionData action_data)
 

Additional Inherited Members

- Private Attributes inherited from CAContinuousFill
float m_TargetUnits
 
float m_SpentQuantity
 
float m_SpentQuantity_total
 
float m_ItemQuantity
 
float m_AdjustedQuantityFilledPerSecond
 
float m_QuantityFilledPerSecond
 
ref Param1< floatm_SpentUnits
 
float m_TimeElpased
 
float m_DefaultTimeStep = 0.25
 
int m_liquid_type
 

Detailed Description

Definition at line 1 of file CAContinuousFillPowerGenerator.c.

Constructor & Destructor Documentation

◆ CAContinuousFillPowerGenerator()

void CAContinuousFillPowerGenerator::CAContinuousFillPowerGenerator ( float quantity_filled_per_second,
int liquid_type )
inlineprivate

Member Function Documentation

◆ CalcAndSetQuantity()

override void CAContinuousFillPowerGenerator::CalcAndSetQuantity ( ActionData action_data)
inlineprivate

Definition at line 59 of file CAContinuousFillPowerGenerator.c.

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 }
void SetACData(Param units)
Definition CABase.c:38
ref Param1< float > m_SpentUnits
proto native CGame GetGame()

References GetGame(), CAContinuousFill::m_SpentQuantity, CAContinuousFill::m_SpentQuantity_total, CAContinuousFill::m_SpentUnits, and CABase::SetACData().

◆ Execute()

override int CAContinuousFillPowerGenerator::Execute ( ActionData action_data)
inlineprivate

Definition at line 26 of file CAContinuousFillPowerGenerator.c.

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 }
void CalcAndSetQuantity()
void OnCompletePogress(ActionData action_data)
float m_AdjustedQuantityFilledPerSecond
const int UA_FINISHED
Definition constants.c:436
const int UA_ERROR
Definition constants.c:455
const int UA_PROCESSING
Definition constants.c:434

References CalcAndSetQuantity(), CAContinuousFill::m_AdjustedQuantityFilledPerSecond, CAContinuousFill::m_DefaultTimeStep, CAContinuousFill::m_SpentQuantity, CAContinuousFill::m_SpentQuantity_total, CAContinuousFill::m_TargetUnits, CAContinuousFill::m_TimeElpased, CAContinuousBase::OnCompletePogress(), UA_ERROR, UA_FINISHED, and UA_PROCESSING.

◆ Setup()

override void CAContinuousFillPowerGenerator::Setup ( ActionData action_data)
inlineprivate

Definition at line 9 of file CAContinuousFillPowerGenerator.c.

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 }
ActionBase m_Action
Definition CABase.c:3
Definition EnMath.c:7
static proto float Min(float x, float y)
Returns smaller of two given values.

References CABase::m_Action, CAContinuousFill::m_AdjustedQuantityFilledPerSecond, CAContinuousFill::m_ItemQuantity, CAContinuousFill::m_QuantityFilledPerSecond, CAContinuousFill::m_SpentUnits, CAContinuousFill::m_TargetUnits, CAContinuousFill::m_TimeElpased, and Math::Min().


The documentation for this class was generated from the following file: