DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
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 {
8 }
9};
10
12{
14 {
16 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_EMPTY_VESSEL;
17 m_FullBody = true;
19 m_Text = "#water_slot";
20 }
21
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};
protected float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
protected bool m_FullBody
Definition ActionBase.c:52
class ActionTargets ActionTarget
protected ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
private const float QUANTITY_USED_PER_SEC
override void CreateActionComponent()
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
const int LIQUID_WATER
Definition constants.c:489