DayZ 1.24
Loading...
Searching...
No Matches
ActionFillOil.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.OIL) >= 0.98)
43 return false;
44
46 target.GetObject().GetActionComponentNameList(target.GetComponentIndex(), selections);
47
49 if (carS)
50 {
51 for (int s = 0; s < selections.Count(); s++)
52 {
53 if (selections[s] == carS.GetActionCompNameOil())
54 {
55 float dist = vector.Distance(carS.GetRefillPointPosWS(), player.GetPosition());
56
57 if (dist < carS.GetActionDistanceOil())
58 return true;
59 }
60 }
61 }
62
63 return false;
64 }
65
67 {
68 if (action_data.m_MainItem && action_data.m_MainItem.GetQuantity() <= 0.01)
69 action_data.m_MainItem.SetQuantity(0);
70 }
71};
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 bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void CreateConditionComponents()
void ActionFillOil()
override void OnEndAnimationLoopServer(ActionData action_data)
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