Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionfillcoolant.c
Go to the documentation of this file.
2 {
3  private const float TIME_TO_REPEAT = 0.075;
4 
5  override void CreateActionComponent()
6  {
7  m_ActionData.m_ActionComponent = new CAContinuousFillCoolant( UAQuantityConsumed.FUEL, TIME_TO_REPEAT );
8  }
9 };
10 
12 {
13  const string RADIATOR_SELECTION_NAME = "radiator";
14 
15  void ActionFillCoolant()
16  {
17  m_CallbackClass = ActionFillCoolantCB;
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 
27  override void CreateConditionComponents()
28  {
30  m_ConditionTarget = new CCTParent(10);
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 
56  array<string> selections = new array<string>;
57  target.GetObject().GetActionComponentNameList(target.GetComponentIndex(), selections);
58 
59  CarScript carS = CarScript.Cast(car);
60 
61  if( carS )
62  {
63  EntityAI radiator = null;
64  EntityAI carAI;
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 };
ItemBase
Definition: inventoryitem.c:730
LIQUID_RIVERWATER
const int LIQUID_RIVERWATER
Definition: constants.c:506
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
ActionFillCoolantCB
Definition: actionfillcoolant.c:1
CCTParent
Definition: cctobject.c:26
UASoftSkillsWeight
Definition: actionconstants.c:118
UAQuantityConsumed
Definition: actionconstants.c:3
CarScript
Definition: civiliansedan.c:1
LIQUID_WATER
const int LIQUID_WATER
Definition: constants.c:505
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
CAContinuousFillCoolant
Definition: cacontinuousfillcoolant.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
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
EntityAI
Definition: building.c:5
ActionFillCoolant
Definition: actionfillcoolant.c:11