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

Protected Member Functions

void CAContinuousFillFuel (float quantity_used_per_second, float time_to_progress)
 
override void Setup (ActionData action_data)
 
override int Execute (ActionData action_data)
 
override int Cancel (ActionData action_data)
 
override float GetProgress ()
 
void CalcAndSetQuantity (ActionData action_data)
 

Protected Attributes

float m_ItemQuantity
 
float m_SpentQuantity
 
float m_SpentQuantity_total
 
float m_EmptySpace
 
float m_TimeElpased
 
float m_QuantityUsedPerSecond
 
float m_AdjustedQuantityUsedPerSecond
 
float m_DefaultTimeStep
 
ref Param1< floatm_SpentUnits
 
PlayerBase m_Player
 

Detailed Description

Definition at line 1 of file CAContinuousFillFuel.c.

Constructor & Destructor Documentation

◆ CAContinuousFillFuel()

void CAContinuousFillFuel::CAContinuousFillFuel ( float quantity_used_per_second,
float time_to_progress )
inlineprotected

Member Function Documentation

◆ CalcAndSetQuantity()

void CAContinuousFillFuel::CalcAndSetQuantity ( ActionData action_data)
inlineprotected

Definition at line 106 of file CAContinuousFillFuel.c.

107 {
108
110
111 if (m_SpentUnits)
112 {
115 }
116
117
118 if (GetGame().IsServer())
119 {
120 Car car = Car.Cast(action_data.m_Target.GetObject());
121 action_data.m_MainItem.AddQuantity(-m_SpentQuantity);
122 car.Fill(CarFluid.FUEL, (m_SpentQuantity * 0.001));
123 }
124
125 m_SpentQuantity = 0;
126 }
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:18
void SetACData(Param units)
Definition CABase.c:38
ref Param1< float > m_SpentUnits
proto native CGame GetGame()

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

◆ Cancel()

override int CAContinuousFillFuel::Cancel ( ActionData action_data)
inlineprotected

Definition at line 87 of file CAContinuousFillFuel.c.

88 {
89 if (!action_data.m_Player)
90 return UA_ERROR;
91
93 return UA_INTERRUPT;
94 }
void CalcAndSetQuantity()
const int UA_ERROR
Definition constants.c:455
const int UA_INTERRUPT
Definition constants.c:438

References CalcAndSetQuantity(), UA_ERROR, and UA_INTERRUPT.

◆ Execute()

override int CAContinuousFillFuel::Execute ( ActionData action_data)
inlineprotected

Definition at line 51 of file CAContinuousFillFuel.c.

52 {
53 Car car = Car.Cast(action_data.m_Target.GetObject());
54
55 if (!action_data.m_Player)
56 return UA_ERROR;
57
58 if (m_ItemQuantity <= 0)
59 return UA_FINISHED;
60 else
61 {
63 {
64 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus(m_QuantityUsedPerSecond, m_Action.GetSpecialtyWeight(), true);
66 m_TimeElpased += action_data.m_Player.GetDeltaT();
67
69 {
71 m_TimeElpased = 0;
72 //Setup(action_data); //reset data after repeat
73 }
74
75 return UA_PROCESSING;
76 }
77 else
78 {
81 return UA_FINISHED;
82 }
83 }
84 }
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
const int UA_FINISHED
Definition constants.c:436
const int UA_PROCESSING
Definition constants.c:434

References CalcAndSetQuantity(), CABase::m_Action, m_AdjustedQuantityUsedPerSecond, m_DefaultTimeStep, m_ItemQuantity, m_QuantityUsedPerSecond, m_SpentQuantity, m_SpentQuantity_total, m_TimeElpased, CAContinuousBase::OnCompletePogress(), UA_ERROR, UA_FINISHED, and UA_PROCESSING.

◆ GetProgress()

override float CAContinuousFillFuel::GetProgress ( )
inlineprotected

Definition at line 97 of file CAContinuousFillFuel.c.

98 {
99 if (m_ItemQuantity <= 0)
100 return 1;
101
103 }

References m_ItemQuantity, and m_SpentQuantity_total.

◆ Setup()

override void CAContinuousFillFuel::Setup ( ActionData action_data)
inlineprotected

Definition at line 22 of file CAContinuousFillFuel.c.

23 {
24 m_Player = action_data.m_Player;
25
26 Car car = Car.Cast(action_data.m_Target.GetObject());
27
28 m_TimeElpased = 0;
30
31 if (!m_SpentUnits)
33 else
34 m_SpentUnits.param1 = 0;
35
36 m_QuantityUsedPerSecond *= Math.Min(action_data.m_MainItem.GetLiquidThroughputCoef(), car.GetLiquidThroughputCoef());
37
38 float fuelCapacity = car.GetFluidCapacity(CarFluid.FUEL);
39 float currentFuel = car.GetFluidFraction(CarFluid.FUEL);
41
43 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
44
47
48 }
Definition EnMath.c:7
static proto float Min(float x, float y)
Returns smaller of two given values.

References m_EmptySpace, m_ItemQuantity, m_Player, m_QuantityUsedPerSecond, m_SpentQuantity, m_SpentUnits, m_TimeElpased, and Math::Min().

Member Data Documentation

◆ m_AdjustedQuantityUsedPerSecond

float CAContinuousFillFuel::m_AdjustedQuantityUsedPerSecond
protected

Definition at line 9 of file CAContinuousFillFuel.c.

Referenced by Execute().

◆ m_DefaultTimeStep

float CAContinuousFillFuel::m_DefaultTimeStep
protected

Definition at line 10 of file CAContinuousFillFuel.c.

Referenced by CAContinuousFillFuel(), and Execute().

◆ m_EmptySpace

float CAContinuousFillFuel::m_EmptySpace
protected

Definition at line 6 of file CAContinuousFillFuel.c.

Referenced by Setup().

◆ m_ItemQuantity

float CAContinuousFillFuel::m_ItemQuantity
protected

Definition at line 3 of file CAContinuousFillFuel.c.

Referenced by Execute(), GetProgress(), and Setup().

◆ m_Player

PlayerBase CAContinuousFillFuel::m_Player
protected

Definition at line 13 of file CAContinuousFillFuel.c.

Referenced by Setup().

◆ m_QuantityUsedPerSecond

float CAContinuousFillFuel::m_QuantityUsedPerSecond
protected

Definition at line 8 of file CAContinuousFillFuel.c.

Referenced by CAContinuousFillFuel(), Execute(), and Setup().

◆ m_SpentQuantity

float CAContinuousFillFuel::m_SpentQuantity
protected

Definition at line 4 of file CAContinuousFillFuel.c.

Referenced by CalcAndSetQuantity(), Execute(), and Setup().

◆ m_SpentQuantity_total

float CAContinuousFillFuel::m_SpentQuantity_total
protected

Definition at line 5 of file CAContinuousFillFuel.c.

Referenced by CalcAndSetQuantity(), Execute(), and GetProgress().

◆ m_SpentUnits

ref Param1<float> CAContinuousFillFuel::m_SpentUnits
protected

Definition at line 11 of file CAContinuousFillFuel.c.

Referenced by CalcAndSetQuantity(), and Setup().

◆ m_TimeElpased

float CAContinuousFillFuel::m_TimeElpased
protected

Definition at line 7 of file CAContinuousFillFuel.c.

Referenced by Execute(), and Setup().


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