DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionFillFuel.c
Go to the documentation of this file.
2{
3 private const float TIME_TO_REPEAT = 0.5;
4
5 override void CreateActionComponent()
6 {
8 }
9};
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 {
49 return false;
50 }
51
52 if ( car.GetFluidFraction( CarFluid.FUEL ) >= 0.98 )
53 return false;
54
55 array<string> selections = new array<string>;
56 target.GetObject().GetActionComponentNameList(target.GetComponentIndex(), selections);
57
58 CarScript carS = CarScript.Cast(car);
59
60 if ( carS )
61 {
62 for (int s = 0; s < selections.Count(); s++)
63 {
64 if ( selections[s] == carS.GetActionCompNameFuel() )
65 {
66 float dist = vector.DistanceSq( carS.GetRefillPointPosWS(), player.GetPosition() );
67
68 if ( dist < carS.GetActionDistanceFuel() * carS.GetActionDistanceFuel() )
69 return true;
70 }
71 }
72 }
73
74 return false;
75 }
76};
protected float m_SpecialtyWeight
Definition ActionBase.c:68
protected bool m_LockTargetOnUse
Definition ActionBase.c:51
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
protected bool IsTransport(ActionTarget target)
Definition ActionBase.c:922
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
protected bool m_FullBody
Definition ActionBase.c:52
protected int m_StanceMask
Definition ActionBase.c:53
class ActionTargets ActionTarget
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:19
protected ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
private const float TIME_TO_REPEAT
override void CreateActionComponent()
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
const string FUEL_SELECTION_NAME
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
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:602
const int LIQUID_GASOLINE
Definition constants.c:493