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

Protected Member Functions

void ActionCraftBoltsFeather ()
 
override void CreateConditionComponents ()
 
bool IsFeatherType (string itemInHandsType)
 
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_IsFeatherInHands
 
Ammunition_Base m_ResultEntity
 

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 ActionCraftBoltsFeather.c.

Constructor & Destructor Documentation

◆ ActionCraftBoltsFeather()

void ActionCraftBoltsFeather::ActionCraftBoltsFeather ( )
inlineprotected

Member Function Documentation

◆ ActionCondition()

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

Definition at line 39 of file ActionCraftBoltsFeather.c.

40 {
41 if (IsFeatherType(item.ClassName()))
42 {
43 //feather in hands
44 if (target.GetObject())
45 return (target.GetObject().ClassName() == "Ammo_ImprovisedBolt_1");
46 }
47 else if (target.GetObject())
48 {
49 // bolt in hands
50 return IsFeatherType(target.GetObject().ClassName());
51 }
52 return false;
53 }
bool IsFeatherType(string itemInHandsType)

References IsFeatherType().

◆ CreateConditionComponents()

override void ActionCraftBoltsFeather::CreateConditionComponents ( )
inlineprotected

Definition at line 28 of file ActionCraftBoltsFeather.c.

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

References m_ConditionItem, and m_ConditionTarget.

◆ IsFeatherType()

bool ActionCraftBoltsFeather::IsFeatherType ( string itemInHandsType)
inlineprotected

Definition at line 34 of file ActionCraftBoltsFeather.c.

35 {
36 return itemInHandsType == "ChickenFeather";
37 }

Referenced by ActionCondition(), and OnStartServer().

◆ OnFinishProgressServer()

override void ActionCraftBoltsFeather::OnFinishProgressServer ( ActionData action_data)
inlineprotected

Definition at line 61 of file ActionCraftBoltsFeather.c.

62 {
65
66 bool added = false;
67
69 {
70 //feather in hands
71 feather = action_data.m_MainItem;
72 bolt = Ammunition_Base.Cast(action_data.m_Target.GetObject());
73 }
74 else
75 {
76 // bolt in hands
77 bolt = Ammunition_Base.Cast(action_data.m_MainItem);
78 feather = ItemBase.Cast(action_data.m_Target.GetObject());
79 }
80
81 if (!bolt || !feather)
82 return;
83
84 float dmg;
85 string type;
86
87 bolt.ServerAcquireCartridge(dmg, type);
88
90 {
91 type = m_ResultEntity.ConfigGetString("Ammo");
92 if (m_ResultEntity.GetAmmoCount() < m_ResultEntity.GetAmmoMax())
93 {
94 m_ResultEntity.ServerStoreCartridge(dmg, type);
95 added = true;
96 }
97 }
98
99 if (!added)
100 {
101 m_ResultEntity = Ammunition_Base.Cast(action_data.m_Player.SpawnEntityOnGroundPos("Ammo_ImprovisedBolt_2", action_data.m_Player.GetPosition()));
102 type = m_ResultEntity.ConfigGetString("Ammo");
103 m_ResultEntity.ServerSetAmmoCount(0);
104 m_ResultEntity.ServerStoreCartridge(dmg, type);
105 m_ResultEntity.SetHealth01("", "", bolt.GetHealth01("", ""));
106 }
107
108 feather.AddQuantity(-1);
109 }
ammo pile base

References m_IsFeatherInHands, and m_ResultEntity.

◆ OnStartServer()

override void ActionCraftBoltsFeather::OnStartServer ( ActionData action_data)
inlineprotected

Definition at line 55 of file ActionCraftBoltsFeather.c.

56 {
57 m_IsFeatherInHands = IsFeatherType(action_data.m_MainItem.ClassName());
59 }

References IsFeatherType(), m_IsFeatherInHands, and m_ResultEntity.

Member Data Documentation

◆ m_IsFeatherInHands

bool ActionCraftBoltsFeather::m_IsFeatherInHands
protected

Definition at line 13 of file ActionCraftBoltsFeather.c.

Referenced by OnFinishProgressServer(), and OnStartServer().

◆ m_ResultEntity

Ammunition_Base ActionCraftBoltsFeather::m_ResultEntity
protected

Definition at line 14 of file ActionCraftBoltsFeather.c.

Referenced by OnFinishProgressServer(), and OnStartServer().


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