Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionharvestcrops.c
Go to the documentation of this file.
1
class
ActionHarvestCropsCB
:
ActionContinuousBaseCB
2
{
3
override
void
CreateActionComponent
()
4
{
5
m_ActionData
.m_ActionComponent =
new
CAContinuousTime
(
UATimeSpent
.
DEFAULT_HARVEST
);
6
}
7
};
8
9
class
ActionHarvestCrops
:
ActionContinuousBase
10
{
11
PlantBase
m_Plant
;
12
13
void
ActionHarvestCrops
()
14
{
15
m_CallbackClass
=
ActionHarvestCropsCB
;
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
{
23
return
ContinuousInteractActionInput
;
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
{
69
m_ConditionItem
=
new
CCINone
;
70
m_ConditionTarget
=
new
CCTCursor
(
UAMaxDistances
.
SMALL
);
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
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBaseCB::m_ActionData
ActionData m_ActionData
Definition
animatedactionbase.c:3
ActionBase::m_FullBody
bool m_FullBody
Definition
actionbase.c:67
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionContinuousBaseCB
Definition
actioncontinuousbase.c:2
ActionContinuousBase::ActionContinuousBase
void ActionContinuousBase()
Definition
actioncontinuousbase.c:124
ActionHarvestCropsCB
Definition
actionharvestcrops.c:2
ActionHarvestCropsCB::CreateActionComponent
override void CreateActionComponent()
Definition
actionharvestcrops.c:3
ActionHarvestCrops::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actionharvestcrops.c:91
ActionHarvestCrops::OnActionInfoUpdate
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionharvestcrops.c:53
ActionHarvestCrops::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionharvestcrops.c:67
ActionHarvestCrops::m_Plant
PlantBase m_Plant
Definition
actionharvestcrops.c:11
ActionHarvestCrops::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionharvestcrops.c:73
ActionHarvestCrops::ActionHarvestCrops
void ActionHarvestCrops()
Definition
actionharvestcrops.c:13
ActionHarvestCrops::GetInputType
override GetInputType()
Definition
actionharvestcrops.c:21
ActionHarvestCrops::GetPlantSlot
Slot GetPlantSlot(ActionTarget target)
Definition
actionharvestcrops.c:26
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
AnimatedActionBase::m_CallbackClass
m_CallbackClass
Definition
animatedactionbase.c:145
CAContinuousTime
Definition
cacontinuoustime.c:2
CCINone
Definition
ccinone.c:2
CCTCursor
Definition
cctcursor.c:2
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
ContinuousInteractActionInput
Definition
actioninput.c:523
GardenBase
Definition
gardenplot.c:2
ItemBase
Definition
inventoryitem.c:742
PlayerBase
Definition
playerbaseclient.c:2
UAMaxDistances
Definition
actionconstants.c:110
UAMaxDistances::SMALL
const float SMALL
Definition
actionconstants.c:111
UATimeSpent
Definition
actionconstants.c:28
UATimeSpent::DEFAULT_HARVEST
const float DEFAULT_HARVEST
Definition
actionconstants.c:41
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
PlantBase
void PlantBase()
Definition
plantbase.c:54
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
interact
actionharvestcrops.c
Generated by
1.17.0