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

Private Member Functions

void ActionSawPlanks ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnFinishProgressServer (ActionData action_data)
 
- Private Member Functions inherited from ActionContinuousBase
void OnStartAnimationLoopServer (ActionData action_data)
 
void OnStartAnimationLoopClient (ActionData action_data)
 
void OnEndAnimationLoopServer (ActionData action_data)
 
void OnEndAnimationLoopClient (ActionData action_data)
 
void OnFinishProgressServer (ActionData action_data)
 
void OnFinishProgressClient (ActionData action_data)
 

Private Attributes

ItemBase m_Planks
 
ref InventoryLocation m_PlanksLocation = new InventoryLocation
 

Static Private Attributes

static const int DECREASE_HEALTH_OF_TOOL_DEFAULT = 10
 
static const int YIELD = 3
 

Detailed Description

Definition at line 35 of file ActionSawPlanks.c.

Constructor & Destructor Documentation

◆ ActionSawPlanks()

void ActionSawPlanks::ActionSawPlanks ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

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

Definition at line 62 of file ActionSawPlanks.c.

63 {
64 Object target_O = target.GetObject();
65
66 if (item && target_O.IsInherited(PileOfWoodenPlanks))
67 {
68 string item_type = item.GetType();
69
70 switch (item_type)
71 {
72 case "Chainsaw":
73 if (item.HasEnergyManager() && item.GetCompEM().CanWork())
74 return true;
75 else
76 return false;
77 break;
78 }
79
80 return true;
81 }
82
83 return false;
84 }

◆ CreateConditionComponents()

override void ActionSawPlanks::CreateConditionComponents ( )
inlineprivate

Definition at line 56 of file ActionSawPlanks.c.

57 {
60 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ OnFinishProgressServer()

override void ActionSawPlanks::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 86 of file ActionSawPlanks.c.

87 {
88 PileOfWoodenPlanks item_POWP = PileOfWoodenPlanks.Cast(action_data.m_Target.GetObject());
89 item_POWP.RemovePlanks(YIELD);
90
91 vector pos = action_data.m_Player.GetPosition();
92
94 if (m_Planks)
95 m_Planks.GetInventory().GetCurrentInventoryLocation(currentLoc);
96
97 if (!m_Planks || !currentLoc.CompareLocationOnly(m_PlanksLocation))
98 {
99 m_Planks = ItemBase.Cast(GetGame().CreateObjectEx("WoodenPlank", pos, ECE_PLACE_ON_SURFACE));
100 m_Planks.SetQuantity(YIELD);
101
102 m_Planks.GetInventory().GetCurrentInventoryLocation(currentLoc);
104 }
105 else if ((m_Planks.GetQuantity() + YIELD) >= m_Planks.GetQuantityMax())
106 {
107 int remnant = m_Planks.GetQuantity() + YIELD - m_Planks.GetQuantityMax();
108 m_Planks.SetQuantity(m_Planks.GetQuantityMax());
109 if (remnant > 0)
110 {
111 m_Planks = ItemBase.Cast(GetGame().CreateObjectEx("WoodenPlank", pos, ECE_PLACE_ON_SURFACE));
112 m_Planks.SetQuantity(remnant);
113
114 m_Planks.GetInventory().GetCurrentInventoryLocation(currentLoc);
116 }
117 }
118 else
119 m_Planks.AddQuantity(YIELD);
120
121 ItemBase item = action_data.m_MainItem;
122
123 string item_type = item.GetType();
124
125 item.DecreaseHealth("", "", action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(UADamageApplied.SAW_PLANKS, GetSpecialtyWeight()));
126 /*switch(item_type)
127 {
128 case "WoodAxe":
129 item.DecreaseHealth( "", "", action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus( DECREASE_HEALTH_OF_TOOL_AXE, GetSpecialtyWeight() ));
130 break;
131
132 case "FirefighterAxe":
133 item.DecreaseHealth( "", "", action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus( DECREASE_HEALTH_OF_TOOL_AXE, GetSpecialtyWeight() ));
134 break;
135
136 case "FirefighterAxe_Black":
137 item.DecreaseHealth( "", "", action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus( DECREASE_HEALTH_OF_TOOL_AXE, GetSpecialtyWeight() ));
138 break;
139
140 case "FirefighterAxe_Green":
141 item.DecreaseHealth( "", "", action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus( DECREASE_HEALTH_OF_TOOL_AXE, GetSpecialtyWeight() ));
142 break;
143
144 case "Hatchet":
145 item.DecreaseHealth( "", "", action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus( DECREASE_HEALTH_OF_TOOL_AXE, GetSpecialtyWeight() ));
146 break;
147
148 case "Chainsaw":
149 if ( item.HasEnergyManager() )
150 {
151 item.GetCompEM().ConsumeEnergy(DECREASE_FUEL_OF_CHAINSAW);
152 }
153 break;
154
155 default: // Hacksaw and other
156 item.DecreaseHealth( "", "", action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus( UADamageApplied.SAW_PLANKS, GetSpecialtyWeight() ));
157 break;
158 }*/
159
160 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
161 }
float GetSpecialtyWeight()
Definition ActionBase.c:967
const int ECE_PLACE_ON_SURFACE
static const int YIELD
ref InventoryLocation m_PlanksLocation
InventoryLocation.
const float SAW_PLANKS
proto native CGame GetGame()

References ECE_PLACE_ON_SURFACE, GetGame(), GetSpecialtyWeight(), m_Planks, m_PlanksLocation, m_SpecialtyWeight, UADamageApplied::SAW_PLANKS, and YIELD.

Member Data Documentation

◆ DECREASE_HEALTH_OF_TOOL_DEFAULT

const int ActionSawPlanks::DECREASE_HEALTH_OF_TOOL_DEFAULT = 10
staticprivate

Definition at line 37 of file ActionSawPlanks.c.

◆ m_Planks

ItemBase ActionSawPlanks::m_Planks
private

Definition at line 42 of file ActionSawPlanks.c.

Referenced by OnFinishProgressServer().

◆ m_PlanksLocation

ref InventoryLocation ActionSawPlanks::m_PlanksLocation = new InventoryLocation
private

Definition at line 43 of file ActionSawPlanks.c.

Referenced by OnFinishProgressServer().

◆ YIELD

const int ActionSawPlanks::YIELD = 3
staticprivate

Definition at line 41 of file ActionSawPlanks.c.

Referenced by OnFinishProgressServer().


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