DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
InventoryActionHandler.c
См. документацию.
1
3{
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 {
21 m_player = player;
22 m_isActive = false;
23 m_action = null;
24 m_target = null;
25 m_mainItem = null;
26 m_useItemInHands = false;
27
28 }
29
30 void SetAction(ActionBase action, ItemBase target_item, ItemBase main_item )
31 {
32 Object target_parent = null;
33 if(target_item)
34 {
35 target_parent = target_item.GetHierarchyParent();
36 }
37 ActionTarget at = new ActionTarget(target_item, target_parent, -1, vector.Zero, -1);
38
39 SetAction(action, at, main_item );
40 }
41
42 void SetAction(ActionBase action, ActionTarget target, ItemBase main_item )
43 {
45 Class.CastTo(mngr, m_player.GetActionManager());
46
47 m_action = action;
48 m_target = target;
49 m_mainItem = main_item;
50
51 ItemBase itemInHand = m_player.GetItemInHands();
52 m_useItemInHands = main_item == itemInHand;
53
54 m_actionStartPos = m_player.GetPosition();
55 m_isActive = true;
56
57 //mngr.InjectAction( action, target, main_item );
58 mngr.ForceTarget(m_target.GetObject());
59
61 }
62
64 {
65 return m_isActive;
66 }
67
68 void OnUpdate()
69 {
70
71 if( !m_isActive ) return;
72
73 if( m_player.IsRaised() || m_player.GetCommand_Melee() )
74 {
76 return;
77 }
78
79 if( GetGame().IsInventoryOpen() )
80 {
82 return;
83 }
84
86 {
87 ItemBase handItem = m_player.GetItemInHands();
88
89 if( handItem != m_mainItem )
90 {
92 return;
93 }
94 }
95
97 {
99 return;
100 }
101
102
103 }
104
106 {
107 if( !m_isActive ) return;
108
109 m_isActive = false;
110
112 Class.CastTo(mngr, m_player.GetActionManager());
113
114 mngr.EjectAction(m_action);
115 mngr.ClearForceTarget();
116
117 m_player.GetCraftingManager().ResetInventoryCraft();
118
119 m_action = null;
120 m_target = null;
121 m_mainItem = null;
122 m_useItemInHands = false;
123 }
124}
class ActionTargets ActionTarget
Определения ActionBase.c:53
void ClearForceTarget()
Определения ActionManagerClient.c:469
void ForceTarget(Object targetObject)
Определения ActionManagerClient.c:460
void EjectAction(ActionBase action)
Определения ActionManagerClient.c:448
proto native Mission GetMission()
Super root of all classes in Enforce script.
Определения EnScript.c:11
bool m_useItemInHands
Определения InventoryActionHandler.c:7
PlayerBase m_player
Определения InventoryActionHandler.c:9
void InventoryActionHandler(PlayerBase player)
Определения InventoryActionHandler.c:19
const int IAH_CONTINUOUS
Определения InventoryActionHandler.c:16
bool IsActiveAction()
Определения InventoryActionHandler.c:63
vector m_actionStartPos
Определения InventoryActionHandler.c:12
ItemBase m_mainItem
Определения InventoryActionHandler.c:6
ActionTarget m_target
Определения InventoryActionHandler.c:5
void SetAction(ActionBase action, ItemBase target_item, ItemBase main_item)
Определения InventoryActionHandler.c:30
const float MIN_DISTANCE_TO_INTERRUPT
Определения InventoryActionHandler.c:14
void SetAction(ActionBase action, ActionTarget target, ItemBase main_item)
Определения InventoryActionHandler.c:42
const int IAH_SINGLE_USE
Определения InventoryActionHandler.c:15
ActionBase m_action
Определения InventoryActionHandler.c:4
void DeactiveAction()
Определения InventoryActionHandler.c:105
Определения InventoryItem.c:731
Определения EnMath.c:7
void HideInventory()
Определения gameplay.c:809
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
static const vector Zero
Определения EnConvert.c:110
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
Определения EnConvert.c:106
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.