Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
actionharvestcrops.c
Go to the documentation of this file.
8
10{
12
14 {
16 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
17 m_FullBody = true;
18 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
19 }
20
21 override typename GetInputType()
22 {
24 }
25
27 {
28 GardenBase garden_base;
29 if ( Class.CastTo(garden_base, target.GetObject()))
30 {
31 Slot slot;
32
33 array<string> selections = new array<string>;
34 garden_base.GetActionComponentNameList(target.GetComponentIndex(), selections);
35 string selection;
36
37 for (int s = 0; s < selections.Count(); s++)
38 {
39 selection = selections[s];
40 slot = garden_base.GetSlotBySelection( selection );
41 if (slot)
42 break;
43 }
44
45 if ( slot && slot.GetPlant() )
46 {
47 return slot;
48 }
49 }
50 return null;
51 }
52
53 override void OnActionInfoUpdate( PlayerBase player, ActionTarget target, ItemBase item )
54 {
55 m_Text = "#harvest";
56
57 Slot slot = GetPlantSlot(target);
58
59 if (slot)
60 {
61 m_Plant = PlantBase.Cast(slot.GetPlant());
62 m_Text+= " " + MiscGameplayFunctions.GetItemDisplayName(m_Plant.GetCropsType());
63 }
64
65 }
66
72
73 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
74 {
75 GardenBase garden_base;
76 if ( Class.CastTo(garden_base, target.GetObject()))
77 {
78 Slot slot = GetPlantSlot(target);
79
80 if (slot)
81 {
82 m_Plant = PlantBase.Cast(slot.GetPlant());
83 if ( m_Plant && m_Plant.IsHarvestable())
84 return true;
85 }
86 }
87 return false;
88
89 }
90
91 override void OnFinishProgressServer( ActionData action_data )
92 {
93 if ( m_Plant )
94 {
95 m_Plant.Harvest( action_data.m_Player );
96 }
97 }
98};
ActionBase ActionData
Definition actionbase.c:30
class ActionTargets ActionTarget
ActionData m_ActionData
bool m_FullBody
Definition actionbase.c:67
string m_Text
Definition actionbase.c:64
ref CCIBase m_ConditionItem
Definition actionbase.c:70
ref CCTBase m_ConditionTarget
Definition actionbase.c:71
int m_StanceMask
Definition actionbase.c:68
override void CreateActionComponent()
override void OnFinishProgressServer(ActionData action_data)
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Slot GetPlantSlot(ActionTarget target)
Super root of all classes in Enforce script.
Definition enscript.c:11
const float SMALL
const float DEFAULT_HARVEST
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
void PlantBase()
Definition plantbase.c:54