DayZ 1.24
Loading...
Searching...
No Matches
ActionPlantSeed.c
Go to the documentation of this file.
2{
4 {
6
7 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_DROPITEM_HANDS;
8 m_FullBody = false;
9 m_Text = "#plant_seed";
10 }
11
17
18 override bool HasTarget()
19 {
20 return true;
21 }
22
23 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
24 {
25 GardenBase targetObject = GardenBase.Cast(target.GetObject());
26
27 if (targetObject && (!targetObject.IsHologram() || !targetObject.IsBeingPlaced()))
28 {
30 targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections);
31
32 for (int s = 0; s < selections.Count(); s++)
33 {
34 string selection = selections[s];
35 Slot slot = targetObject.GetSlotBySelection(selection);
36 if (slot)
37 {
38 if (item != NULL && item.GetQuantity() > 0 && targetObject.CanPlantSeed(selection))
39 return true;
40 }
41 }
42 }
43
44 return false;
45 }
46
51
53 {
54 //Process(action_data);
55 }
56
58 {
59 Object targetObject = action_data.m_Target.GetObject();
60 int slot_ID;
61
62 if (targetObject != NULL && targetObject.IsInherited(GardenBase))
63 {
66 targetObject.GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selections);
67
68 for (int s = 0; s < selections.Count(); s++)
69 {
70 string selection = selections[s];
71 Slot slot = garden_base.GetSlotBySelection(selection);
72 if (slot)
73 {
74 slot_ID = slot.GetSlotId();
75 break;
76 }
77 }
78
79 //int slot_ID = slot.GetSlotId();
80
81 ItemBase seed_IB = ItemBase.Cast(action_data.m_MainItem);
82
83 seed_IB.SplitIntoStackMax(garden_base, slot_ID, action_data.m_Player);
84 }
85
86 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
87 }
88};
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
override void OnExecuteServer(ActionData action_data)
void Process(ActionData action_data)
override void CreateConditionComponents()
override bool HasTarget()
override void OnExecuteClient(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
const float PRECISE_MEDIUM
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597