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

Protected Member Functions

void InitCuttingTypes ()
 
void ActionCraftBolts ()
 
override void CreateConditionComponents ()
 
bool IsCuttingType (Object item)
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnStartServer (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 

Protected Attributes

bool m_IsKnifeInHands
 
Ammunition_Base m_ResultEntity
 

Private Attributes

const ref set< stringCUTTING_TYPES = new set<string>()
 

Additional Inherited Members

- 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)
 

Detailed Description

Definition at line 11 of file ActionCraftBolts.c.

Constructor & Destructor Documentation

◆ ActionCraftBolts()

void ActionCraftBolts::ActionCraftBolts ( )
inlineprotected

Member Function Documentation

◆ ActionCondition()

override bool ActionCraftBolts::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprotected

Definition at line 66 of file ActionCraftBolts.c.

67 {
69 {
70 //knife in hands
71 if (target.GetObject())
72 return (target.GetObject().ClassName() == "WoodenStick");
73 }
74 else if (target.GetObject())
75 {
76 // material in hands
77 return IsCuttingType(target.GetObject());
78 }
79
80 return false;
81 }
bool IsCuttingType(Object item)

References IsCuttingType().

◆ CreateConditionComponents()

override void ActionCraftBolts::CreateConditionComponents ( )
inlineprotected

Definition at line 55 of file ActionCraftBolts.c.

56 {
59 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ InitCuttingTypes()

void ActionCraftBolts::InitCuttingTypes ( )
inlineprotected

Definition at line 18 of file ActionCraftBolts.c.

19 {
20 CUTTING_TYPES.Clear();
21 CUTTING_TYPES.Insert("Sickle");
22 CUTTING_TYPES.Insert("KukriKnife");
23 CUTTING_TYPES.Insert("FangeKnife");
24 CUTTING_TYPES.Insert("KitchenKnife");
25 CUTTING_TYPES.Insert("SteakKnife");
26 CUTTING_TYPES.Insert("StoneKnife");
27 CUTTING_TYPES.Insert("Cleaver");
28 CUTTING_TYPES.Insert("CombatKnife");
29 CUTTING_TYPES.Insert("HuntingKnife");
30 CUTTING_TYPES.Insert("Machete");
31 CUTTING_TYPES.Insert("CrudeMachete");
32 CUTTING_TYPES.Insert("OrientalMachete");
33 CUTTING_TYPES.Insert("WoodAxe");
34 CUTTING_TYPES.Insert("Hatchet");
35 CUTTING_TYPES.Insert("FirefighterAxe");
36 CUTTING_TYPES.Insert("AK_Bayonet");
37 CUTTING_TYPES.Insert("M9A1_Bayonet");
38 CUTTING_TYPES.Insert("SKS_Bayonet");
39 CUTTING_TYPES.Insert("BoneKnife");
40 }
const ref set< string > CUTTING_TYPES

References CUTTING_TYPES.

Referenced by ActionCraftBolts().

◆ IsCuttingType()

bool ActionCraftBolts::IsCuttingType ( Object item)
inlineprotected

Definition at line 61 of file ActionCraftBolts.c.

62 {
63 return CUTTING_TYPES.Find(item.ClassName()) >= 0;
64 }

References CUTTING_TYPES.

Referenced by ActionCondition(), and OnStartServer().

◆ OnFinishProgressServer()

override void ActionCraftBolts::OnFinishProgressServer ( ActionData action_data)
inlineprotected

Definition at line 89 of file ActionCraftBolts.c.

90 {
93
94 bool added = false;
95
97 {
98 //knife in hands
99 knife = action_data.m_MainItem;
100 material = ItemBase.Cast(action_data.m_Target.GetObject());
101 }
102 else
103 {
104 // material in hands
105 material = action_data.m_MainItem;
106 knife = ItemBase.Cast(action_data.m_Target.GetObject());
107 }
108
109 if (!material || !knife)
110 return;
111
112 if (m_ResultEntity)
113 {
114 if (m_ResultEntity.GetAmmoCount() < m_ResultEntity.GetAmmoMax())
115 {
116 m_ResultEntity.ServerAddAmmoCount(1);
117 added = true;
118 }
119 }
120
121 if (!added)
122 {
123 m_ResultEntity = Ammunition_Base.Cast(action_data.m_Player.SpawnEntityOnGroundPos("Ammo_ImprovisedBolt_1", action_data.m_Player.GetPosition()));
124 m_ResultEntity.SetHealth("", "", material.GetHealth("", ""));
125 m_ResultEntity.ServerSetAmmoCount(1);
126 }
127
128 material.AddQuantity(-1);
129 knife.AddHealth("", "", -3);
130 }
Ammunition_Base m_ResultEntity
ammo pile base

References m_IsKnifeInHands, and m_ResultEntity.

◆ OnStartServer()

override void ActionCraftBolts::OnStartServer ( ActionData action_data)
inlineprotected

Definition at line 83 of file ActionCraftBolts.c.

84 {
87 }

References IsCuttingType(), m_IsKnifeInHands, and m_ResultEntity.

Member Data Documentation

◆ CUTTING_TYPES

const ref set<string> ActionCraftBolts::CUTTING_TYPES = new set<string>()
private

Definition at line 13 of file ActionCraftBolts.c.

Referenced by InitCuttingTypes(), and IsCuttingType().

◆ m_IsKnifeInHands

bool ActionCraftBolts::m_IsKnifeInHands
protected

Definition at line 15 of file ActionCraftBolts.c.

Referenced by OnFinishProgressServer(), and OnStartServer().

◆ m_ResultEntity

Ammunition_Base ActionCraftBolts::m_ResultEntity
protected

Definition at line 16 of file ActionCraftBolts.c.

Referenced by OnFinishProgressServer(), and OnStartServer().


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