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

Protected Member Functions

void CAContinuousTransferQuantity (float quantity_filled_per_second)
 
override void Setup (ActionData action_data)
 
override int Execute (ActionData action_data)
 
override override int Cancel (ActionData action_data)
 
override float GetProgress ()
 
void CalcAndSetQuantity (ActionData action_data)
 

Protected Attributes

float m_TargetUnits
 
float m_SpentQuantity
 
float m_ItemQuantity
 
float m_SourceQuantity
 
float m_QuantityFilledPerSecond
 
float m_TimeToComplete
 
ref Param1< floatm_SpentUnits
 

Detailed Description

Definition at line 1 of file CAContinuousTransferQuantity.c.

Constructor & Destructor Documentation

◆ CAContinuousTransferQuantity()

void CAContinuousTransferQuantity::CAContinuousTransferQuantity ( float quantity_filled_per_second)
inlineprotected

Member Function Documentation

◆ CalcAndSetQuantity()

void CAContinuousTransferQuantity::CalcAndSetQuantity ( ActionData action_data)
inlineprotected

Definition at line 73 of file CAContinuousTransferQuantity.c.

74 {
75 if (GetGame().IsServer())
76 {
77 if (m_SpentUnits)
78 {
81 }
82 action_data.m_MainItem.AddQuantity(m_SpentQuantity);
84 if (Class.CastTo(trg, action_data.m_Target.GetObject()))
85 trg.AddQuantity(-m_SpentQuantity, false, false);
86 }
87 }
void SetACData(Param units)
Definition CABase.c:38
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

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

◆ Cancel()

override override int CAContinuousTransferQuantity::Cancel ( ActionData action_data)
inlineprotected

Definition at line 57 of file CAContinuousTransferQuantity.c.

58 {
59 if (!action_data.m_Player)
60 return UA_ERROR;
61
63 return UA_CANCEL;
64 }
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 CAContinuousTransferQuantity::Execute ( ActionData action_data)
inlineprotected

Definition at line 31 of file CAContinuousTransferQuantity.c.

32 {
33 if (!action_data.m_Player)
34 return UA_ERROR;
36 Class.CastTo(trg, action_data.m_Target.GetObject());
37 if (action_data.m_MainItem.GetQuantity() >= action_data.m_MainItem.GetQuantityMax() || trg.GetQuantity() == 0)
38 return UA_FINISHED;
39 else
40 {
42 {
45 if (m_Action) m_Action.SendMessageToClient(action_data.m_Player, val.ToString());
46 return UA_PROCESSING;
47 }
48 else
49 {
52 return UA_FINISHED;
53 }
54 }
55 }
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(), Class::CastTo(), CABase::m_Action, m_ItemQuantity, m_QuantityFilledPerSecond, m_SourceQuantity, m_SpentQuantity, m_TargetUnits, CAContinuousBase::OnCompletePogress(), UA_ERROR, UA_FINISHED, and UA_PROCESSING.

◆ GetProgress()

override float CAContinuousTransferQuantity::GetProgress ( )
inlineprotected

◆ Setup()

override void CAContinuousTransferQuantity::Setup ( ActionData action_data)
inlineprotected

Definition at line 16 of file CAContinuousTransferQuantity.c.

17 {
19 if (!m_SpentUnits)
21 else
22 m_SpentUnits.param1 = 0;
23 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
25 if (Class.CastTo(trg, action_data.m_Target.GetObject()))
26 m_SourceQuantity = trg.GetQuantity();
27 m_TargetUnits = action_data.m_MainItem.GetQuantityMax();
29 }
Definition EnMath.c:7
static proto float Min(float x, float y)
Returns smaller of two given values.

References Class::CastTo(), m_ItemQuantity, m_QuantityFilledPerSecond, m_SourceQuantity, m_SpentQuantity, m_SpentUnits, m_TargetUnits, m_TimeToComplete, and Math::Min().

Member Data Documentation

◆ m_ItemQuantity

float CAContinuousTransferQuantity::m_ItemQuantity
protected

Definition at line 5 of file CAContinuousTransferQuantity.c.

Referenced by Execute(), and Setup().

◆ m_QuantityFilledPerSecond

float CAContinuousTransferQuantity::m_QuantityFilledPerSecond
protected

◆ m_SourceQuantity

float CAContinuousTransferQuantity::m_SourceQuantity
protected

Definition at line 6 of file CAContinuousTransferQuantity.c.

Referenced by Execute(), and Setup().

◆ m_SpentQuantity

float CAContinuousTransferQuantity::m_SpentQuantity
protected

Definition at line 4 of file CAContinuousTransferQuantity.c.

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

◆ m_SpentUnits

ref Param1<float> CAContinuousTransferQuantity::m_SpentUnits
protected

Definition at line 9 of file CAContinuousTransferQuantity.c.

Referenced by CalcAndSetQuantity(), and Setup().

◆ m_TargetUnits

float CAContinuousTransferQuantity::m_TargetUnits
protected

Definition at line 3 of file CAContinuousTransferQuantity.c.

Referenced by Execute(), and Setup().

◆ m_TimeToComplete

float CAContinuousTransferQuantity::m_TimeToComplete
protected

Definition at line 8 of file CAContinuousTransferQuantity.c.

Referenced by GetProgress(), and Setup().


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