Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
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  {
7  m_ActionData.m_ActionComponent = new CAContinuousFillFuel( UAQuantityConsumed.FUEL, TIME_TO_REPEAT );
8  }
9 };
10 
12 {
13  const string FUEL_SELECTION_NAME = "refill";
14 
15  void ActionFillFuel()
16  {
17  m_CallbackClass = ActionFillFuelCB;
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 
26  override void CreateConditionComponents()
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 };
ItemBase
Definition: inventoryitem.c:730
CAContinuousFillFuel
Definition: cacontinuousfillfuel.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
UAQuantityConsumed
Definition: actionconstants.c:3
CarScript
Definition: civiliansedan.c:1
CCTNone
Definition: cctnone.c:1
LIQUID_GASOLINE
const int LIQUID_GASOLINE
Definition: constants.c:509
IsTransport
protected bool IsTransport(ActionTarget target)
Definition: actionbase.c:923
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
CarFluid
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition: car.c:18
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
ActionTarget
class ActionTargets ActionTarget
TIME_TO_REPEAT
const private float TIME_TO_REPEAT
Definition: actionextinguishfireplacebyextinguisher.c:2
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ActionFillFuel
Definition: actionfillfuel.c:11
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
m_LockTargetOnUse
protected bool m_LockTargetOnUse
Definition: actionbase.c:51
array< string >
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
ActionFillFuelCB
Definition: actionfillfuel.c:1