Dayz Explorer 1.28.160049
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
15 override void CreateConditionComponents()
16 {
19 }
20
21 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
22 {
23 if (!super.ActionCondition(player, target, item))
24 return false;
25
26 GardenBase garden_base;
27 if ( Class.CastTo(garden_base, target.GetObject()))
28 {
29 Slot slot;
30
31 array<string> selections = new array<string>;
32 garden_base.GetActionComponentNameList(target.GetComponentIndex(), selections);
33 string selection;
34
35 for (int s = 0; s < selections.Count(); s++)
36 {
37 selection = selections[s];
38 slot = garden_base.GetSlotBySelection( selection );
39 if (slot)
40 break;
41 }
42
43 if ( slot && slot.GetPlant() )
44 {
45 m_Plant = PlantBase.Cast(slot.GetPlant());
46 if (!m_Plant.IsHarvestable())
47 return true;
48 }
49 }
50 return false;
51 }
52
53 override void OnExecuteServer(ActionData action_data)
54 {
55 super.OnExecuteServer(action_data);
56
57 if (m_Plant)
58 m_Plant.RemovePlantEx(action_data.m_Player.GetPosition());
59 }
60};
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
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.