DayZ 1.24
Loading...
Searching...
No Matches
ActionRemovePlant.c
Go to the documentation of this file.
2{
3 PlantBase m_Plant;
4
6 {
7 m_Text = "#remove_plant";
8 }
9
10 override typename GetInputType()
11 {
13 }
14
20
21 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
22 {
24 if (Class.CastTo(garden_base, target.GetObject()))
25 {
26 Slot slot;
27
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
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};
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnExecuteServer(ActionData action_data)
override void CreateConditionComponents()
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float SMALL
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.