Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
hand_actions.c
Go to the documentation of this file.
1
2
6
class
HandActionBase
7
{
11
void
Action
(
HandEventBase
e) { }
12
};
13
14
15
class
HandActionCreated
extends
HandActionBase
16
{
17
override
void
Action
(
HandEventBase
e)
18
{
19
#ifdef ENABLE_LOGGING
20
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
21
{
22
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionCreated"
, e.m_Player.ToString() );
23
}
24
#endif
25
26
e.m_Player.OnItemInHandsChanged();
27
}
28
};
29
30
class
HandActionTake
extends
HandActionBase
31
{
32
override
void
Action
(
HandEventBase
e)
33
{
34
#ifdef ENABLE_LOGGING
35
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
36
{
37
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionTake"
, e.m_Player.ToString() );
38
}
39
#endif
40
41
GameInventory
.
LocationSyncMoveEntity
(e.GetSrc(), e.
GetDst
());
42
e.m_Player.OnItemInHandsChanged();
43
}
44
};
45
46
class
HandActionDrop
extends
HandActionBase
47
{
48
override
void
Action
(
HandEventBase
e)
49
{
50
#ifdef ENABLE_LOGGING
51
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
52
{
53
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionDrop"
, e.m_Player.ToString() );
54
}
55
#endif
56
57
GameInventory
.
LocationSyncMoveEntity
(e.GetSrc(), e.
GetDst
());
58
e.m_Player.OnItemInHandsChanged();
59
}
60
};
61
62
class
HandActionThrow
extends
HandActionBase
63
{
64
override
void
Action
(
HandEventBase
e)
65
{
66
#ifdef ENABLE_LOGGING
67
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
68
{
69
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionThrow"
, e.m_Player.ToString() );
70
}
71
#endif
72
HandEventThrow throwEvent = HandEventThrow.Cast(e);
73
74
GameInventory
.
LocationSyncMoveEntity
(e.GetSrc(), e.
GetDst
());
75
76
DayZPlayer
player =
DayZPlayer
.Cast(e.m_Player);
77
if
( player.GetInstanceType() !=
DayZPlayerInstanceType
.INSTANCETYPE_REMOTE )
78
{
79
InventoryItem
item =
InventoryItem
.Cast(e.GetSrcEntity());
80
if
( item )
81
item.ThrowPhysically(player, throwEvent.GetForce());
82
else
83
Error
(
"[hndfsm] HandActionThrow - src entity null!"
);
84
}
85
86
player.
OnItemInHandsChanged
();
87
}
88
};
89
90
class
HandActionMoveTo
extends
HandActionBase
91
{
92
override
void
Action
(
HandEventBase
e)
93
{
94
#ifdef ENABLE_LOGGING
95
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
96
{
97
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionMoveTo"
, e.m_Player.ToString() );
98
}
99
#endif
100
101
HandEventMoveTo es = HandEventMoveTo.Cast(e);
102
if
(es)
103
{
104
GameInventory
.
LocationSyncMoveEntity
(e.GetSrc(), es.
m_Dst
);
105
e.m_Player.OnItemInHandsChanged();
106
}
107
else
108
Error
(
"[hndfsm] HandActionMoveTo - this is no HandEventMoveTo"
);
109
}
110
};
111
112
class
HandActionDestroy
extends
HandActionBase
113
{
114
override
void
Action
(
HandEventBase
e)
115
{
116
if
(e.m_Player.GetEntityInHands() != e.GetSrcEntity())
117
{
118
#ifdef ENABLE_LOGGING
119
if
(
LogManager
.
IsInventoryHFSMLogEnable
())
120
{
121
Error
(
"[hndfsm] HandActionDestroy - item is not in player hands"
);
122
}
123
#endif
124
125
return
;
126
}
127
128
#ifdef ENABLE_LOGGING
129
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
130
{
131
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionDestroy"
, e.m_Player.ToString() );
132
}
133
#endif
134
135
g_Game
.ObjectDelete(e.GetSrcEntity());
136
e.m_Player.OnItemInHandsChanged();
137
}
138
};
139
140
class
HandActionDestroyed
extends
HandActionBase
141
{
142
override
void
Action
(
HandEventBase
e)
143
{
144
#ifdef ENABLE_LOGGING
145
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
146
{
147
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionDestroyed"
, e.m_Player.ToString() );
148
}
149
#endif
150
e.m_Player.OnItemInHandsChanged();
151
}
152
};
153
154
class
HandActionDestroyAndReplaceWithNew
extends
HandActionBase
155
{
156
override
void
Action
(
HandEventBase
e)
157
{
158
#ifdef ENABLE_LOGGING
159
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
160
{
161
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionDestroyAndReplaceWithNew"
, e.m_Player.ToString() );
162
}
163
#endif
164
Man player = e.m_Player;
165
EntityAI
itemInHands = player.GetEntityInHands();
166
167
InventoryLocation
src =
new
InventoryLocation
;
168
if
(itemInHands.GetInventory().GetCurrentInventoryLocation(src))
169
{
170
HandEventDestroyAndReplaceWithNew
edr =
HandEventDestroyAndReplaceWithNew
.Cast(e);
171
if
(edr)
172
{
173
edr.m_Lambda.Execute();
174
return
;
175
}
176
else
177
Error
(
"[hndfsm] HandActionDestroyAndReplaceWithNew - not a HandEventDestroyAndReplaceWithNew event"
);
178
}
179
else
180
Error
(
"[hndfsm] HandActionDestroyAndReplaceWithNew - itemInHands has no InventoryLocation"
);
181
}
182
};
183
184
class
HandActionDestroyAndReplaceWithNewElsewhere
extends
HandActionDestroyAndReplaceWithNew
185
{
186
override
void
Action
(
HandEventBase
e)
187
{
188
super.Action(e);
189
}
190
};
191
192
class
HandActionReplaced
extends
HandActionBase
193
{
194
override
void
Action
(
HandEventBase
e)
195
{
196
#ifdef ENABLE_LOGGING
197
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
198
{
199
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionReplaced"
, e.m_Player.ToString() );
200
}
201
#endif
202
Man player = e.m_Player;
203
204
player.OnItemInHandsChanged();
205
}
206
};
207
208
class
HandActionSwap
extends
HandActionBase
209
{
210
override
void
Action
(
HandEventBase
e)
211
{
212
#ifdef ENABLE_LOGGING
213
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
214
{
215
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionSwap"
, e.m_Player.ToString() );
216
}
217
#endif
218
HandEventSwap
es =
HandEventSwap
.Cast(e);
219
if
(es)
220
{
221
GameInventory
.
LocationSwap
(es.GetSrc(), es.m_Src2, es.GetDst(), es.m_Dst2);
222
e.m_Player.OnItemInHandsChanged();
223
}
224
else
225
Error
(
"[hndfsm] HandActionSwap - this is no HandEventSwap"
);
226
}
227
};
228
229
class
HandActionForceSwap
extends
HandActionBase
230
{
231
override
void
Action
(
HandEventBase
e)
232
{
233
#ifdef ENABLE_LOGGING
234
if
(
LogManager
.
IsInventoryHFSMLogEnable
() )
235
{
236
Debug
.
InventoryHFSMLog
(
"Action - STS = "
+ e.m_Player.GetSimulationTimeStamp(), e.ToString() ,
"n/a"
,
"HandActionForceSwap"
, e.m_Player.ToString() );
237
}
238
#endif
239
HandEventForceSwap es = HandEventForceSwap.Cast(e);
240
if
(es)
241
{
242
GameInventory
.
LocationSwap
(es.GetSrc(), es.m_Src2, es.GetDst(), es.m_Dst2);
243
e.m_Player.OnItemInHandsChanged();
244
}
245
else
246
Error
(
"[hndfsm] HandActionForceSwap - this is no HandEventForceSwap"
);
247
}
248
};
249
251
DayZPlayer
Definition
dayzplayerimplement.c:87
DayZPlayer::OnItemInHandsChanged
override void OnItemInHandsChanged()
Definition
dayzplayerimplement.c:988
Debug
Definition
debug.c:2
Debug::InventoryHFSMLog
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:207
EntityAI
Definition
inventoryitem.c:2
GameInventory
script counterpart to engine's class Inventory
Definition
inventory.c:81
GameInventory::LocationSwap
static proto native bool LocationSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
GameInventory::LocationSyncMoveEntity
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
HandActionBase
actions
Definition
hand_actions.c:7
HandActionBase::Action
void Action(HandEventBase e)
Definition
hand_actions.c:11
HandActionBase::Action
override void Action(HandEventBase e)
Definition
hand_actions.c:17
HandActionDestroyAndReplaceWithNew
Definition
hand_actions.c:185
HandActionDestroyAndReplaceWithNew::Action
override void Action(HandEventBase e)
Definition
hand_actions.c:186
HandEventBase
Abstracted event, not to be used, only inherited.
Definition
hand_events.c:212
HandEventBase::m_Dst
ref InventoryLocation m_Dst
Definition
hand_events.c:275
HandEventBase::GetDst
override InventoryLocation GetDst()
Definition
hand_events.c:215
HandEventDestroyAndReplaceWithNew
Definition
hand_events.c:826
HandEventSwap
Definition
hand_events.c:726
InventoryItem
Definition
itembase.c:21
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
LogManager
Definition
debug.c:692
LogManager::IsInventoryHFSMLogEnable
static bool IsInventoryHFSMLogEnable()
Definition
debug.c:766
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerInstanceType
DayZPlayerInstanceType
defined in C++
Definition
dayzplayer.c:1071
Error
void Error(string err)
Messagebox with error message.
Definition
endebug.c:90
Games
Dayz
scripts
3_game
systems
inventory
hand_actions.c
Generated by
1.17.0