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

Protected Member Functions

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)
 

Protected Attributes

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 CAContinuousFill.c.

Constructor & Destructor Documentation

◆ CAContinuousFill()

void CAContinuousFill::CAContinuousFill ( float quantity_filled_per_second,
int liquid_type )
inlineprotected

Member Function Documentation

◆ CalcAndSetQuantity()

void CAContinuousFill::CalcAndSetQuantity ( ActionData action_data)
inlineprotected

Definition at line 94 of file CAContinuousFill.c.

95 {
97 if (GetGame().IsServer())
98 {
99 if (m_SpentUnits)
100 {
103 }
104
105 bool injectAgents = true;
106 if (action_data.m_Target.GetObject() && (action_data.m_Target.GetObject().GetWaterSourceObjectType() == EWaterSourceObjectType.WELL || action_data.m_Target.GetObject().IsWell()))
107 injectAgents = false;
108
110 }
111
112 m_SpentQuantity = 0;
113 }
EWaterSourceObjectType
void SetACData(Param units)
Definition CABase.c:38
ref Param1< float > m_SpentUnits
Definition Liquid.c:2
static void FillContainerEnviro(ItemBase container, int liquid_type, float amount, bool inject_agents=false)
Definition Liquid.c:126
proto native CGame GetGame()

References Liquid::FillContainerEnviro(), GetGame(), m_liquid_type, m_SpentQuantity, m_SpentQuantity_total, m_SpentUnits, and CABase::SetACData().

◆ Cancel()

override int CAContinuousFill::Cancel ( ActionData action_data)
inlineprotected

Definition at line 71 of file CAContinuousFill.c.

72 {
73 if (!action_data.m_Player || !action_data.m_MainItem)
74 return UA_ERROR;
75
77 return UA_CANCEL;
78 }
void CalcAndSetQuantity()
const int UA_ERROR
Definition constants.c:455
const int UA_CANCEL
Definition constants.c:437

References CalcAndSetQuantity(), UA_CANCEL, and UA_ERROR.

◆ Execute()

override int CAContinuousFill::Execute ( ActionData action_data)
inlineprotected

Definition at line 40 of file CAContinuousFill.c.

41 {
42 if (!action_data.m_Player)
43 return UA_ERROR;
44
45 if (action_data.m_MainItem.GetQuantity() >= action_data.m_MainItem.GetQuantityMax())
46 return UA_FINISHED;
47 else
48 {
50 {
52 m_TimeElpased += action_data.m_Player.GetDeltaT();
53
55 {
57 m_TimeElpased = 0;
58 //Setup(action_data); //reset data after repeat
59 }
60 return UA_PROCESSING;
61 }
62 else
63 {
66 return UA_FINISHED;
67 }
68 }
69 }
void OnCompletePogress(ActionData action_data)
float m_AdjustedQuantityFilledPerSecond
const int UA_FINISHED
Definition constants.c:436
const int UA_PROCESSING
Definition constants.c:434

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

◆ GetProgress()

override float CAContinuousFill::GetProgress ( )
inlineprotected

Definition at line 88 of file CAContinuousFill.c.

89 {
91 }

References m_SpentQuantity_total, and m_TargetUnits.

◆ Interrupt()

override int CAContinuousFill::Interrupt ( ActionData action_data)
inlineprotected

Definition at line 80 of file CAContinuousFill.c.

81 {
82 if (GetGame().IsServer())
83 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(UASoftSkillsWeight.PRECISE_LOW);
84
85 return super.Interrupt(action_data);
86 }

References GetGame(), and UASoftSkillsWeight::PRECISE_LOW.

◆ Setup()

override void CAContinuousFill::Setup ( ActionData action_data)
inlineprotected

Definition at line 20 of file CAContinuousFill.c.

21 {
22 m_TimeElpased = 0;
23
24 if (!m_SpentUnits)
26 else
27 m_SpentUnits.param1 = 0;
28
29 float throughputCoef = action_data.m_MainItem.GetLiquidThroughputCoef();
31 if (action_data.m_Target && action_data.m_Target.GetObject() && Class.CastTo(entity, action_data.m_Target.GetObject()))
32 throughputCoef = Math.Min(throughputCoef, entity.GetLiquidThroughputCoef());
34
35 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
36 m_TargetUnits = action_data.m_MainItem.GetQuantityMax() - action_data.m_MainItem.GetQuantity();
37 m_AdjustedQuantityFilledPerSecond = action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(m_QuantityFilledPerSecond, m_Action.GetSpecialtyWeight(), true);
38 }
ActionBase m_Action
Definition CABase.c:3
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition EnMath.c:7
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Min(float x, float y)
Returns smaller of two given values.

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

Member Data Documentation

◆ m_AdjustedQuantityFilledPerSecond

float CAContinuousFill::m_AdjustedQuantityFilledPerSecond
protected

◆ m_DefaultTimeStep

float CAContinuousFill::m_DefaultTimeStep = 0.25
protected

Definition at line 11 of file CAContinuousFill.c.

Referenced by Execute(), and CAContinuousFillPowerGenerator::Execute().

◆ m_ItemQuantity

float CAContinuousFill::m_ItemQuantity
protected

Definition at line 6 of file CAContinuousFill.c.

Referenced by Setup(), and CAContinuousFillPowerGenerator::Setup().

◆ m_liquid_type

int CAContinuousFill::m_liquid_type
protected

◆ m_QuantityFilledPerSecond

float CAContinuousFill::m_QuantityFilledPerSecond
protected

◆ m_SpentQuantity

float CAContinuousFill::m_SpentQuantity
protected

◆ m_SpentQuantity_total

float CAContinuousFill::m_SpentQuantity_total
protected

◆ m_SpentUnits

ref Param1<float> CAContinuousFill::m_SpentUnits
protected

◆ m_TargetUnits

float CAContinuousFill::m_TargetUnits
protected

◆ m_TimeElpased

float CAContinuousFill::m_TimeElpased
protected

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