DayZ 1.24
Loading...
Searching...
No Matches
ActionFillCoolant.c
Go to the documentation of this file.
10
12{
13 const string RADIATOR_SELECTION_NAME = "radiator";
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 = "#refill_car";
24
25 }
26
28 {
31 }
32
33 override bool IsUsingProxies()
34 {
35 return true;
36 }
37
38 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
39 {
40 if (!target)
41 return false;
42
43 if (item.GetQuantity() <= 0)
44 return false;
45
46 if (item.GetLiquidType() != LIQUID_WATER && item.GetLiquidType() != LIQUID_RIVERWATER)
47 return false;
48
49 Car car = Car.Cast(target.GetParent());
50 if (!car)
51 return false;
52
53 if (car.GetFluidFraction(CarFluid.COOLANT) >= 0.95)
54 return false;
55
57 target.GetObject().GetActionComponentNameList(target.GetComponentIndex(), selections);
58
60
61 if (carS)
62 {
65
66 if (CastTo(carAI, car))
67 {
68 radiator = carAI.GetInventory().FindAttachment(InventorySlots.GetSlotIdFromString("CarRadiator"));
69 if (radiator && !radiator.IsRuined())
70 {
71 for (int s = 0; s < selections.Count(); s++)
72 {
73 if (selections[s] == carS.GetActionCompNameCoolant())
74 {
75 float dist = vector.Distance(carS.GetCoolantPtcPosWS(), player.GetPosition());
76
77 if (dist < carS.GetActionDistanceCoolant())
78 return true;
79 }
80 }
81 }
82 }
83 }
84
85 return false;
86 }
87};
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
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()
override void CreateConditionComponents()
override bool IsUsingProxies()
const string RADIATOR_SELECTION_NAME
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
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
const int LIQUID_WATER
Definition constants.c:504
const int LIQUID_RIVERWATER
Definition constants.c:505