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

Protected Member Functions

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

Constructor & Destructor Documentation

◆ CAContinuousFillBrakes()

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

Member Function Documentation

◆ CalcAndSetQuantity()

void CAContinuousFillBrakes::CalcAndSetQuantity ( ActionData action_data)
inlineprotected

Definition at line 110 of file CAContinuousFillBrakes.c.

111 {
112
114
115 if (m_SpentUnits)
116 {
119 }
120
121
122 if (GetGame().IsServer())
123 {
124 if (action_data.m_MainItem) // Item EngineOil gets deleted after full consumption
125 action_data.m_MainItem.AddQuantity(-m_SpentQuantity);
126
127 Car car = Car.Cast(action_data.m_Target.GetObject());
128 car.Fill(CarFluid.BRAKE, (m_SpentQuantity * 0.001));
129 }
130
131 m_SpentQuantity = 0;
132 }
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 CAContinuousFillBrakes::Cancel ( ActionData action_data)
inlineprotected

Definition at line 91 of file CAContinuousFillBrakes.c.

92 {
93 if (!action_data.m_Player)
94 return UA_ERROR;
95
97 return UA_INTERRUPT;
98 }
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 CAContinuousFillBrakes::Execute ( ActionData action_data)
inlineprotected

Definition at line 52 of file CAContinuousFillBrakes.c.

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

Definition at line 101 of file CAContinuousFillBrakes.c.

102 {
103 if (m_ItemQuantity <= 0)
104 return 1;
105
107 }

References m_ItemQuantity, and m_SpentQuantity_total.

◆ Setup()

override void CAContinuousFillBrakes::Setup ( ActionData action_data)
inlineprotected

Definition at line 22 of file CAContinuousFillBrakes.c.

23 {
24 m_Player = action_data.m_Player;
25
26 Car car = Car.Cast(action_data.m_Target.GetObject());
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 float oilCapacity = car.GetFluidCapacity(CarFluid.BRAKE);
40 float currentOil = car.GetFluidFraction(CarFluid.BRAKE);
42
44 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
45
48
49 }

References m_EmptySpace, m_ItemQuantity, m_Player, m_SpentQuantity, m_SpentUnits, and m_TimeElpased.

Member Data Documentation

◆ m_AdjustedQuantityUsedPerSecond

float CAContinuousFillBrakes::m_AdjustedQuantityUsedPerSecond
protected

Definition at line 9 of file CAContinuousFillBrakes.c.

Referenced by Execute().

◆ m_DefaultTimeStep

float CAContinuousFillBrakes::m_DefaultTimeStep
protected

Definition at line 10 of file CAContinuousFillBrakes.c.

Referenced by CAContinuousFillBrakes(), and Execute().

◆ m_EmptySpace

float CAContinuousFillBrakes::m_EmptySpace
protected

Definition at line 6 of file CAContinuousFillBrakes.c.

Referenced by Setup().

◆ m_ItemQuantity

float CAContinuousFillBrakes::m_ItemQuantity
protected

Definition at line 3 of file CAContinuousFillBrakes.c.

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

◆ m_Player

PlayerBase CAContinuousFillBrakes::m_Player
protected

Definition at line 13 of file CAContinuousFillBrakes.c.

Referenced by Setup().

◆ m_QuantityUsedPerSecond

float CAContinuousFillBrakes::m_QuantityUsedPerSecond
protected

Definition at line 8 of file CAContinuousFillBrakes.c.

Referenced by CAContinuousFillBrakes(), and Execute().

◆ m_SpentQuantity

float CAContinuousFillBrakes::m_SpentQuantity
protected

Definition at line 4 of file CAContinuousFillBrakes.c.

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

◆ m_SpentQuantity_total

float CAContinuousFillBrakes::m_SpentQuantity_total
protected

Definition at line 5 of file CAContinuousFillBrakes.c.

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

◆ m_SpentUnits

ref Param1<float> CAContinuousFillBrakes::m_SpentUnits
protected

Definition at line 11 of file CAContinuousFillBrakes.c.

Referenced by CalcAndSetQuantity(), and Setup().

◆ m_TimeElpased

float CAContinuousFillBrakes::m_TimeElpased
protected

Definition at line 7 of file CAContinuousFillBrakes.c.

Referenced by Execute(), and Setup().


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