DayZ 1.24
Loading...
Searching...
No Matches
ActionFillFuel.c
Go to the documentation of this file.
10
12{
13 const string FUEL_SELECTION_NAME = "refill";
14
16 {
18 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_EMPTY_VESSEL;
19 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
20 m_FullBody = true;
22 m_LockTargetOnUse = false;
23 m_Text = "#refuel";
24 }
25
27 {
28 m_ConditionItem = new CCINonRuined;//CCINotRuinedAndEmpty?
30 }
31
32 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
33 {
34 if (!target || !IsTransport(target))
35 return false;
36
37 if (item.GetQuantity() <= 0)
38 return false;
39
40 if (item.GetLiquidType() != LIQUID_GASOLINE)
41 return false;
42
43 Car car = Car.Cast(target.GetObject());
44 if (!car)
45 return false;
46
47 if (car.IsDamageDestroyed())
48 return false;
49
50 if (car.GetFluidFraction(CarFluid.FUEL) >= 0.98)
51 return false;
52
54 target.GetObject().GetActionComponentNameList(target.GetComponentIndex(), selections);
55
57
58 if (carS)
59 {
60 for (int s = 0; s < selections.Count(); s++)
61 {
62 if (selections[s] == carS.GetActionCompNameFuel())
63 {
64 float dist = vector.DistanceSq(carS.GetRefillPointPosWS(), player.GetPosition());
65
66 if (dist < carS.GetActionDistanceFuel() * carS.GetActionDistanceFuel())
67 return true;
68 }
69 }
70 }
71
72 return false;
73 }
74};
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
override void CreateActionComponent()
const float TIME_TO_REPEAT
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
const string FUEL_SELECTION_NAME
override void CreateConditionComponents()
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
const int LIQUID_GASOLINE
Definition constants.c:508