DayZ 1.24
Loading...
Searching...
No Matches
ActionHarvestCrops Class Reference
Inheritance diagram for ActionHarvestCrops:
[legend]
Collaboration diagram for ActionHarvestCrops:
[legend]

Private Member Functions

void ActionHarvestCrops ()
 
override GetInputType ()
 
Slot GetPlantSlot (ActionTarget target)
 
override void OnActionInfoUpdate (PlayerBase player, ActionTarget target, ItemBase item)
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteServer (ActionData action_data)
 

Private Attributes

PlantBase m_Plant
 

Detailed Description

Definition at line 1 of file ActionHarvestCrops.c.

Constructor & Destructor Documentation

◆ ActionHarvestCrops()

void ActionHarvestCrops::ActionHarvestCrops ( )
inlineprivate

Definition at line 5 of file ActionHarvestCrops.c.

6 {
7
9 /*m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
10 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
11 m_FullBody = true;*/
12 }
float m_SpecialtyWeight
Definition ActionBase.c:68
const float PRECISE_MEDIUM

References m_SpecialtyWeight, and UASoftSkillsWeight::PRECISE_MEDIUM.

Member Function Documentation

◆ ActionCondition()

override bool ActionHarvestCrops::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 64 of file ActionHarvestCrops.c.

65 {
67 if (Class.CastTo(garden_base, target.GetObject()))
68 {
69 Slot slot = GetPlantSlot(target);
70
71 if (slot)
72 {
73 m_Plant = PlantBase.Cast(slot.GetPlant());
74 bool is_mature = m_Plant.IsMature();
75 bool is_spoiled = m_Plant.IsSpoiled();
76 bool has_crops = m_Plant.HasCrops();
77 int plant_state = m_Plant.GetPlantState();
78
79 if (is_mature && has_crops)
80 return true;
81 }
82 }
83 return false;
84
85 }
Slot GetPlantSlot(ActionTarget target)
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), GetPlantSlot(), and m_Plant.

◆ CreateConditionComponents()

override void ActionHarvestCrops::CreateConditionComponents ( )
inlineprivate

Definition at line 58 of file ActionHarvestCrops.c.

59 {
62 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const float SMALL

References m_ConditionItem, m_ConditionTarget, and UAMaxDistances::SMALL.

◆ GetInputType()

override ActionHarvestCrops::GetInputType ( )
inlineprivate

Definition at line 14 of file ActionHarvestCrops.c.

◆ GetPlantSlot()

Slot ActionHarvestCrops::GetPlantSlot ( ActionTarget target)
inlineprivate

Definition at line 19 of file ActionHarvestCrops.c.

20 {
22 if (Class.CastTo(garden_base, target.GetObject()))
23 {
24 Slot slot;
25
27 garden_base.GetActionComponentNameList(target.GetComponentIndex(), selections);
28 string selection;
29
30 for (int s = 0; s < selections.Count(); s++)
31 {
32 selection = selections[s];
33 slot = garden_base.GetSlotBySelection(selection);
34 if (slot)
35 break;
36 }
37
38 if (slot && slot.GetPlant())
39 return slot;
40 }
41 return null;
42 }

References Class::CastTo().

Referenced by ActionCondition(), and OnActionInfoUpdate().

◆ OnActionInfoUpdate()

override void ActionHarvestCrops::OnActionInfoUpdate ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 44 of file ActionHarvestCrops.c.

45 {
46 m_Text = "#harvest";
47
48 Slot slot = GetPlantSlot(target);
49
50 if (slot)
51 {
52 m_Plant = PlantBase.Cast(slot.GetPlant());
53 m_Text += " " + MiscGameplayFunctions.GetItemDisplayName(m_Plant.GetCropsType());
54 }
55
56 }
string m_Text
Definition ActionBase.c:49

References GetPlantSlot(), m_Plant, and m_Text.

◆ OnExecuteServer()

override void ActionHarvestCrops::OnExecuteServer ( ActionData action_data)
inlineprivate

Definition at line 87 of file ActionHarvestCrops.c.

88 {
89 if (m_Plant)
90 {
91 m_Plant.Harvest(action_data.m_Player);
92
93 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
94 }
95 }

References m_Plant, and m_SpecialtyWeight.

Member Data Documentation

◆ m_Plant

PlantBase ActionHarvestCrops::m_Plant
private

Definition at line 3 of file ActionHarvestCrops.c.

Referenced by ActionCondition(), OnActionInfoUpdate(), and OnExecuteServer().


The documentation for this class was generated from the following file: