Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
humaninventory.c
Go to the documentation of this file.
1
10{
11 int m_syncClearUserReservationindex = -1;
12 //int m_UserReservationToClear = -1;
16 proto native EntityAI GetEntityInHands();
17
21 proto native bool CanAddEntityInHands(EntityAI e);
22
30 proto native bool TestAddEntityInHands(EntityAI e, bool do_resevation_check, bool do_item_check, bool do_lock_check, bool do_occupancy_test, bool do_script_check);
31
35 proto native bool CanRemoveEntityInHands();
36
37 proto native bool CanOpenInventory();
38
44 proto native EntityAI CreateInHands(string typeName);
45
46 proto native int GetUserReservedLocationCount();
47 proto native int FindUserReservedLocationIndex(notnull EntityAI e);
48 proto native int FindCollidingUserReservedLocationIndex(notnull EntityAI e, notnull InventoryLocation dst);
49 proto native void GetUserReservedLocation(int index, out notnull InventoryLocation dst);
50 proto native int FindFirstUserReservedLocationIndexForContainer(notnull EntityAI e);
51
52 proto native void SetUserReservedLocation(notnull EntityAI eai, notnull InventoryLocation dst);
53 proto native void ClearUserReservedLocation(notnull EntityAI eai);
54 proto native bool ClearUserReservedLocationAtIndex(int index);
55 proto native void ClearUserReservedLocationForContainer(notnull EntityAI eai);
56 proto native bool GetDebugFlag();
57
65 override EntityAI CreateInInventory(string type)
66 {
67 EntityAI newEntity = super.CreateInInventory(type);
68 if (newEntity == null)
69 newEntity = CreateInHands(type);
70 return newEntity;
71 }
72
73 void ClearUserReservedLocationSynced(notnull EntityAI eai)
74 {
75 if (GetGame().IsClient())
76 m_syncClearUserReservationindex = FindUserReservedLocationIndex(eai);
77 else if (!GetGame().IsMultiplayer())
78 {
79 ClearUserReservedLocation(eai);
80 eai.GetOnReleaseLock().Invoke(eai);
81 }
82
83 }
84
85 void ClearUserReservedLocationAtIndexSynced(int index)
86 {
87 if (GetGame().IsClient())
88 m_syncClearUserReservationindex = index;
89 else if (!GetGame().IsMultiplayer())
90 {
91 ClearUserReservedLocationAtIndex(index);
92
94
95 GetUserReservedLocation(index,il);
96 EntityAI item = il.GetItem();
97 item.GetOnReleaseLock().Invoke(item);
98 }
99
100 }
101
102 Man GetManOwner()
103 {
104 return Man.Cast(GetInventoryOwner());
105 }
106
107 bool HasEntityInHands(EntityAI e)
108 {
109 return e == GetEntityInHands();
110 }
111
112 bool ProcessHandEvent(HandEventBase e);
113
114 void OnHandsStateChanged(HandStateBase src, HandStateBase dst);
115 void OnHandsExitedStableState(HandStateBase src, HandStateBase dst);
116 void OnHandsEnteredStableState(HandStateBase src, HandStateBase dst);
117
118 void OnEntityInHandsCreated(InventoryLocation src)
119 {
121 cpy.Copy(src);
122 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] OnEntityInHandsCreated src=" + InventoryLocation.DumpToStringNullSafe(cpy));
123 ProcessHandEvent(new HandEventCreated(GetManOwner(), src));
124 }
125
126 void OnEntityInHandsDestroyed(InventoryLocation src)
127 {
129 cpy.Copy(src);
130 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] OnEntityInHandsDestroyed src=" + InventoryLocation.DumpToStringNullSafe(cpy));
131 ProcessHandEvent(new HandEventDestroyed(GetManOwner(), cpy));
132 }
133
134 bool HandEvent(InventoryMode mode, HandEventBase e)
135 {
136 return true;
137 }
138
139 override bool DropEntity(InventoryMode mode, EntityAI owner, notnull EntityAI item)
140 {
142 if (item && item.GetInventory() && item.GetInventory().GetCurrentInventoryLocation(src))
143 {
144 switch (src.GetType())
145 {
146 case InventoryLocationType.HANDS:
147 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::DropEntity(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
148 HandEvent(mode, new HandEventDrop(GetManOwner(), src));
149 return true;
150
151 default:
152 return super.DropEntity(mode, owner, item);
153 }
154 }
155
156 Error("No inventory location");
157 return false;
158 }
159
160 bool ThrowEntity(EntityAI item, vector dir, float force)
161 {
162 if (GetGame().IsServer() && GetGame().IsMultiplayer())
163 return false;
164
165 DayZPlayer player = DayZPlayer.Cast(item.GetHierarchyRootPlayer());
166 InventoryMode invMode = InventoryMode.PREDICTIVE;
167
168 if (player.NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), null))
169 invMode = InventoryMode.JUNCTURE;
170
172 if (item && item.GetInventory() && item.GetInventory().GetCurrentInventoryLocation(src))
173 {
174 switch (src.GetType())
175 {
176 case InventoryLocationType.HANDS:
177 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ThrowEntity item=" + item);
178 HandEventThrow throwEvent = new HandEventThrow(GetManOwner(), src);
179 throwEvent.SetForce(dir * force);
180 HandEvent(invMode, throwEvent);
181 return true;
182
183 default:
184 DropEntity(invMode, player, item);
185 return true;
186 }
187 }
188 Error("No inventory location");
189 return false;
190 }
191
192 bool RedirectToHandEvent(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
193 {
194 if (src.GetType() == InventoryLocationType.HANDS)
195 {
196 Man man_src = Man.Cast(src.GetParent());
197 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HI::RedirectToHandEvent - source location == HANDS, player has to handle this");
198
199 EntityAI item = src.GetItem();
200
201 int r_index = FindUserReservedLocationIndex(item);
202
203 if (r_index >= 0)
204 {
206 GetUserReservedLocation(r_index,r_il);
207
208 ClearUserReservedLocationAtIndex(r_index);
209 int r_type = r_il.GetType();
210 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
211 {
212 r_il.GetParent().GetOnReleaseLock().Invoke(item);
213 }
214 else if (r_type == InventoryLocationType.ATTACHMENT)
215 {
216 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(item, r_il.GetSlot());
217 }
218 }
219
220 man_src.GetHumanInventory().HandEvent(mode, new HandEventMoveTo(man_src, src, dst));
221 return true;
222 }
223
224 if (dst.GetType() == InventoryLocationType.HANDS)
225 {
226 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HI::RedirectToHandEvent - dst location == HANDS, player has to handle this");
227
228 Man man_dst = Man.Cast(dst.GetParent());
229 man_dst.GetHumanInventory().HandEvent(mode, new HandEventTake(man_dst, src));
230 return true;
231 }
232 return false;
233 }
234
235 override bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
236 {
237 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] Take2Dst(" + typename.EnumToString(InventoryMode, mode) + ") src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
238
239 if (GetManOwner().IsAlive() && RedirectToHandEvent(mode, src, dst))
240 return true;
241
242 return super.TakeToDst(mode, src, dst);
243 }
244
245 override bool TakeEntityToInventory(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
246 {
248 if (item.GetInventory().GetCurrentInventoryLocation(src))
249 {
251 if (FindFreeLocationFor(item, flags, dst))
252 {
253 if (RedirectToHandEvent(mode, src, dst))
254 return true;
255
256 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
257 return super.TakeEntityToInventory(mode, flags, item);
258 }
259 else
260 return false; // no room
261 }
262 Error("HumanInventory::TakeEntityToInventory: No inventory location");
263 return false;
264 }
265
269 override bool TakeEntityToCargoEx(InventoryMode mode, notnull EntityAI item, int idx, int row, int col)
270 {
272 if (item.GetInventory().GetCurrentInventoryLocation(src))
273 {
274 switch (src.GetType())
275 {
276 case InventoryLocationType.HANDS:
277 if (GetInventoryOwner().IsAlive())
278 {
279 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Take2Cgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " row=" + row + " col=" + col);
281 dst.SetCargo(GetInventoryOwner(), item, idx, row, col, item.GetInventory().GetFlipCargo());
282
283 HandEvent(mode, new HandEventMoveTo(GetManOwner(), src, dst));
284 return true;
285 }
286
287 return super.TakeEntityToCargoEx(mode, item, idx, row, col);
288
289 default:
290 return super.TakeEntityToCargoEx(mode, item, idx, row, col);
291 }
292 }
293
294 Error("HumanInventory::TakeEntityToCargoEx: No inventory location");
295 return false;
296 }
297
298 override bool TakeEntityAsAttachmentEx(InventoryMode mode, notnull EntityAI item, int slot)
299 {
301 if (item.GetInventory().GetCurrentInventoryLocation(src))
302 {
303 switch (src.GetType())
304 {
305 case InventoryLocationType.HANDS:
306 if (GetInventoryOwner().IsAlive())
307 {
308 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Take2Att(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " slot=" + slot);
310 EntityAI src_entity = GetInventoryOwner();
311 dst.SetAttachment(src_entity, item, slot);
312
313 HandEvent(mode, new HandEventMoveTo(GetManOwner(), src, dst));
314 return true;
315 }
316
317 return super.TakeEntityAsAttachmentEx(mode, item, slot);
318
319 default:
320 return super.TakeEntityAsAttachmentEx(mode, item, slot);
321 }
322 }
323
324 Error("HumanInventory::TakeEntityAsAttachmentEx: No inventory location");
325 return false;
326 }
327
328 override bool SwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
329 {
330 InventoryLocation src1, src2, dst1, dst2;
331 if (GameInventory.MakeSrcAndDstForSwap(item1, item2, src1, src2, dst1, dst2))
332 {
333 bool handled = false;
334 switch (src1.GetType())
335 {
336 case InventoryLocationType.HANDS:
338 InventoryLocation fswap_dst2 = new InventoryLocation;
339 if ( SwappingToPreviousLocation(item1, item2, fswap_dst2) )
340 {
341 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Swap HandEventForceSwap(" + typename.EnumToString(InventoryMode, mode) + ") IH=src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2));
342 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, fswap_dst2));
343 }
344 else
345 {
346 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Swap HandEventSwap(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + "src2=" + InventoryLocation.DumpToStringNullSafe(src2));
347 HandEvent(mode, new HandEventSwap(GetManOwner(), src1, src2, dst1, dst2));
348 }
349 handled = true;
350 break;
351 }
352
353 switch (src2.GetType())
354 {
355 case InventoryLocationType.HANDS:
356 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::Swap HandEventSwap2(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " IH=src2=" + InventoryLocation.DumpToStringNullSafe(src2));
357 HandEvent(mode, new HandEventSwap(GetManOwner(), src2, src1, dst2, dst1));
358 handled = true;
359 break;
360 }
361
362 if (!handled)
363 return super.SwapEntities(mode, item1, item2);
364
365 return true;
366 }
367
368 Error("HumanInventory::SwapEntities: cannot create src1, src2, dst1, dst2");
369 return false;
370 }
371
372 override bool ForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
373 {
374 InventoryLocation src1, src2, dst1;
375 if (GameInventory.MakeSrcAndDstForForceSwap(item1, item2, src1, src2, dst1, item2_dst))
376 {
377 GameInventory manOwnerInventory = GetManOwner().GetInventory();
378
379 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap(" + typename.EnumToString(InventoryMode, mode) + ") dst1=" + InventoryLocation.DumpToStringNullSafe(dst1)+ " dst2=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
380 bool handled = false;
381 switch (src1.GetType())
382 {
383 case InventoryLocationType.HANDS:
384 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap-HND@1(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " item2_dst=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
385 HandEventBase e = new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst);
386 e.ReserveInventory();
387 HandEvent(mode, e);
388 handled = true;
389 break;
390
391 }
392
393 switch (src2.GetType())
394 {
395 case InventoryLocationType.HANDS:
397 InventoryLocation fswap_dst2 = new InventoryLocation;
398 if ( SwappingToPreviousLocation(item2, item1, fswap_dst2))
399 {
400 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap-PREV(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " fswap_dst2=" + InventoryLocation.DumpToStringNullSafe(fswap_dst2));
401 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, fswap_dst2));
402 }
403 else
404 {
405 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap-HND@2(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " item2_dst=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
406 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst));
407 }
408
409 handled = true;
410 break;
411 }
412
413 bool returnValue = true;
414
415 if (!handled)
416 returnValue = super.ForceSwapEntities(mode, item1, item2, item2_dst);
417
418 return returnValue;
419 }
420
421 Error("HumanInventory::ForceSwapEntities: No inventory location");
422 return false;
423 }
424
425 override bool LocalDestroyEntity(notnull EntityAI item)
426 {
428 if (item.GetInventory().GetCurrentInventoryLocation(src))
429 {
430 switch (src.GetType())
431 {
432 case InventoryLocationType.HANDS:
433 if (GetInventoryOwner().IsAlive())
434 {
435 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::LocalDestroy inv item=" + item);
436 HandEvent(InventoryMode.LOCAL, new HandEventDestroy(GetManOwner(), src));
437 return true;
438 }
439
440 return super.LocalDestroyEntity(item);
441
442 default:
443 return super.LocalDestroyEntity(item);
444 }
445 }
446
447 Error("LocalDestroyEntity: No inventory location");
448 return false;
449 }
450
451 override bool ReplaceItemWithNew(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
452 {
453 EntityAI itemInHands = GetEntityInHands();
454 if (itemInHands == lambda.m_OldItem)
455 return ReplaceItemInHandsWithNew(mode, lambda);
456
457 return super.ReplaceItemWithNew(mode, lambda);
458 }
459
460 bool ReplaceItemElsewhereWithNewInHands(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
461 {
462 return ReplaceItemInElsewhereWithNewinHandsImpl(mode, new HandEventDestroyElsewhereAndReplaceWithNewInHands(GetManOwner(), null, lambda));
463 }
464
466 {
467 if (GetEntityInHands())
468 {
469 Error("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl Item in hands, event=" + e.DumpToString());
470 return false;
471 }
472
473 InventoryLocation dst = e.GetDst();
474 if (dst)
475 {
476 switch (dst.GetType())
477 {
478 case InventoryLocationType.HANDS:
479 if (GetInventoryOwner().IsAlive())
480 {
481 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl event=" + e);
482 HandEvent(mode, e);
483 return true;
484 }
485
486 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl DEAD_owner=" + GetInventoryOwner().GetName() +"="+ GetInventoryOwner());
487 Error("HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl TODO"); // replace-with-new in corpse's hands, not implemented
488 return false;
489
490 default:
491 Error("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl src has to be hands");
492 return false;
493 }
494 }
495
496 Error("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl no dst in event, event=" + e.DumpToString());
497 return false;
498 }
499
501 {
502 EntityAI itemInHands = GetEntityInHands();
504 if (itemInHands && itemInHands.GetInventory().GetCurrentInventoryLocation(src))
505 {
506 switch (src.GetType())
507 {
508 case InventoryLocationType.HANDS:
509 if ((mode != InventoryMode.SERVER) && GetInventoryOwner().IsAlive())
510 {
511 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl event=" + e);
512 HandEvent(mode, e);
513 return true;
514 }
515
516 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl DEAD_owner=" + GetInventoryOwner().GetName() +"="+ GetInventoryOwner());
517 HandEvent(mode, e);
518 return true;
519
520 default:
521 Error("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl src has to be hands");
522 return false;
523 }
524 }
525
526 Error("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl No item in hands, event=" + e.DumpToString());
527 return false;
528 }
529
531 {
532 return ReplaceItemInHandsWithNewImpl(mode, new HandEventDestroyAndReplaceWithNew(GetManOwner(), null, lambda));
533 }
534
536 {
537 return ReplaceItemInHandsWithNewImpl(mode, new HandEventDestroyAndReplaceWithNewElsewhere(GetManOwner(), null, lambda));
538 }
539
541 {
542 bool SwapToPrevious = true;
545 dst = new InventoryLocation();
546 if (item1.GetInventory().GetCurrentInventoryLocation(src1) && item2.GetInventory().GetCurrentInventoryLocation(src2))
547 {
548 if (item1.m_OldLocation && item1.m_OldLocation.IsValid() && !item1.m_OldLocation.CollidesWith(src2) && item1.m_OldLocation.GetParent() && item1.m_OldLocation.GetParent().GetHierarchyRootPlayer())
549 {
550 dst.Copy(item1.m_OldLocation);
551
552 int count = item1.GetInventory().GetSlotIdCount();
553 if (count > 0 && src2.GetType() == InventoryLocationType.ATTACHMENT) //item2 is currently attached somewhere
554 {
555 for (int i = 0; i < count; i++)
556 {
557 int slotID = item1.GetInventory().GetSlotId(i);
558 if (src2.GetSlot() == slotID) //can be attached into the same slot. And will be.
559 return false;
560 }
561 }
562
563 if (!item1.m_OldLocation.GetParent().GetInventory().LocationCanAddEntity(item1.m_OldLocation))
564 SwapToPrevious = false;
565
566 if (CanSwapEntitiesEx(item1,item2))
567 SwapToPrevious = false;
568
569 if (SwapToPrevious)
570 return true;
571 }
572 }
573
574 return false;
575 }
576
578
579 void Update(float delta_time)
580 {
582 if ( m_syncClearUserReservationindex != -1 && ScriptInputUserData.CanStoreInputUserData())
583 {
585 ctx.Write(INPUT_UDT_INVENTORY);
586 ctx.Write(InventoryCommandType.USER_RESERVATION_CANCEL);
587 ctx.Write(m_syncClearUserReservationindex);
588 ctx.Send();
589
591
592 GetUserReservedLocation(m_syncClearUserReservationindex,il);
593 ClearUserReservedLocationAtIndex(m_syncClearUserReservationindex);
594 EntityAI item = il.GetItem();
595 item.GetOnReleaseLock().Invoke(item);
596 m_syncClearUserReservationindex = -1;
597 }
598 }
599
601 {
602 validation.m_Result = InventoryValidationResult.SUCCESS;
603
604 int index = -1;
605 if (!ctx.Read(index))
606 {
608 return true;
609 }
610
611 ClearUserReservedLocationAtIndex(index);
612 //m_UserReservationToClear = index;
613
614 return true;
615 }
616
618 {
619 return true;
620 }
621
622
623 bool PostDeferredForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
624 {
625 return true;
626 }
627}
InventoryCommandType
Definition inventory.c:3
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
InventoryValidationResult
Definition inventory.c:30
const int INPUT_UDT_INVENTORY
Definition _constants.c:9
script counterpart to engine's class Inventory
Definition inventory.c:79
static bool MakeSrcAndDstForSwap(notnull EntityAI item1, notnull EntityAI item2, out InventoryLocation src1, out InventoryLocation src2, out InventoryLocation dst1, out InventoryLocation dst2)
helper function for swap
Definition inventory.c:1209
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition inventory.c:628
static bool MakeSrcAndDstForForceSwap(notnull EntityAI item1, notnull EntityAI item2, out InventoryLocation src1, out InventoryLocation src2, out InventoryLocation dst1, notnull InventoryLocation dst2)
helper function for ForceSwap
Definition inventory.c:1221
proto native EntityAI GetInventoryOwner()
Engine native functions.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
Abstracted event, not to be used, only inherited.
represent hand state base
inventory for plain man/human
bool ReplaceItemInHandsWithNewElsewhere(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
bool PostDeferredForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
void HandleInventoryManipulation()
bool ValidateUserReservationCancel(inout Serializer ctx, InventoryValidation validation)
bool ReplaceItemInHandsWithNewImpl(InventoryMode mode, HandEventBase e)
bool ReplaceItemInHandsWithNew(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
bool SwappingToPreviousLocation(EntityAI item1, EntityAI item2, out InventoryLocation dst)
bool ReplaceItemInElsewhereWithNewinHandsImpl(InventoryMode mode, HandEventBase e)
void Update(float delta_time)
bool PostDeferredEventTakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
InventoryLocation.
base class for transformation operations (creating one item from another)
Serialization general interface. Serializer API works with:
Definition serializer.c:56
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
void hndDebugPrint(string s)
Definition handfsm.c:1
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location