DayZ 1.24
Loading...
Searching...
No Matches
InventoryActionHandler.c
Go to the documentation of this file.
1
3{
4 ActionBase m_action;
5 ActionTarget m_target;
8
10
13
14 const float MIN_DISTANCE_TO_INTERRUPT = 1.0;
15 const int IAH_SINGLE_USE = 1;
16 const int IAH_CONTINUOUS = 2;
17
18
20 {
22 m_isActive = false;
23 m_action = null;
24 m_target = null;
26 m_useItemInHands = false;
27
28 }
29
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 }
39
40 void SetAction(ActionBase action, ActionTarget target, ItemBase main_item)
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 }
60
62 {
63 return m_isActive;
64 }
65
66 void OnUpdate()
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 }
102
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 }
122}
class ActionTargets ActionTarget
Super root of all classes in Enforce script.
Definition EnScript.c:11
Client only - manage set up crafting on client.
void InventoryActionHandler(PlayerBase player)
void SetAction(ActionBase action, ItemBase target_item, ItemBase main_item)
void SetAction(ActionBase action, ActionTarget target, ItemBase main_item)
Definition EnMath.c:7
static const vector Zero
Definition EnConvert.c:110
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float AbsFloat(float f)
Returns absolute value.