DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
HumanInventory.c
Go to the documentation of this file.
1
10{
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);
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
74 {
75 if( GetGame().IsClient() )
77 else if (!GetGame().IsMultiplayer())
78 {
80 eai.GetOnReleaseLock().Invoke(eai);
81 }
82
83 }
84
86 {
87 if( GetGame().IsClient() )
89 else if (!GetGame().IsMultiplayer())
90 {
92
94
96 EntityAI item = il.GetItem();
97 item.GetOnReleaseLock().Invoke(item);
98 }
99
100 }
101
102 Man GetManOwner () { return Man.Cast(GetInventoryOwner()); }
103
104 bool HasEntityInHands (EntityAI e) { return e == GetEntityInHands(); }
105
107
111
113 {
115 cpy.Copy(src);
116 hndDebugPrint("[inv] OnEntityInHandsCreated src=" + InventoryLocation.DumpToStringNullSafe(cpy));
117 ProcessHandEvent(new HandEventCreated(GetManOwner(), src));
118 }
119
121 {
123 cpy.Copy(src);
124 hndDebugPrint("[inv] OnEntityInHandsDestroyed src=" + InventoryLocation.DumpToStringNullSafe(cpy));
125 ProcessHandEvent(new HandEventDestroyed(GetManOwner(), cpy));
126 }
127
129 {
130 return true;
131 }
132
133 override bool DropEntity (InventoryMode mode, EntityAI owner, notnull EntityAI item)
134 {
136 if (item && item.GetInventory() && item.GetInventory().GetCurrentInventoryLocation(src))
137 {
138 switch (src.GetType())
139 {
140 case InventoryLocationType.HANDS:
141 hndDebugPrint("[inv] HumanInventory::DropEntity(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
142 HandEvent(mode, new HandEventDrop(GetManOwner(), src));
143 return true;
144
145 default: return super.DropEntity(mode, owner, item);
146 }
147 }
148 Error("No inventory location");
149 return false;
150 }
151
152 bool ThrowEntity(EntityAI item, vector dir, float force)
153 {
154 if ( GetGame().IsServer() && GetGame().IsMultiplayer() )
155 return false;
156
157 DayZPlayer player = DayZPlayer.Cast(item.GetHierarchyRootPlayer());
158 InventoryMode invMode = InventoryMode.PREDICTIVE;
159
160 if ( player.NeedInventoryJunctureFromServer( item, item.GetHierarchyParent(), null) )
161 invMode = InventoryMode.JUNCTURE;
162
164 if (item && item.GetInventory() && item.GetInventory().GetCurrentInventoryLocation(src))
165 {
166 switch (src.GetType())
167 {
168 case InventoryLocationType.HANDS:
169 hndDebugPrint("[inv] HumanInventory::ThrowEntity item=" + item);
170 HandEventThrow throwEvent = new HandEventThrow(GetManOwner(), src);
171 throwEvent.SetForce(dir * force);
172 HandEvent(invMode, throwEvent);
173 return true;
174
175 //default: return super.DropEntity(InventoryMode.JUNCTURE, src.GetParent(), item);
176 default:
177 DropEntity(invMode, player, item);
178 return true;
179 }
180 }
181 Error("No inventory location");
182 return false;
183 }
184
186 {
187 if (src.GetType() == InventoryLocationType.HANDS)
188 {
189 Man man_src = Man.Cast(src.GetParent());
190 hndDebugPrint("[inv] HI::RedirectToHandEvent - source location == HANDS, player has to handle this");
191
192 EntityAI item = src.GetItem();
193
194 int r_index = FindUserReservedLocationIndex(item);
195
196 if(r_index >= 0)
197 {
199 GetUserReservedLocation(r_index,r_il);
200
202 int r_type = r_il.GetType();
203 if( r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO )
204 {
205 r_il.GetParent().GetOnReleaseLock().Invoke( item );
206 }
207 else if( r_type == InventoryLocationType.ATTACHMENT )
208 {
209 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke( item, r_il.GetSlot() );
210 }
211 }
212
213 man_src.GetHumanInventory().HandEvent(mode, new HandEventMoveTo(man_src, src, dst));
214 return true;
215 }
216
217 if (dst.GetType() == InventoryLocationType.HANDS)
218 {
219 hndDebugPrint("[inv] HI::RedirectToHandEvent - dst location == HANDS, player has to handle this");
220
221 Man man_dst = Man.Cast(dst.GetParent());
222 man_dst.GetHumanInventory().HandEvent(mode, new HandEventTake(man_dst, src));
223 return true;
224 }
225 return false;
226 }
227
228 override bool TakeToDst (InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
229 {
230 hndDebugPrint("[inv] Take2Dst(" + typename.EnumToString(InventoryMode, mode) + ") src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
231
232 if (GetManOwner().IsAlive() && RedirectToHandEvent(mode, src, dst))
233 return true;
234
235 return super.TakeToDst(mode, src, dst);
236 }
237
239 {
241 if (item.GetInventory().GetCurrentInventoryLocation(src))
242 {
244 if (FindFreeLocationFor(item, flags, dst))
245 {
246 if (RedirectToHandEvent(mode, src, dst))
247 return true;
248
249 hndDebugPrint("[inv] HumanInventory::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
250 return super.TakeEntityToInventory(mode, flags, item);
251 }
252 else
253 {
254 // no room
255 return false;
256 }
257 }
258 Error("HumanInventory::TakeEntityToInventory: No inventory location");
259 return false;
260 }
261
265 override bool TakeEntityToCargoEx (InventoryMode mode, notnull EntityAI item, int idx, int row, int col)
266 {
268 if (item.GetInventory().GetCurrentInventoryLocation(src))
269 {
270 switch (src.GetType())
271 {
272 case InventoryLocationType.HANDS:
273 {
274 if (GetInventoryOwner().IsAlive())
275 {
276 hndDebugPrint("[inv] HumanInventory::Take2Cgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " row=" + row + " col=" + col);
278 dst.SetCargo(GetInventoryOwner(), item, idx, row, col, item.GetInventory().GetFlipCargo());
279
280 HandEvent(mode, new HandEventMoveTo(GetManOwner(), src, dst));
281 return true;
282 }
283 return super.TakeEntityToCargoEx(mode, item, idx, row, col);
284 }
285 default: return super.TakeEntityToCargoEx(mode, item, idx, row, col);
286 }
287 }
288 Error("HumanInventory::TakeEntityToCargoEx: No inventory location");
289 return false;
290 }
291
292 override bool TakeEntityAsAttachmentEx (InventoryMode mode, notnull EntityAI item, int slot)
293 {
295 if (item.GetInventory().GetCurrentInventoryLocation(src))
296 {
297 switch (src.GetType())
298 {
299 case InventoryLocationType.HANDS:
300 {
301 if (GetInventoryOwner().IsAlive())
302 {
303 hndDebugPrint("[inv] HumanInventory::Take2Att(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " slot=" + slot);
305 EntityAI src_entity = GetInventoryOwner();
306 dst.SetAttachment(src_entity, item, slot);
307
308 HandEvent(mode, new HandEventMoveTo(GetManOwner(), src, dst));
309 return true;
310 }
311 return super.TakeEntityAsAttachmentEx(mode, item, slot);
312 }
313 default: return super.TakeEntityAsAttachmentEx(mode, item, slot);
314 }
315 }
316 Error("HumanInventory::TakeEntityAsAttachmentEx: No inventory location");
317 return false;
318 }
319
320 override bool SwapEntities (InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
321 {
322 InventoryLocation src1, src2, dst1, dst2;
323 if (GameInventory.MakeSrcAndDstForSwap(item1, item2, src1, src2, dst1, dst2))
324 {
325 bool handled = false;
326 switch (src1.GetType())
327 {
328 case InventoryLocationType.HANDS:
329 {
331 InventoryLocation fswap_dst2 = new InventoryLocation;
332 if ( SwappingToPreviousLocation(item1, item2, fswap_dst2) )
333 {
334 hndDebugPrint("[inv] HumanInventory::Swap HandEventForceSwap(" + typename.EnumToString(InventoryMode, mode) + ") IH=src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2));
335 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, fswap_dst2));
336 }
337 else
338 {
339 hndDebugPrint("[inv] HumanInventory::Swap HandEventSwap(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + "src2=" + InventoryLocation.DumpToStringNullSafe(src2));
340 HandEvent(mode, new HandEventSwap(GetManOwner(), src1, src2, dst1, dst2));
341 }
342 handled = true;
343 break;
344 }
345 }
346
347 switch (src2.GetType())
348 {
349 case InventoryLocationType.HANDS:
350 {
351 hndDebugPrint("[inv] HumanInventory::Swap HandEventSwap2(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " IH=src2=" + InventoryLocation.DumpToStringNullSafe(src2));
352 HandEvent(mode, new HandEventSwap(GetManOwner(), src2, src1, dst2, dst1));
353 handled = true;
354 break;
355 }
356 }
357
358 if (!handled)
359 return super.SwapEntities(mode, item1, item2);
360 return true;
361 }
362 Error("HumanInventory::SwapEntities: cannot create src1, src2, dst1, dst2");
363 return false;
364 }
365
366 override bool ForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
367 {
368 InventoryLocation src1, src2, dst1;
369 if (GameInventory.MakeSrcAndDstForForceSwap(item1, item2, src1, src2, dst1, item2_dst))
370 {
371 GameInventory manOwnerInventory = GetManOwner().GetInventory();
372
373 hndDebugPrint("[inv] HumanInventory::FSwap(" + typename.EnumToString(InventoryMode, mode) + ") dst1=" + InventoryLocation.DumpToStringNullSafe(dst1)+ " dst2=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
374 bool handled = false;
375 switch (src1.GetType())
376 {
377 case InventoryLocationType.HANDS:
378 {
379 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));
380 HandEventBase e = new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst);
382 HandEvent(mode, e);
383 handled = true;
384 break;
385 }
386 }
387
388 switch (src2.GetType())
389 {
390 case InventoryLocationType.HANDS:
391 {
393 InventoryLocation fswap_dst2 = new InventoryLocation;
394 if ( SwappingToPreviousLocation(item2, item1, fswap_dst2))
395 {
396 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));
397 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, fswap_dst2));
398 }
399 else
400 {
401 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));
402 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst));
403 }
404 handled = true;
405 break;
406 }
407 }
408
409 bool returnValue = true;
410
411 if (!handled)
412 returnValue = super.ForceSwapEntities(mode, item1, item2, item2_dst);
413
414 return returnValue;
415 }
416 Error("HumanInventory::ForceSwapEntities: No inventory location");
417 return false;
418 }
419
420 override bool LocalDestroyEntity (notnull EntityAI item)
421 {
423 if (item.GetInventory().GetCurrentInventoryLocation(src))
424 {
425 switch (src.GetType())
426 {
427 case InventoryLocationType.HANDS:
428 {
429 if (GetInventoryOwner().IsAlive())
430 {
431 hndDebugPrint("[inv] HumanInventory::LocalDestroy inv item=" + item);
432 HandEvent(InventoryMode.LOCAL, new HandEventDestroy(GetManOwner(), src));
433 return true;
434 }
435 return super.LocalDestroyEntity(item);
436 }
437 default: return super.LocalDestroyEntity(item);
438 }
439 }
440 Error("LocalDestroyEntity: No inventory location");
441 return false;
442 }
443
445 {
446 EntityAI itemInHands = GetEntityInHands();
447 if (itemInHands == lambda.m_OldItem)
448 return ReplaceItemInHandsWithNew(mode, lambda);
449 return super.ReplaceItemWithNew(mode, lambda);
450 }
451
453 {
454 return ReplaceItemInElsewhereWithNewinHandsImpl(mode, new HandEventDestroyElsewhereAndReplaceWithNewInHands(GetManOwner(), null, lambda));
455 }
456
458 {
459 if (GetEntityInHands())
460 {
461 Error("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl Item in hands, event=" + e.DumpToString());
462 return false;
463 }
464
465 InventoryLocation dst = e.GetDst();
466 if (dst)
467 {
468 switch (dst.GetType())
469 {
470 case InventoryLocationType.HANDS:
471 {
472 if (GetInventoryOwner().IsAlive())
473 {
474 hndDebugPrint("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl event=" + e);
475 HandEvent(mode, e);
476 return true;
477 }
478
479 hndDebugPrint("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl DEAD_owner=" + GetInventoryOwner().GetName() +"="+ GetInventoryOwner());
480 Error("HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl TODO"); // replace-with-new in corpse's hands, not implemented
481 return false;
482 }
483 default:
484 Error("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl src has to be hands");
485 return false;
486 }
487 }
488 Error("[inv] HumanInventory::ReplaceItemInElsewhereWithNewinHandsImpl no dst in event, event=" + e.DumpToString());
489 return false;
490 }
491
493 {
494 EntityAI itemInHands = GetEntityInHands();
496 if (itemInHands && itemInHands.GetInventory().GetCurrentInventoryLocation(src))
497 {
498 switch (src.GetType())
499 {
500 case InventoryLocationType.HANDS:
501 {
502 if ((mode != InventoryMode.SERVER) && GetInventoryOwner().IsAlive())
503 {
504 hndDebugPrint("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl event=" + e);
505 HandEvent(mode, e);
506 return true;
507 }
508
509 hndDebugPrint("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl DEAD_owner=" + GetInventoryOwner().GetName() +"="+ GetInventoryOwner());
510 //Error("HumanInventory::ReplaceItemInHandsWithNewImpl TODO"); // replace-with-new in corpse's hands, not implemented
511 HandEvent(mode, e);
512 return true;
513 }
514 default:
515 Error("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl src has to be hands");
516 return false;
517 }
518 }
519 Error("[inv] HumanInventory::ReplaceItemInHandsWithNewImpl No item in hands, event=" + e.DumpToString());
520 return false;
521 }
522
524 {
526 }
527
529 {
530 return ReplaceItemInHandsWithNewImpl(mode, new HandEventDestroyAndReplaceWithNewElsewhere(GetManOwner(), null, lambda));
531 }
532
534 {
535 bool SwapToPrevious = true;
538 dst = new InventoryLocation;
539 if (item1.GetInventory().GetCurrentInventoryLocation(src1) && item2.GetInventory().GetCurrentInventoryLocation(src2))
540 {
541 if (item1.m_OldLocation && item1.m_OldLocation.IsValid() && !item1.m_OldLocation.CollidesWith(src2) && item1.m_OldLocation.GetParent() && item1.m_OldLocation.GetParent().GetHierarchyRootPlayer())
542 {
543 dst.Copy(item1.m_OldLocation);
544
545 int count = item1.GetInventory().GetSlotIdCount();
546 if ( count > 0 && src2.GetType() == InventoryLocationType.ATTACHMENT ) //item2 is currently attached somewhere
547 {
548 //Print("src2.GetSlot() " + src2.GetSlot());
549 for (int i = 0; i < count; i++)
550 {
551 int slotID = item1.GetInventory().GetSlotId(i);
552 //Print("slotID " + slotID);
553 if (src2.GetSlot() == slotID) //can be attached into the same slot. And will be.
554 return false;
555 }
556 }
557
558 //if ( item1.m_OldLocation.GetType() == InventoryLocationType.CARGO/* || InventoryLocationType.PROXYCARGO*/ ) //should return to cargo, verify free space
559 //{
560 if ( !item1.m_OldLocation.GetParent().GetInventory().LocationCanAddEntity(item1.m_OldLocation) ) //TODO: is this correct usage?
561 {
562 //FindFreeLocationFor(item1,FindInventoryLocationType.ANY,dst);
563 SwapToPrevious = false;
564 }
565 if ( CanSwapEntitiesEx(item1,item2) )
566 {
567 SwapToPrevious = false;
568 }
569 //}
570
571 if ( SwapToPrevious/*dst.CompareLocationOnly(item1.m_OldLocation)*/ )
572 return true;
573 }
574 }
575
576 return false;
577 }
578
580 {}
581
582 void Update(float delta_time)
583 {
586 {
589 ctx.Write(InventoryCommandType.USER_RESERVATION_CANCEL);
591 ctx.Send();
592
594
597 EntityAI item = il.GetItem();
598 item.GetOnReleaseLock().Invoke(item);
600 }
601
602 /*if( m_UserReservationToClear != -1 )
603 {
604 ClearUserReservedLocationAtIndex(m_UserReservationToClear);
605 m_UserReservationToClear = -1;
606 }*/
607 }
608
610 {
611 validation.m_Result = InventoryValidationResult.SUCCESS;
612
613 int index = -1;
614 if (!ctx.Read(index))
615 {
617 return true;
618 }
619
621 //m_UserReservationToClear = index;
622
623 return true;
624 }
625}
InventoryCommandType
Definition Inventory.c:3
InventoryMode
Definition Inventory.c:20
InventoryValidationResult
Definition Inventory.c:28
const int INPUT_UDT_INVENTORY
Definition _constants.c:9
void hndDebugPrint(string s)
Definition HandFSM.c:1
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
HumanInventory GetHumanInventory()
inventory
Definition Man.c:46
script counterpart to engine's class Inventory
Definition Inventory.c:77
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:1155
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:601
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:1167
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto native EntityAI GetInventoryOwner()
Engine native functions.
Abstracted event, not to be used, only inherited.
override bool ReserveInventory()
override string DumpToString()
override InventoryLocation GetDst()
represent hand state base
inventory for plain man/human
proto native int GetUserReservedLocationCount()
override EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
bool HasEntityInHands(EntityAI e)
proto native int FindUserReservedLocationIndex(notnull EntityAI e)
override bool TakeEntityAsAttachmentEx(InventoryMode mode, notnull EntityAI item, int slot)
void OnEntityInHandsCreated(InventoryLocation src)
proto native void ClearUserReservedLocation(notnull EntityAI eai)
bool SwappingToPreviousLocation(EntityAI item1, EntityAI item2, out InventoryLocation dst)
bool ValidateUserReservationCancel(inout Serializer ctx, InventoryValidation validation)
proto native void GetUserReservedLocation(int index, out notnull InventoryLocation dst)
proto native bool CanOpenInventory()
proto native bool CanAddEntityInHands(EntityAI e)
alternative for TestAddEntityInHands(e, true, true, true);
bool ReplaceItemInHandsWithNew(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
override bool TakeEntityToInventory(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
void ClearUserReservedLocationSynced(notnull EntityAI eai)
override bool DropEntity(InventoryMode mode, EntityAI owner, notnull EntityAI item)
bool HandEvent(InventoryMode mode, HandEventBase e)
override bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
proto native void ClearUserReservedLocationForContainer(notnull EntityAI eai)
bool ReplaceItemInHandsWithNewElsewhere(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
proto native bool GetDebugFlag()
proto native EntityAI CreateInHands(string typeName)
creates new entity in hands
bool ThrowEntity(EntityAI item, vector dir, float force)
override bool SwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
proto native bool ClearUserReservedLocationAtIndex(int index)
protected bool ReplaceItemInElsewhereWithNewinHandsImpl(InventoryMode mode, HandEventBase e)
void ClearUserReservedLocationAtIndexSynced(int index)
void HandleInventoryManipulation()
void Update(float delta_time)
void OnHandsEnteredStableState(HandStateBase src, HandStateBase dst)
proto native int FindCollidingUserReservedLocationIndex(notnull EntityAI e, notnull InventoryLocation dst)
override bool ReplaceItemWithNew(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
override bool TakeEntityToCargoEx(InventoryMode mode, notnull EntityAI item, int idx, int row, int col)
Put item into into cargo on specific cargo location.
proto native EntityAI GetEntityInHands()
bool ReplaceItemElsewhereWithNewInHands(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
override bool ForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
proto native void SetUserReservedLocation(notnull EntityAI eai, notnull InventoryLocation dst)
int m_syncClearUserReservationindex
proto native bool CanRemoveEntityInHands()
void OnHandsStateChanged(HandStateBase src, HandStateBase dst)
proto native int FindFirstUserReservedLocationIndexForContainer(notnull EntityAI e)
bool ProcessHandEvent(HandEventBase e)
override bool LocalDestroyEntity(notnull EntityAI item)
void OnEntityInHandsDestroyed(InventoryLocation src)
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)
bool RedirectToHandEvent(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
protected bool ReplaceItemInHandsWithNewImpl(InventoryMode mode, HandEventBase e)
void OnHandsExitedStableState(HandStateBase src, HandStateBase dst)
InventoryLocation.
proto native int GetType()
returns type of InventoryLocation
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
sets current inventory location type to Attachment with slot id set to <slotId>
proto native EntityAI GetItem()
returns item of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
static string DumpToStringNullSafe(InventoryLocation loc)
InventoryValidationResult m_Result
Definition Inventory.c:46
base class for transformation operations (creating one item from another)
proto static native bool CanStoreInputUserData()
proto native void Send()
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto bool Write(void value_out)
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
proto native owned string GetName()