Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionfilloil.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 CAContinuousFillOil( UAQuantityConsumed.POUR_LIQUID, TIME_TO_REPEAT );
8  }
9 };
10 
12 {
13  void ActionFillOil()
14  {
15  m_CallbackClass = ActionFillOilCB;
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.OIL ) >= 0.98 )
43  return false;
44 
45  array<string> selections = new array<string>;
46  target.GetObject().GetActionComponentNameList(target.GetComponentIndex(), selections);
47 
48  CarScript carS = CarScript.Cast(car);
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 
66  override void OnEndAnimationLoopServer( ActionData action_data )
67  {
68  if ( action_data.m_MainItem && action_data.m_MainItem.GetQuantity() <= 0.01 )
69  {
70  action_data.m_MainItem.SetQuantity(0);
71  }
72  }
73 };
ItemBase
Definition: inventoryitem.c:730
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
ActionFillOilCB
Definition: actionfilloil.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
CAContinuousFillOil
Definition: cacontinuousfilloil.c:1
CCINonRuined
Definition: ccinonruined.c:1
ActionFillOil
Definition: actionfilloil.c:11
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