DayZ 1.24
Loading...
Searching...
No Matches
Hand_Actions.c
Go to the documentation of this file.
1
2
7{
12};
13
14
16{
17 override void Action(HandEventBase e)
18 {
19#ifdef DEVELOPER
21 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionCreated", e.m_Player.ToString());
22#endif
23
24 e.m_Player.OnItemInHandsChanged();
25 }
26};
27
29{
30 override void Action(HandEventBase e)
31 {
32#ifdef DEVELOPER
34 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionTake", e.m_Player.ToString());
35#endif
36
37 GameInventory.LocationSyncMoveEntity(e.GetSrc(), e.GetDst());
38 e.m_Player.OnItemInHandsChanged();
39 }
40};
41
43{
44 override void Action(HandEventBase e)
45 {
46#ifdef DEVELOPER
48 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionDrop", e.m_Player.ToString());
49#endif
50
51 GameInventory.LocationSyncMoveEntity(e.GetSrc(), e.GetDst());
52 e.m_Player.OnItemInHandsChanged();
53 }
54};
55
57{
58 override void Action(HandEventBase e)
59 {
60#ifdef DEVELOPER
62 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionThrow", e.m_Player.ToString());
63#endif
64 HandEventThrow throwEvent = HandEventThrow.Cast(e);
65
66 GameInventory.LocationSyncMoveEntity(e.GetSrc(), e.GetDst());
67
68 DayZPlayer player = DayZPlayer.Cast(e.m_Player);
69 if (player.GetInstanceType() != DayZPlayerInstanceType.INSTANCETYPE_REMOTE)
70 {
71 InventoryItem item = InventoryItem.Cast(e.GetSrcEntity());
72 if (item)
73 item.ThrowPhysically(player, throwEvent.GetForce());
74 else
75 Error("[hndfsm] HandActionThrow - src entity null!");
76 }
77
78 player.OnItemInHandsChanged();
79 }
80};
81
83{
84 override void Action(HandEventBase e)
85 {
86#ifdef DEVELOPER
88 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionMoveTo", e.m_Player.ToString());
89#endif
90
91 HandEventMoveTo es = HandEventMoveTo.Cast(e);
92 if (es)
93 {
95 e.m_Player.OnItemInHandsChanged();
96 }
97 else
98 Error("[hndfsm] HandActionMoveTo - this is no HandEventMoveTo");
99 }
100};
101
103{
104 override void Action(HandEventBase e)
105 {
106#ifdef DEVELOPER
108 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionDestroy", e.m_Player.ToString());
109#endif
110
111 GetGame().ObjectDelete(e.GetSrcEntity());
112 e.m_Player.OnItemInHandsChanged();
113 }
114};
115
117{
118 override void Action(HandEventBase e)
119 {
120#ifdef DEVELOPER
122 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionDestroyed", e.m_Player.ToString());
123#endif
124 e.m_Player.OnItemInHandsChanged();
125 }
126};
127
129{
130 override void Action(HandEventBase e)
131 {
132#ifdef DEVELOPER
134 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionDestroyAndReplaceWithNew", e.m_Player.ToString());
135#endif
136 Man player = e.m_Player;
137 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
138
140 if (itemInHands.GetInventory().GetCurrentInventoryLocation(src))
141 {
143 if (edr)
144 {
145 edr.m_Lambda.Execute();
146 return;
147 }
148 else
149 Error("[hndfsm] HandActionDestroyAndReplaceWithNew - not a HandEventDestroyAndReplaceWithNew event");
150 }
151 else
152 Error("[hndfsm] HandActionDestroyAndReplaceWithNew - itemInHands has no InventoryLocation");
153 }
154};
155
163
165{
166 override void Action(HandEventBase e)
167 {
168#ifdef DEVELOPER
170 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionReplaced", e.m_Player.ToString());
171#endif
172 Man player = e.m_Player;
173
174 player.OnItemInHandsChanged();
175 }
176};
177
178class HandActionSwap extends HandActionBase
179{
180 override void Action(HandEventBase e)
181 {
182#ifdef DEVELOPER
184 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionSwap", e.m_Player.ToString());
185#endif
187 if (es)
188 {
189 GameInventory.LocationSwap(es.GetSrc(), es.m_Src2, es.GetDst(), es.m_Dst2);
190 e.m_Player.OnItemInHandsChanged();
191 }
192 else
193 Error("[hndfsm] HandActionSwap - this is no HandEventSwap");
194 }
195};
196
198{
199 override void Action(HandEventBase e)
200 {
201#ifdef DEVELOPER
203 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString(), "n/a", "HandActionForceSwap", e.m_Player.ToString());
204#endif
205 HandEventForceSwap es = HandEventForceSwap.Cast(e);
206 if (es)
207 {
208 GameInventory.LocationSwap(es.GetSrc(), es.m_Src2, es.GetDst(), es.m_Dst2);
209 e.m_Player.OnItemInHandsChanged();
210 }
211 else
212 Error("[hndfsm] HandActionForceSwap - this is no HandEventForceSwap");
213 }
214};
215
217
Definition Debug.c:14
static void InventoryHFSMLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:183
script counterpart to engine's class Inventory
Definition Inventory.c:79
static proto native bool LocationSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
swaps two entities
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
synchronously removes item from current inventory location and adds it to destination no anims involv...
override void Action(HandEventBase e)
void Action(HandEventBase e)
override void Action(HandEventBase e)
Abstracted event, not to be used, only inherited.
InventoryLocation.
static bool IsInventoryHFSMLogEnable()
Definition Debug.c:749
DayZPlayerInstanceType
defined in C++
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90