Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionremoveplant.c
Go to the documentation of this file.
2 {
3  PlantBase m_Plant;
4 
5  void ActionRemovePlant()
6  {
7  m_Text = "#remove_plant";
8  }
9 
10  override typename GetInputType()
11  {
13  }
14 
15  override void CreateConditionComponents()
16  {
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  {
45  return true;
46  }
47  }
48  }
49  return false;
50  /*Object targetObject = target.GetObject();
51  if ( targetObject != NULL && targetObject.IsInherited(PlantBase) )
52  {
53  PlantBase plant = PlantBase.Cast( targetObject );
54 
55  if ( plant.IsGrowing() || plant.IsDry() || !plant.HasCrops() || plant.IsSpoiled())
56  {
57  return true;
58  }
59  }
60 
61  return false;*/
62  }
63 
64  override void OnExecuteServer( ActionData action_data )
65  {
66  if ( m_Plant )
67  {
68  //m_Plant.RemovePlant();
69 
70  //New method allowing us to pass player position
71  m_Plant.RemovePlantEx( action_data.m_Player.GetPosition() );
72  }
73  /*Object targetObject = action_data.m_Target.GetObject();
74  if ( targetObject != NULL && targetObject.IsInherited(PlantBase) )
75  {
76  PlantBase plant = PlantBase.Cast( targetObject );
77  plant.RemovePlant();
78  }*/
79  }
80 };
ItemBase
Definition: inventoryitem.c:730
ContinuousInteractActionInput
Definition: actioninput.c:521
CCINone
Definition: ccinone.c:1
ActionRemovePlant
Definition: actionremoveplant.c:1
UAMaxDistances
Definition: actionconstants.c:104
ActionInteractBase
Definition: actioninteractbase.c:54
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
CCTCursor
Definition: cctcursor.c:1
array< string >
m_Text
protected 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
GardenBase
Definition: gardenplot.c:1
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10