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

Protected Member Functions

void CAContinuousFillCoolant (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 CAContinuousFillCoolant.c.

Constructor & Destructor Documentation

◆ CAContinuousFillCoolant()

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

Member Function Documentation

◆ CalcAndSetQuantity()

void CAContinuousFillCoolant::CalcAndSetQuantity ( ActionData action_data)
inlineprotected

Definition at line 112 of file CAContinuousFillCoolant.c.

113 {
114
116
117 if (m_SpentUnits)
118 {
121 }
122
123 if (GetGame().IsServer())
124 {
125 if (action_data.m_MainItem)
126 action_data.m_MainItem.AddQuantity(-m_SpentQuantity);
127
128 Car car = Car.Cast(action_data.m_Target.GetParent());
129 if (car)
130 car.Fill(CarFluid.COOLANT, (m_SpentQuantity * 0.001));
131 }
132
133 m_SpentQuantity = 0;
134 }
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:18
void SetACData(Param units)
Definition CABase.c:38
proto native CGame GetGame()

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

◆ Cancel()

override int CAContinuousFillCoolant::Cancel ( ActionData action_data)
inlineprotected

Definition at line 93 of file CAContinuousFillCoolant.c.

94 {
95 if (!action_data.m_Player)
96 return UA_ERROR;
97
99 return UA_INTERRUPT;
100 }
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 CAContinuousFillCoolant::Execute ( ActionData action_data)
inlineprotected

Definition at line 54 of file CAContinuousFillCoolant.c.

55 {
56 Car car = Car.Cast(action_data.m_Target.GetParent());
57
58 if (!car)
59 return UA_ERROR;
60
61 if (!action_data.m_Player)
62 return UA_ERROR;
63
64 if (m_ItemQuantity <= 0)
65 return UA_FINISHED;
66 else
67 {
69 {
70 m_AdjustedQuantityUsedPerSecond = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus(m_QuantityUsedPerSecond, m_Action.GetSpecialtyWeight(), true);
72 m_TimeElpased += action_data.m_Player.GetDeltaT();
73
75 {
77 m_TimeElpased = 0;
78 //Setup(action_data); //reset data after repeat
79 }
80
81 return UA_PROCESSING;
82 }
83 else
84 {
87 return UA_FINISHED;
88 }
89 }
90 }
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 CAContinuousFillCoolant::GetProgress ( )
inlineprotected

Definition at line 103 of file CAContinuousFillCoolant.c.

104 {
105 if (m_ItemQuantity <= 0)
106 return 1;
107
109 }

References m_ItemQuantity, and m_SpentQuantity_total.

◆ Setup()

override void CAContinuousFillCoolant::Setup ( ActionData action_data)
inlineprotected

Definition at line 22 of file CAContinuousFillCoolant.c.

23 {
24 m_Player = action_data.m_Player;
25
26 Car car = Car.Cast(action_data.m_Target.GetParent());
27
28 if (!car)
29 return;
30
31 m_TimeElpased = 0;
33
34 if (!m_SpentUnits)
36 else
37 m_SpentUnits.param1 = 0;
38
39 m_QuantityUsedPerSecond *= Math.Min(action_data.m_MainItem.GetLiquidThroughputCoef(), car.GetLiquidThroughputCoef());
40
41 float coolCapacity = car.GetFluidCapacity(CarFluid.COOLANT);
42 float currentCool = car.GetFluidFraction(CarFluid.COOLANT);
44
46 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
47
50
51 }
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 CAContinuousFillCoolant::m_AdjustedQuantityUsedPerSecond
protected

Definition at line 9 of file CAContinuousFillCoolant.c.

Referenced by Execute().

◆ m_DefaultTimeStep

float CAContinuousFillCoolant::m_DefaultTimeStep
protected

Definition at line 10 of file CAContinuousFillCoolant.c.

Referenced by CAContinuousFillCoolant(), and Execute().

◆ m_EmptySpace

float CAContinuousFillCoolant::m_EmptySpace
protected

Definition at line 6 of file CAContinuousFillCoolant.c.

Referenced by Setup().

◆ m_ItemQuantity

float CAContinuousFillCoolant::m_ItemQuantity
protected

Definition at line 3 of file CAContinuousFillCoolant.c.

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

◆ m_Player

PlayerBase CAContinuousFillCoolant::m_Player
protected

Definition at line 13 of file CAContinuousFillCoolant.c.

Referenced by Setup().

◆ m_QuantityUsedPerSecond

float CAContinuousFillCoolant::m_QuantityUsedPerSecond
protected

Definition at line 8 of file CAContinuousFillCoolant.c.

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

◆ m_SpentQuantity

float CAContinuousFillCoolant::m_SpentQuantity
protected

Definition at line 4 of file CAContinuousFillCoolant.c.

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

◆ m_SpentQuantity_total

float CAContinuousFillCoolant::m_SpentQuantity_total
protected

Definition at line 5 of file CAContinuousFillCoolant.c.

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

◆ m_SpentUnits

ref Param1<float> CAContinuousFillCoolant::m_SpentUnits
protected

Definition at line 11 of file CAContinuousFillCoolant.c.

Referenced by CalcAndSetQuantity(), and Setup().

◆ m_TimeElpased

float CAContinuousFillCoolant::m_TimeElpased
protected

Definition at line 7 of file CAContinuousFillCoolant.c.

Referenced by Execute(), and Setup().


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