Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionwatergardenslot.c
Go to the documentation of this file.
2 {
3  private const float QUANTITY_USED_PER_SEC = 150;
4 
5  override void CreateActionComponent()
6  {
7  m_ActionData.m_ActionComponent = new CAContinuousWaterSlot(QUANTITY_USED_PER_SEC);
8  }
9 };
10 
12 {
14  {
15  m_CallbackClass = ActionWaterGardenSlotCB;
16  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_EMPTY_VESSEL;
17  m_FullBody = true;
19  m_Text = "#water_slot";
20  }
21 
22  override void CreateConditionComponents()
23  {
26  }
27 
28  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
29  {
30  Object targetObject = target.GetObject();
31 
32  if (item.GetQuantity() == 0)
33  return false;
34 
35  // Get the liquid
36  int liquid_type = item.GetLiquidType();
37 
38  if (liquid_type != LIQUID_WATER)
39  {
40  return false; // Forbid watering of plants with gasoline and other fluids
41  }
42 
43  if ( targetObject.IsInherited(GardenBase) )
44  {
45  GardenBase garden_base = GardenBase.Cast( targetObject );
46 
47  Slot slot;
48 
49  array<string> selections = new array<string>;
50  targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections);
51 
52  for (int s = 0; s < selections.Count(); s++)
53  {
54  string selection = selections[s];
55  slot = garden_base.GetSlotBySelection( selection );
56  if (slot)
57  break;
58  }
59 
60  if ( slot && !slot.GetPlant() && slot.CanBeWatered() && slot.GetWateredState() == 0 )
61  {
62  return true;
63  }
64  else
65  {
66  return false;
67  }
68  }
69 
70  return false;
71  }
72 };
ItemBase
Definition: inventoryitem.c:730
UASoftSkillsWeight
Definition: actionconstants.c:118
LIQUID_WATER
const int LIQUID_WATER
Definition: constants.c:505
ActionWaterGardenSlotCB
Definition: actionwatergardenslot.c:1
CAContinuousWaterSlot
Definition: cacontinuouswaterslot.c:1
CCTDummy
Definition: cctdummy.c:1
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
Object
Definition: objecttyped.c:1
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
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
GardenBase
Definition: gardenplot.c:1
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
ActionWaterGardenSlot
Definition: actionwatergardenslot.c:11