DayZ 1.24
Loading...
Searching...
No Matches
InventoryActionHandler Class Reference

Client only - manage set up crafting on client. More...

Collaboration diagram for InventoryActionHandler:
[legend]

Private Member Functions

void InventoryActionHandler (PlayerBase player)
 
void SetAction (ActionBase action, ItemBase target_item, ItemBase main_item)
 
void SetAction (ActionBase action, ActionTarget target, ItemBase main_item)
 
bool IsActiveAction ()
 
void OnUpdate ()
 
void DeactiveAction ()
 

Private Attributes

ActionBase m_action
 
ActionTarget m_target
 
ItemBase m_mainItem
 
bool m_useItemInHands
 
PlayerBase m_player
 
bool m_isActive
 
vector m_actionStartPos
 
const float MIN_DISTANCE_TO_INTERRUPT = 1.0
 
const int IAH_SINGLE_USE = 1
 
const int IAH_CONTINUOUS = 2
 

Detailed Description

Client only - manage set up crafting on client.

Definition at line 2 of file InventoryActionHandler.c.

Constructor & Destructor Documentation

◆ InventoryActionHandler()

void InventoryActionHandler::InventoryActionHandler ( PlayerBase player)
inlineprivate

Member Function Documentation

◆ DeactiveAction()

void InventoryActionHandler::DeactiveAction ( )
inlineprivate

Definition at line 103 of file InventoryActionHandler.c.

104 {
105 if (!m_isActive) return;
106
107 m_isActive = false;
108
110 Class.CastTo(mngr, m_player.GetActionManager());
111
112 mngr.EjectAction(m_action);
113 mngr.ClearForceTarget();
114
115 m_player.GetCraftingManager().ResetInventoryCraft();
116
117 m_action = null;
118 m_target = null;
120 m_useItemInHands = false;
121 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), m_action, m_isActive, m_mainItem, m_player, m_target, and m_useItemInHands.

Referenced by OnUpdate().

◆ IsActiveAction()

bool InventoryActionHandler::IsActiveAction ( )
inlineprivate

Definition at line 61 of file InventoryActionHandler.c.

62 {
63 return m_isActive;
64 }

References m_isActive.

◆ OnUpdate()

void InventoryActionHandler::OnUpdate ( )
inlineprivate

Definition at line 66 of file InventoryActionHandler.c.

67 {
68
69 if (!m_isActive) return;
70
71 if (m_player.IsRaised() || m_player.GetCommand_Melee())
72 {
74 return;
75 }
76
77 if (GetGame().IsInventoryOpen())
78 {
80 return;
81 }
82
84 {
85 ItemBase handItem = m_player.GetItemInHands();
86
87 if (handItem != m_mainItem)
88 {
90 return;
91 }
92 }
93
95 {
97 return;
98 }
99
100
101 }
Definition EnMath.c:7
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat(), DeactiveAction(), vector::Distance(), GetGame(), m_actionStartPos, m_isActive, m_mainItem, m_player, m_useItemInHands, and MIN_DISTANCE_TO_INTERRUPT.

◆ SetAction() [1/2]

void InventoryActionHandler::SetAction ( ActionBase action,
ActionTarget target,
ItemBase main_item )
inlineprivate

Definition at line 40 of file InventoryActionHandler.c.

41 {
43 Class.CastTo(mngr, m_player.GetActionManager());
44
48
49 ItemBase itemInHand = m_player.GetItemInHands();
51
52 m_actionStartPos = m_player.GetPosition();
53 m_isActive = true;
54
55 //mngr.InjectAction( action, target, main_item );
56 mngr.ForceTarget(m_target.GetObject());
57
58 GetGame().GetMission().HideInventory();
59 }

References Class::CastTo(), GetGame(), m_action, m_actionStartPos, m_isActive, m_mainItem, m_player, m_target, and m_useItemInHands.

◆ SetAction() [2/2]

void InventoryActionHandler::SetAction ( ActionBase action,
ItemBase target_item,
ItemBase main_item )
inlineprivate

Definition at line 30 of file InventoryActionHandler.c.

31 {
33 if (target_item)
34 target_parent = target_item.GetHierarchyParent();
35 ActionTarget at = new ActionTarget(target_item, target_parent, -1, vector.Zero, -1);
36
38 }
class ActionTargets ActionTarget
void SetAction(ActionBase action, ItemBase target_item, ItemBase main_item)
static const vector Zero
Definition EnConvert.c:110

References ActionTarget, SetAction(), and vector::Zero.

Referenced by SetAction().

Member Data Documentation

◆ IAH_CONTINUOUS

const int InventoryActionHandler::IAH_CONTINUOUS = 2
private

Definition at line 16 of file InventoryActionHandler.c.

◆ IAH_SINGLE_USE

const int InventoryActionHandler::IAH_SINGLE_USE = 1
private

Definition at line 15 of file InventoryActionHandler.c.

◆ m_action

ActionBase InventoryActionHandler::m_action
private

Definition at line 4 of file InventoryActionHandler.c.

Referenced by DeactiveAction(), InventoryActionHandler(), and SetAction().

◆ m_actionStartPos

vector InventoryActionHandler::m_actionStartPos
private

Definition at line 12 of file InventoryActionHandler.c.

Referenced by OnUpdate(), and SetAction().

◆ m_isActive

bool InventoryActionHandler::m_isActive
private

◆ m_mainItem

ItemBase InventoryActionHandler::m_mainItem
private

◆ m_player

PlayerBase InventoryActionHandler::m_player
private

◆ m_target

ActionTarget InventoryActionHandler::m_target
private

Definition at line 5 of file InventoryActionHandler.c.

Referenced by DeactiveAction(), InventoryActionHandler(), and SetAction().

◆ m_useItemInHands

bool InventoryActionHandler::m_useItemInHands
private

◆ MIN_DISTANCE_TO_INTERRUPT

const float InventoryActionHandler::MIN_DISTANCE_TO_INTERRUPT = 1.0
private

Definition at line 14 of file InventoryActionHandler.c.

Referenced by OnUpdate().


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