Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionminetree.c
Go to the documentation of this file.
2 {
3  EHarvestType m_HarvestType = EHarvestType.NORMAL;
4 }
5 
6 class ActionMineTreeCB : ActionContinuousBaseCB
7 {
8  private const float TIME_BETWEEN_MATERIAL_DROPS_DEFAULT = 4;
9 
10  override void CreateActionComponent()
11  {
12  m_ActionData.m_ActionComponent = new CAContinuousMineWood(TIME_BETWEEN_MATERIAL_DROPS_DEFAULT);
13  }
14 };
15 
17 {
18  EHarvestType m_HarvestType = EHarvestType.NORMAL;
19 
20  override ActionData CreateActionData()
21  {
22  MineActionData data = new MineActionData;
23  data.m_HarvestType = m_HarvestType;
24  return data;
25  }
26 
27  override void OnActionInfoUpdate( PlayerBase player, ActionTarget target, ItemBase item )
28  {
29  m_Text = "#harvest" + " " + GetYieldName(player, target, item);
30  }
31 
32  string GetYieldName( PlayerBase player, ActionTarget target, ItemBase item )
33  {
34  //given the circumstances, the implementation bellow is the path of least resistance
35  Object targetObject = target.GetObject();
36  WoodBase wood = WoodBase.Cast(targetObject);
37  RockBase rock = RockBase.Cast(targetObject);
38  string yieldName;
39  if (wood || rock)
40  {
41  map<string,int> output_map = new map<string,int>;
42  if (wood)
43  {
44  wood.GetMaterialAndQuantityMapEx(item, output_map, m_HarvestType);
45  }
46  else
47  {
48  rock.GetMaterialAndQuantityMap(item, output_map);
49  }
50  if (output_map.Count() > 0)
51  {
52  yieldName = MiscGameplayFunctions.GetItemDisplayName(output_map.GetKey(0));
53  }
54  }
55  return yieldName;
56  }
57 
58 }
59 
61 {
63  {
64  m_CallbackClass = ActionMineTreeCB;
65  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_HACKTREE;
66  m_FullBody = true;
67  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
69  }
70 
71  override void CreateConditionComponents()
72  {
75  }
76 
77  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
78  {
79  //Action not allowed if player has broken legs
80  if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
81  return false;
82 
83  Object targetObject = target.GetObject();
84 
85  return targetObject.IsTree() && targetObject.IsCuttable();
86  }
87 
89  override bool CanContinue(ActionData action_data)
90  {
91  if (!action_data.m_Player.IsPlayerInStance(action_data.m_PossibleStanceMask) || !m_ConditionItem || !m_ConditionItem.CanContinue(action_data.m_Player,action_data.m_MainItem))
92  return false;
93 
94  return ActionConditionContinue(action_data);
95  }
96 
97  override void OnFinishProgressServer( ActionData action_data )
98  {
99  action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
100  }
101 };
ItemBase
Definition: inventoryitem.c:730
ActionConditionContinue
protected bool ActionConditionContinue(ActionData action_data)
Definition: actionbase.c:367
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actionminetree.c:77
WoodBase
void WoodBase()
Definition: woodbase.c:30
UASoftSkillsWeight
Definition: actionconstants.c:118
OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition: actionminetree.c:97
ActionMineBase
Definition: actionminetree.c:16
ActionMineTree
ActionMineBase ActionContinuousBase ActionMineTree()
Definition: actionminetree.c:62
UAMaxDistances
Definition: actionconstants.c:104
CreateConditionComponents
override void CreateConditionComponents()
Definition: actionminetree.c:71
eBrokenLegs
eBrokenLegs
Definition: ebrokenlegs.c:1
CanContinue
override bool CanContinue(ActionData action_data)
not checking target damage anymore, callback takes care of that
Definition: actionminetree.c:89
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
CreateActionComponent
override void CreateActionComponent()
Definition: actionminetree.c:10
EHarvestType
EHarvestType
Definition: woodbase.c:1
PlayerBase
Definition: playerbaseclient.c:1
map
map
Definition: controlsxboxnew.c:3
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
Object
Definition: objecttyped.c:1
RockBase
Definition: rockbase.c:1
TIME_BETWEEN_MATERIAL_DROPS_DEFAULT
MineActionData TIME_BETWEEN_MATERIAL_DROPS_DEFAULT
CCTCursor
Definition: cctcursor.c:1
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
m_HarvestType
EHarvestType m_HarvestType
Definition: actionminetree.c:11
CAContinuousMineWood
Definition: cacontinuousminewood.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
MineActionData
Definition: actionminetree.c:1
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53