Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionfillbrakes.c
Go to the documentation of this file.
2 {
3  private const float TIME_TO_REPEAT = 0.05;
4 
5  override void CreateActionComponent()
6  {
7  m_ActionData.m_ActionComponent = new CAContinuousFillBrakes( UAQuantityConsumed.POUR_LIQUID, TIME_TO_REPEAT );
8  }
9 };
10 
12 {
13  void ActionFillBrakes()
14  {
15  m_CallbackClass = ActionFillBrakesCB;
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 
24  override void CreateConditionComponents()
25  {
28  }
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.BRAKE ) >= 0.98 )
43  return false;
44 
45  float distance = Math.AbsFloat(vector.Distance(car.GetPosition(), player.GetPosition()));
46 
47  CarScript carS = CarScript.Cast(car);
48  if( distance <= carS.GetActionDistanceFuel() )
49  {
50  array<string> selections = new array<string>;
51  target.GetObject().GetActionComponentNameList(target.GetComponentIndex(), selections);
52 
53  for (int s = 0; s < selections.Count(); s++)
54  {
55  if ( selections[s] == carS.GetActionCompNameBrakes() )
56  {
57  return true;
58  }
59  }
60  }
61  return false;
62  }
63 
64  override void OnEndAnimationLoopServer( ActionData action_data )
65  {
66  if ( action_data.m_MainItem && action_data.m_MainItem.GetQuantity() <= 0.01 )
67  {
68  action_data.m_MainItem.SetQuantity(0);
69  }
70  }
71 };
ItemBase
Definition: inventoryitem.c:730
ActionFillBrakesCB
Definition: actionfillbrakes.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
UAQuantityConsumed
Definition: actionconstants.c:3
CarScript
Definition: civiliansedan.c:1
CCTNone
Definition: cctnone.c:1
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
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
CAContinuousFillBrakes
Definition: cacontinuousfillbrakes.c:1
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
ActionFillBrakes
Definition: actionfillbrakes.c:11
CCINonRuined
Definition: ccinonruined.c:1
Math
Definition: enmath.c:6
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