DayZ 1.24
Loading...
Searching...
No Matches
ActionFillBrakes.c
Go to the documentation of this file.
10
12{
14 {
16 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_EMPTY_VESSEL;
17 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
18 m_FullBody = true;
20 m_LockTargetOnUse = false;
21 m_Text = "#refill_car";
22 }
23
29
30 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
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 }
61
63 {
64 if (action_data.m_MainItem && action_data.m_MainItem.GetQuantity() <= 0.01)
65 action_data.m_MainItem.SetQuantity(0);
66 }
67};
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
bool m_LockTargetOnUse
Definition ActionBase.c:51
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
bool IsTransport(ActionTarget target)
Definition ActionBase.c:851
int m_StanceMask
Definition ActionBase.c:53
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:18
ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
const float TIME_TO_REPEAT
override void CreateActionComponent()
override void CreateConditionComponents()
override void OnEndAnimationLoopServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition EnMath.c:7
const float POUR_LIQUID
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
static proto float AbsFloat(float f)
Returns absolute value.