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

Private Member Functions

void ActionFillBrakes ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnEndAnimationLoopServer (ActionData action_data)
 
- Private Member Functions inherited from ActionContinuousBase
void OnStartAnimationLoopServer (ActionData action_data)
 
void OnStartAnimationLoopClient (ActionData action_data)
 
void OnEndAnimationLoopServer (ActionData action_data)
 
void OnEndAnimationLoopClient (ActionData action_data)
 
void OnFinishProgressServer (ActionData action_data)
 
void OnFinishProgressClient (ActionData action_data)
 

Detailed Description

Definition at line 11 of file ActionFillBrakes.c.

Constructor & Destructor Documentation

◆ ActionFillBrakes()

void ActionFillBrakes::ActionFillBrakes ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

override bool ActionFillBrakes::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 30 of file ActionFillBrakes.c.

31 {
32 if (!target || !IsTransport(target))
33 return false;
34
35 if (item.GetQuantity() <= 0)
36 return false;
37
38 Car car = Car.Cast(target.GetObject());
39 if (!car)
40 return false;
41
42 if (car.GetFluidFraction(CarFluid.BRAKE) >= 0.98)
43 return false;
44
45 float distance = Math.AbsFloat(vector.Distance(car.GetPosition(), player.GetPosition()));
46
48 if (distance <= carS.GetActionDistanceFuel())
49 {
51 target.GetObject().GetActionComponentNameList(target.GetComponentIndex(), selections);
52
53 for (int s = 0; s < selections.Count(); s++)
54 {
55 if (selections[s] == carS.GetActionCompNameBrakes())
56 return true;
57 }
58 }
59 return false;
60 }
bool IsTransport(ActionTarget target)
Definition ActionBase.c:851
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:18
Definition EnMath.c:7
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat(), vector::Distance(), and IsTransport().

◆ CreateConditionComponents()

override void ActionFillBrakes::CreateConditionComponents ( )
inlineprivate

Definition at line 24 of file ActionFillBrakes.c.

25 {
28 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ OnEndAnimationLoopServer()

override void ActionFillBrakes::OnEndAnimationLoopServer ( ActionData action_data)
inlineprivate

Definition at line 62 of file ActionFillBrakes.c.

63 {
64 if (action_data.m_MainItem && action_data.m_MainItem.GetQuantity() <= 0.01)
65 action_data.m_MainItem.SetQuantity(0);
66 }

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