Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionharvestcrops.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
5 m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.DEFAULT_HARVEST);
6 }
7};
8
10{
11 PlantBase m_Plant;
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
26 Slot GetPlantSlot(ActionTarget target)
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
67 override void CreateConditionComponents()
68 {
71 }
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};
ActionData m_ActionData
int m_StanceMask
Definition actionbase.c:62
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
bool m_FullBody
Definition actionbase.c:61
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
Super root of all classes in Enforce script.
Definition enscript.c:11
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602