DayZ
1.24
Loading...
Searching...
No Matches
ActionRemovePlant.c
Go to the documentation of this file.
1
class
ActionRemovePlant
:
ActionInteractBase
2
{
3
PlantBase
m_Plant
;
4
5
void
ActionRemovePlant
()
6
{
7
m_Text
=
"#remove_plant"
;
8
}
9
10
override
typename
GetInputType
()
11
{
12
return
ContinuousInteractActionInput
;
13
}
14
15
override
void
CreateConditionComponents
()
16
{
17
m_ConditionItem
=
new
CCINone
;
18
m_ConditionTarget
=
new
CCTCursor
(
UAMaxDistances
.
SMALL
);
19
}
20
21
override
bool
ActionCondition
(
PlayerBase
player
, ActionTarget
target
,
ItemBase
item
)
22
{
23
GardenBase
garden_base
;
24
if
(
Class
.
CastTo
(
garden_base
,
target
.GetObject()))
25
{
26
Slot
slot;
27
28
array<string>
selections
=
new
array<string>
;
29
garden_base
.GetActionComponentNameList(
target
.GetComponentIndex(),
selections
);
30
string
selection;
31
32
for
(
int
s
= 0;
s
<
selections
.Count();
s
++)
33
{
34
selection =
selections
[
s
];
35
slot =
garden_base
.GetSlotBySelection(selection);
36
if
(slot)
37
break
;
38
}
39
40
if
(slot && slot.GetPlant())
41
{
42
m_Plant
= PlantBase.Cast(slot.GetPlant());
43
if
(
m_Plant
.IsGrowing() ||
m_Plant
.IsDry() || !
m_Plant
.HasCrops() ||
m_Plant
.IsSpoiled())
44
return
true
;
45
}
46
}
47
return
false
;
48
/*Object targetObject = target.GetObject();
49
if ( targetObject != NULL && targetObject.IsInherited(PlantBase) )
50
{
51
PlantBase plant = PlantBase.Cast( targetObject );
52
53
if ( plant.IsGrowing() || plant.IsDry() || !plant.HasCrops() || plant.IsSpoiled())
54
{
55
return true;
56
}
57
}
58
59
return false;*/
60
}
61
62
override
void
OnExecuteServer
(
ActionData
action_data
)
63
{
64
if
(
m_Plant
)
65
{
66
//m_Plant.RemovePlant();
67
68
//New method allowing us to pass player position
69
m_Plant
.RemovePlantEx(
action_data
.m_Player.GetPosition());
70
}
71
/*Object targetObject = action_data.m_Target.GetObject();
72
if ( targetObject != NULL && targetObject.IsInherited(PlantBase) )
73
{
74
PlantBase plant = PlantBase.Cast( targetObject );
75
plant.RemovePlant();
76
}*/
77
}
78
};
m_Text
string m_Text
Definition
ActionBase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition
ActionBase.c:55
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
ActionBase.c:56
ActionData
Definition
ActionBase.c:21
ActionInteractBase
Definition
ActionInteractBase.c:50
ActionRemovePlant
Definition
ActionRemovePlant.c:2
ActionRemovePlant::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
ActionRemovePlant.c:21
ActionRemovePlant::GetInputType
override GetInputType()
Definition
ActionRemovePlant.c:10
ActionRemovePlant::ActionRemovePlant
void ActionRemovePlant()
Definition
ActionRemovePlant.c:5
ActionRemovePlant::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
ActionRemovePlant.c:62
ActionRemovePlant::CreateConditionComponents
override void CreateConditionComponents()
Definition
ActionRemovePlant.c:15
ActionRemovePlant::m_Plant
PlantBase m_Plant
Definition
ActionRemovePlant.c:3
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:504
GardenBase
Definition
GardenPlot.c:2
ItemBase
Definition
InventoryItem.c:697
Param3
Definition
EntityAI.c:95
PlayerBase
Definition
PlayerBaseClient.c:2
UAMaxDistances
Definition
ActionConstants.c:105
UAMaxDistances::SMALL
const float SMALL
Definition
ActionConstants.c:106
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
scripts
4_World
Classes
UserActionsComponent
Actions
Interact
ActionRemovePlant.c
Generated by
1.10.0