DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionMineTree.c
Go to the documentation of this file.
2{
4}
5
6class 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{
19
21 {
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{
62 void ActionMineTree()
63 {
64 m_CallbackClass = ActionMineTreeCB;
65 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_HACKTREE;
66 m_FullBody = true;
67 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
69 }
70
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};
protected float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
protected bool m_FullBody
Definition ActionBase.c:52
protected int m_StanceMask
Definition ActionBase.c:53
override bool CanContinue(ActionData action_data)
not checking target damage anymore, callback takes care of that
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
ActionMineBase ActionContinuousBase ActionMineTree()
MineActionData TIME_BETWEEN_MATERIAL_DROPS_DEFAULT
class ActionTargets ActionTarget
eBrokenLegs
Definition EBrokenLegs.c:2
void WoodBase()
Definition WoodBase.c:30
EHarvestType
Definition WoodBase.c:2
void CreateActionComponent()
protected void OnFinishProgressServer(ActionData action_data)
int m_PossibleStanceMask
Definition ActionBase.c:34
ItemBase m_MainItem
Definition ActionBase.c:28
PlayerBase m_Player
Definition ActionBase.c:33
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
override ActionData CreateActionData()
EHarvestType m_HarvestType
string GetYieldName(PlayerBase player, ActionTarget target, ItemBase item)
override bool ActionConditionContinue(ActionData action_data)
bool CanContinue(PlayerBase player, ItemBase item)
Definition CCIBase.c:8
EHarvestType m_HarvestType
void GetMaterialAndQuantityMap(ItemBase item, out map< string, int > output_map)
Definition RockBase.c:30
const float SMALL
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602