Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
man.c
Go to the documentation of this file.
1#ifdef FEATURE_NETWORK_RECONCILIATION
2class Person extends Pawn
3{
5};
6#endif
7
9{
10};
11
12#ifdef FEATURE_NETWORK_RECONCILIATION
13class Man extends Person
14#else
15class Man extends EntityAI
16#endif
17{
19 proto native UAInterface GetInputInterface();
21 proto native PlayerIdentity GetIdentity();
23 proto native EntityAI GetDrivingVehicle();
24
25 proto native owned string GetCurrentWeaponMode();
26
28 proto native void SetSpeechRestricted(bool state);
30 proto native bool IsSpeechRestricted();
31
33 proto native void SetFaceTexture(string texture_name);
35 proto native void SetFaceMaterial(string material_name);
36
37 proto native bool IsSoundInsideBuilding();
38 proto native bool IsCameraInsideVehicle();
39
40 proto native owned string GetMasterAttenuation();
41 proto native void SetMasterAttenuation(string masterAttenuation);
42
43 void Man()
44 {
45 SetFlags(EntityFlags.TOUCHTRIGGERS, false);
46 }
47
48 override bool IsMan()
49 {
50 return true;
51 }
52
53 override bool IsHealthVisible()
54 {
55 return false;
56 }
57
59 {
60 return true;
61 }
62
63 bool IsUnconscious();
65 bool IsUnconsciousStateOnly();
66
67 int GetPlayerState()
68 {
69 if (IsAlive())
70 return EPlayerStates.ALIVE;
71
72 return EPlayerStates.DEAD;
73 }
74
75 void AddItemToDelete(EntityAI item);
76
79 proto native HumanInventory GetHumanInventory();
81 proto native EntityAI GetEntityInHands();
82 //Called when an item is removed from the cargo of this item
84 //Called when an item is moved around in the cargo of this item
86
88
96
97
105
107 {
108 SetWeightDirty();
110 m_OnItemAddedToHands.Invoke( item, this );
111 }
112
114 {
115 SetWeightDirty();
117 m_OnItemRemovedFromHands.Invoke( item, this );
118 }
119
121 bool JunctureDropEntity (notnull EntityAI item)
122 {
123 return DropEntityImpl(InventoryMode.JUNCTURE, this, item);
124 }
125
126 override bool PredictiveDropEntity (notnull EntityAI item)
127 {
128 if (!ScriptInputUserData.CanStoreInputUserData())
129 {
130 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveDropEntity input data not sent yet, cannot allow another input action");
131 return false;
132 }
133
134 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
135 return JunctureDropEntity(item);
136 else
137 return DropEntityImpl(InventoryMode.PREDICTIVE, this, item);
138 }
139
140 override bool LocalDropEntity (notnull EntityAI item)
141 {
142 return DropEntityImpl(InventoryMode.LOCAL, this, item);
143 }
144
145 override bool ServerDropEntity (notnull EntityAI item)
146 {
147 return DropEntityImpl(InventoryMode.SERVER, this, item);
148 }
149
150 protected bool DropEntityImpl (InventoryMode mode, notnull EntityAI owner, notnull EntityAI item)
151 {
152 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::DropEntity(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
153 bool code = GetHumanInventory().DropEntity(mode, owner, item);
155 return code;
156 }
157
158
159 override bool CanDropEntity (notnull EntityAI item) { return true; }
160
162
163 bool NeedInventoryJunctureFromServer (notnull EntityAI item, EntityAI currParent, EntityAI newParent) { return false; }
164
167 {
168 TakeEntityToHandsImpl(InventoryMode.JUNCTURE, item);
169 }
170
172 {
173 if (!ScriptInputUserData.CanStoreInputUserData())
174 {
175 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityToHands input data not sent yet, cannot allow another input action");
176 return;
177 }
178
179 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
181 else
182 TakeEntityToHandsImpl(InventoryMode.PREDICTIVE, item);
183 }
184
186 {
188 }
189
191 {
193 }
194
196 {
197 if (!g_Game.IsDedicatedServer() )
198 {
200 il.SetHands(this, item);
201 //GetInventory().AddInventoryReservationEx(item, il ,GameInventory.c_InventoryReservationTimeoutShortMS);
202 }
203
204 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Hands(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
205 EntityAI itemInHands = GetEntityInHands();
206
208 if (item.GetInventory().GetCurrentInventoryLocation(src_item))
209 {
210 if (itemInHands == null)
211 {
213 hand_dst.SetHands(this, item);
214 GetHumanInventory().TakeToDst(mode, src_item, hand_dst);
215 }
216 else if (GetHumanInventory().CanSwapEntitiesEx(itemInHands, item))
217 GetInventory().SwapEntities(mode, itemInHands, item);
219 }
220 }
221
222
224 {
225 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Destroy IH=" + GetEntityInHands());
226 GetHumanInventory().LocalDestroyEntity(GetEntityInHands());
228 }
229
232 {
233 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Stash IH=" + GetEntityInHands());
234 if (!ScriptInputUserData.CanStoreInputUserData())
235 {
236 Print("[inv] PredictiveMoveItemFromHandsToInventory input data not sent yet, cannot allow another input action");
237 return;
238 }
239
240 InventoryMode invMode = InventoryMode.PREDICTIVE;
241 EntityAI entityInHands = GetEntityInHands();
242
243 if (NeedInventoryJunctureFromServer(entityInHands, this, this))
244 invMode = InventoryMode.JUNCTURE;
245
246 HumanInventory humanInventory = GetHumanInventory();
248 if (entityInHands.m_OldLocation && entityInHands.m_OldLocation.IsValid())
249 {
251 entityInHands.GetInventory().GetCurrentInventoryLocation(invLoc);
252
254 EntityAI oldLocationParent = entityInHands.m_OldLocation.GetParent();
255 if (oldLocationParent && oldLocationParent.GetHierarchyRootPlayer())
256 {
257 humanInventory.ClearInventoryReservation(entityInHands, entityInHands.m_OldLocation);
258 if (humanInventory.LocationCanMoveEntity(invLoc, entityInHands.m_OldLocation))
259 {
260 EntityAI oldLocEntity = humanInventory.LocationGetEntity(entityInHands.m_OldLocation);
261 if (!oldLocEntity && humanInventory.TakeToDst(invMode, invLoc, entityInHands.m_OldLocation))
262 {
264 return;
265 }
266 else
267 {
268 InventoryLocation newLocation = new InventoryLocation;
269 if (humanInventory.FindFreeLocationFor(entityInHands, FindInventoryLocationType.CARGO, newLocation))
270 {
271 if (humanInventory.TakeToDst(invMode, invLoc, newLocation))
272 {
274 return;
275 }
276 }
277 }
278 }
279 }
280 }
281
282 humanInventory.TakeEntityToInventory(invMode, FindInventoryLocationType.ATTACHMENT | FindInventoryLocationType.CARGO, GetEntityInHands());
284 }
285
288 {
289 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Replace !HND lambda=" + lambda.DumpToString());
290 bool code = GetHumanInventory().ReplaceItemWithNew(mode, lambda);
292 return code;
293 }
294
299
304
305
308 {
309 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Replace !HND->HND lambda=" + lambda.DumpToString());
310 bool code = GetHumanInventory().ReplaceItemElsewhereWithNewInHands(mode, lambda);
312 return code;
313 }
314
319
324
325
328 {
329 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Replace HND->HND lambda=" + lambda.DumpToString());
330 bool code = GetHumanInventory().ReplaceItemInHandsWithNew(mode, lambda);
332 return code;
333 }
334
339
344
345
348 {
349 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Replace HND->elsewhere lambda=" + lambda.DumpToString());
350 bool code = GetHumanInventory().ReplaceItemInHandsWithNewElsewhere(mode, lambda);
352 return code;
353 }
354
359
364
365
368 {
369 return TakeEntityToInventoryImpl(InventoryMode.JUNCTURE, flags, item);
370 }
371
373 {
374 if (!ScriptInputUserData.CanStoreInputUserData())
375 {
376 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityToInventory input data not sent yet, cannot allow another input action");
377 return false;
378 }
379
380 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
381 return JunctureTakeEntityToInventory(flags, item);
382 else
383 return TakeEntityToInventoryImpl(InventoryMode.PREDICTIVE, flags, item);
384 }
385
387 {
388 return TakeEntityToInventoryImpl(InventoryMode.LOCAL, flags, item);
389 }
390
392 {
393 return TakeEntityToInventoryImpl(InventoryMode.SERVER, flags, item);
394 }
395
397 {
398 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
399 bool code = GetHumanInventory().TakeEntityToInventory(mode, flags, item);
401 return code;
402 }
403
404
407 {
408 return TakeEntityToCargoImpl(InventoryMode.JUNCTURE, item);
409 }
410
411 override bool PredictiveTakeEntityToCargo (notnull EntityAI item)
412 {
413 if (!ScriptInputUserData.CanStoreInputUserData())
414 {
415 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityToCargo input data not sent yet, cannot allow another input action");
416 return false;
417 }
418
419 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
420 return JunctureTakeEntityToCargo(item);
421 else
422 return TakeEntityToCargoImpl(InventoryMode.PREDICTIVE, item);
423 }
424
425 override bool LocalTakeEntityToCargo (notnull EntityAI item)
426 {
427 return TakeEntityToCargoImpl(InventoryMode.LOCAL, item);
428 }
429
430 override bool ServerTakeEntityToCargo (notnull EntityAI item)
431 {
432 return TakeEntityToCargoImpl(InventoryMode.SERVER, item);
433 }
434
435 protected bool TakeEntityToCargoImpl (InventoryMode mode, notnull EntityAI item)
436 {
437 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Cgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
438 bool code = GetHumanInventory().TakeEntityToCargo(mode, item);
440 return code;
441 }
442
443
446 {
447 return TakeEntityAsAttachmentImpl(InventoryMode.JUNCTURE, item);
448 }
449
450 override bool PredictiveTakeEntityAsAttachment (notnull EntityAI item)
451 {
452 if (!ScriptInputUserData.CanStoreInputUserData())
453 {
454 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityAsAttachment input data not sent yet, cannot allow another input action");
455 return false;
456 }
457
458 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
460 else
461 return TakeEntityAsAttachmentImpl(InventoryMode.PREDICTIVE, item);
462 }
463
464 override bool LocalTakeEntityAsAttachment (notnull EntityAI item)
465 {
466 return TakeEntityAsAttachmentImpl(InventoryMode.LOCAL, item);
467 }
468
469 override bool ServerTakeEntityAsAttachment (notnull EntityAI item)
470 {
471 return TakeEntityAsAttachmentImpl(InventoryMode.SERVER, item);
472 }
473
474 protected bool TakeEntityAsAttachmentImpl (InventoryMode mode, notnull EntityAI item)
475 {
476 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Att(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
477 bool code = GetHumanInventory().TakeEntityAsAttachment(mode, item);
479 return code;
480 }
481
482
484 bool JunctureTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
485 {
486 return TakeEntityAsAttachmentExImpl(InventoryMode.JUNCTURE, item, slot);
487 }
488
489 override bool PredictiveTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
490 {
491 if (!ScriptInputUserData.CanStoreInputUserData())
492 {
493 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityAsAttachmentEx input data not sent yet, cannot allow another input action");
494 return false;
495 }
496
497 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
498 return JunctureTakeEntityAsAttachmentEx(item, slot);
499 else
500 return TakeEntityAsAttachmentExImpl(InventoryMode.PREDICTIVE, item, slot);
501 }
502
503 override bool LocalTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
504 {
505 return TakeEntityAsAttachmentExImpl(InventoryMode.LOCAL, item, slot);
506 }
507
508 override bool ServerTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
509 {
510 return TakeEntityAsAttachmentExImpl(InventoryMode.SERVER, item, slot);
511 }
512
513 protected bool TakeEntityAsAttachmentExImpl (InventoryMode mode, notnull EntityAI item, int slot)
514 {
515 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2AttEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
516 bool code = GetHumanInventory().TakeEntityAsAttachmentEx(mode, item, slot);
518 return code;
519 }
520
521
523 bool JunctureSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
524 {
525 return SwapEntitiesImpl(InventoryMode.JUNCTURE, item1, item2);
526 }
527
528 bool PredictiveSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
529 {
530 if (!ScriptInputUserData.CanStoreInputUserData())
531 {
532 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveSwapEntities input data not sent yet, cannot allow another input action");
533 return false;
534 }
535
536 EntityAI item1Parent = item1.GetHierarchyParent();
537 EntityAI item2Parent = item2.GetHierarchyParent();
538 bool need_j1 = NeedInventoryJunctureFromServer(item1, item1Parent, item2Parent);
539 bool need_j2 = NeedInventoryJunctureFromServer(item2, item2Parent, item1Parent);
540 if (need_j1 || need_j2)
541 return SwapEntitiesImpl(InventoryMode.JUNCTURE, item1, item2);
542 else
543 return SwapEntitiesImpl(InventoryMode.PREDICTIVE, item1, item2);
544 }
545
546 bool LocalSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
547 {
548 return SwapEntitiesImpl(InventoryMode.LOCAL, item1, item2);
549 }
550
551 bool ServerSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
552 {
553 return SwapEntitiesImpl(InventoryMode.SERVER, item1, item2);
554 }
555
556 protected bool SwapEntitiesImpl (InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
557 {
558 bool code;
559 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::SwapImpl(" + typename.EnumToString(InventoryMode, mode) + ") item1=" + Object.GetDebugName(item1) + " item2=" + item2.GetDebugName(this));
560 if (!GameInventory.CanSwapEntitiesEx(item1, item2))
561 Error("[inv] (Man@" + this + ") SwapEntitiesImpl - cannot swap items!");
562
563 code = GetHumanInventory().SwapEntities(mode, item1, item2);
564
566 if (!code)
567 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " SwapEntitiesImpl - cannot swap or forceswap");
568 return code;
569 }
570
571
573 bool JunctureForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
574 {
575 return ForceSwapEntitiesImpl(InventoryMode.JUNCTURE, item1, item2, item2_dst);
576 }
577
578 bool PredictiveForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
579 {
580 if (!ScriptInputUserData.CanStoreInputUserData())
581 {
582 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveForceSwapEntities input data not sent yet, cannot allow another input action");
583 return false;
584 }
585
586 EntityAI item1Parent = item1.GetHierarchyParent();
587 EntityAI item2Parent = item2.GetHierarchyParent();
588 bool need_j1 = NeedInventoryJunctureFromServer(item1, item1Parent, item2Parent);
589 bool need_j2 = NeedInventoryJunctureFromServer(item2, item2Parent, item1Parent);
590 if (need_j1 || need_j2)
591 return ForceSwapEntitiesImpl(InventoryMode.JUNCTURE, item1, item2, item2_dst);
592 else
593 return ForceSwapEntitiesImpl(InventoryMode.PREDICTIVE, item1, item2, item2_dst);
594 }
595
596 bool LocalForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
597 {
598 return ForceSwapEntitiesImpl(InventoryMode.LOCAL, item1, item2, item2_dst);
599 }
600
601 bool ServerForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
602 {
603 return ForceSwapEntitiesImpl(InventoryMode.SERVER, item1, item2, item2_dst);
604 }
605
606 protected bool ForceSwapEntitiesImpl (InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
607 {
608 bool code = false;
609 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ForceSwapImpl(" + typename.EnumToString(InventoryMode, mode) + ") item1=" + Object.GetDebugName(item1) + " item2=" + item2.GetDebugName(this));
610 code = GetHumanInventory().ForceSwapEntities(mode, item1, item2, item2_dst);
611
613 if (!code)
614 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ForceSwapEntitiesImpl - cannot Forceswap");
615 return code;
616 }
617
618
621 {
622 return TakeEntityToTargetInventoryImpl(InventoryMode.JUNCTURE, target, flags, item);
623 }
624
625 override bool PredictiveTakeEntityToTargetInventory (notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
626 {
627 if (!ScriptInputUserData.CanStoreInputUserData())
628 {
629 Print("[inv] " + GetSimulationTimeStamp() + " ::PredictiveTakeEntityToTargetInventory input data not sent yet, cannot allow another input action");
630 return false;
631 }
632
633 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), target))
634 return JunctureTakeEntityToTargetInventory(target, flags, item);
635 else
636 return TakeEntityToTargetInventoryImpl(InventoryMode.PREDICTIVE, target, flags, item);
637 }
638
640 {
641 if( GetInventory().CanAddAttachment( item ) )
642 {
644 }
645 else
646 {
647 GameInventory inventory = GetInventory();
648 GameInventory itemInventory = item.GetInventory();
649 for( int i = 0; i < itemInventory.GetSlotIdCount(); ++i )
650 {
651 int slot_id = itemInventory.GetSlotId(i);
652 EntityAI slot_item = inventory.FindAttachment( slot_id );
653 if( slot_item && inventory.CanSwapEntitiesEx( item, slot_item ) )
654 {
655 return PredictiveSwapEntities(item, slot_item);
656 }
657 }
658 }
659 return false;
660 }
661
662 override bool LocalTakeEntityToTargetInventory (notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
663 {
664 return TakeEntityToTargetInventoryImpl(InventoryMode.LOCAL, target, flags, item);
665 }
666
667 protected bool TakeEntityToTargetInventoryImpl (InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
668 {
669 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2TargetInv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
670 bool code = GetInventory().TakeEntityToTargetInventory(mode, target, flags, item);
672 return code;
673 }
674
675
677 bool JunctureTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
678 {
679 return TakeEntityToTargetCargoExImpl(InventoryMode.JUNCTURE, cargo, item, row, col);
680 }
681
682 override bool PredictiveTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
683 {
684 if (!ScriptInputUserData.CanStoreInputUserData())
685 {
686 Print("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::PredictiveTakeEntityToTargetCargoEx input data not sent yet, cannot allow another input action");
687 return false;
688 }
689
690 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), cargo.GetCargoOwner()))
691 return JunctureTakeEntityToTargetCargoEx(cargo, item, row, col);
692 else
693 return TakeEntityToTargetCargoExImpl(InventoryMode.PREDICTIVE, cargo, item, row, col);
694 }
695
696 override bool LocalTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
697 {
698 return TakeEntityToTargetCargoExImpl(InventoryMode.LOCAL, cargo, item, row, col);
699 }
700
701 override bool ServerTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
702 {
703 return TakeEntityToTargetCargoExImpl(InventoryMode.SERVER, cargo, item, row, col);
704 }
705
706 protected bool TakeEntityToTargetCargoExImpl (InventoryMode mode, notnull CargoBase cargo, notnull EntityAI item, int row, int col)
707 {
708 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2TargetCgoEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
709 bool code = GetInventory().TakeEntityToTargetCargoEx(mode, cargo, item, row, col);
711 return code;
712 }
713
714
716 bool JunctureTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
717 {
718 return TakeEntityToTargetCargoImpl(InventoryMode.JUNCTURE, target, item);
719 }
720
721 override bool PredictiveTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
722 {
723 if (!ScriptInputUserData.CanStoreInputUserData())
724 {
725 Print("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::PredictiveTakeEntityToTargetCargo input data not sent yet, cannot allow another input action");
726 return false;
727 }
728
729 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), target))
730 return JunctureTakeEntityToTargetCargo(target, item);
731 else
732 return TakeEntityToTargetCargoImpl(InventoryMode.PREDICTIVE, target, item);
733 }
734
735 override bool LocalTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
736 {
737 return TakeEntityToTargetCargoImpl(InventoryMode.LOCAL, target, item);
738 }
739
740 override bool ServerTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
741 {
742 if (IsAlive())
743 return TakeEntityToTargetCargoImpl(InventoryMode.SERVER, target, item);
744 else
745 return TakeEntityToTargetCargoImpl(InventoryMode.SERVER, target, item);
746 }
747
748 protected bool TakeEntityToTargetCargoImpl (InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
749 {
750 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Take2TargetCgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
751
752 bool code = GetInventory().TakeEntityToTargetInventory(mode, target, FindInventoryLocationType.CARGO, item);
754 return code;
755 }
756
757
759 bool JunctureTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
760 {
761 return TakeEntityToTargetAttachmentExImpl(InventoryMode.JUNCTURE, target, item, slot);
762 }
763
764 override bool PredictiveTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
765 {
766 if (!ScriptInputUserData.CanStoreInputUserData())
767 {
768 Print("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::PredictiveTakeEntityToTargetAttachmentEx input data not sent yet, cannot allow another input action");
769 return false;
770 }
771
772 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), target))
773 return JunctureTakeEntityToTargetAttachmentEx(target, item, slot);
774 else
775 return TakeEntityToTargetAttachmentExImpl(InventoryMode.PREDICTIVE, target, item, slot);
776 }
777
778 override bool LocalTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
779 {
780 return TakeEntityToTargetAttachmentExImpl(InventoryMode.LOCAL, target, item, slot);
781 }
782
783 override bool ServerTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
784 {
785 return TakeEntityToTargetAttachmentExImpl(InventoryMode.SERVER, target, item, slot);
786 }
787
788 protected bool TakeEntityToTargetAttachmentExImpl (InventoryMode mode, notnull EntityAI target, notnull EntityAI item, int slot)
789 {
790 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2TargetAtt(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
791 bool code = GetInventory().TakeEntityAsTargetAttachmentEx(mode, target, item, slot);
793 return code;
794 }
795
796
798 bool JunctureTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
799 {
800 return TakeEntityToTargetAttachmentImpl(InventoryMode.JUNCTURE, target, item);
801 }
802
803 override bool PredictiveTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
804 {
805 if (!ScriptInputUserData.CanStoreInputUserData())
806 {
807 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityToTargetAttachment input data not sent yet, cannot allow another input action");
808 return false;
809 }
810
811 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), target))
812 return JunctureTakeEntityToTargetAttachment(target, item);
813 else
814 return TakeEntityToTargetAttachmentImpl(InventoryMode.PREDICTIVE, target, item);
815 }
816
817 override bool LocalTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
818 {
819 return TakeEntityToTargetAttachmentImpl(InventoryMode.LOCAL, target, item);
820 }
821
822 override bool ServerTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
823 {
824 return TakeEntityToTargetAttachmentImpl(InventoryMode.SERVER, target, item);
825 }
826
827 protected bool TakeEntityToTargetAttachmentImpl (InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
828 {
830 if( target.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.ATTACHMENT, il) )
831 {
832 return TakeEntityToTargetAttachmentExImpl(mode, target, item, il.GetSlot());
833 }
834 return false;
835 }
836
837
840 {
841 return TakeToDstImpl(InventoryMode.JUNCTURE, src, dst);
842 }
843
844 override bool PredictiveTakeToDst (notnull InventoryLocation src, notnull InventoryLocation dst)
845 {
846 if (!ScriptInputUserData.CanStoreInputUserData())
847 {
848 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeToDst input data not sent yet, cannot allow another input action");
849 return false;
850 }
851
852 if (NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
853 return JunctureTakeToDst(src, dst);
854 else
855 return TakeToDstImpl(InventoryMode.PREDICTIVE, src, dst);
856 }
857
858 override bool LocalTakeToDst (notnull InventoryLocation src, notnull InventoryLocation dst)
859 {
860 return TakeToDstImpl(InventoryMode.LOCAL, src, dst);
861 }
862
863 override bool ServerTakeToDst (notnull InventoryLocation src, notnull InventoryLocation dst)
864 {
865 return TakeToDstImpl(InventoryMode.SERVER, src, dst);
866 }
867
868 protected bool TakeToDstImpl (InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
869 {
870 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Dst(" + typename.EnumToString(InventoryMode, mode) + ") src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
871 bool code = GetHumanInventory().TakeToDst(mode, src, dst);
873 return code;
874 }
875
877
879 {
880
881 }
882
883 override bool CanBeSkinned()
884 {
885 return !GetIsFrozen();
886 }
887
888 override bool DisableVicinityIcon()
889 {
890 return true;
891 }
892
894
899
902
905 proto native bool StatRegister( string name );
907
910 proto native float StatGet( string name );
912
916 proto void StatGetCounter( string name, out string value );
918
922 proto void StatGetAsTime( string name, out string value );
924
928 proto native void StatUpdate( string name, float value );
930
934 proto native void StatUpdateByTime( string name );
936
940 proto native void StatUpdateByPosition( string name );
942
946 proto native void StatUpdateByGivenPos( string name, vector pos );
950 proto native void StatInvokeUpdate();
954 proto native void StatSyncToClient();
956
958 {
959 return false;
960 }
961
962 void SetInventorySoftLock(bool status);
963
966 {
967 return Transport.Cast(GetParent()) != null;
968 }
969
971 bool PhysicalPredictiveDropItem(EntityAI entity, bool heavy_item_only = true);
972 void SetProcessUIWarning(bool state);
973 void OnGameplayDataHandlerSync(); //depricated, sync now happens before the player is created, calling of this event still happens for legacy reasons
975
983 {
984 return null;
985 }
986};
void syncDebugPrint(string s)
Definition debug.c:1
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
class LogManager EntityAI
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
represents base for cargo storage for entities
Definition cargo.c:7
bool ReplaceItemInHandsWithNewImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
hand replace
Definition man.c:327
override bool ServerTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Definition man.c:822
proto native void StatUpdateByTime(string name)
Updates stat counter by time.
override bool PredictiveTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition man.c:844
override bool LocalTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:662
override bool PredictiveTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:372
override bool LocalTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition man.c:858
override bool PredictiveTakeEntityAsAttachment(notnull EntityAI item)
Definition man.c:450
bool JunctureTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
to target cgo ex juncture
Definition man.c:677
ref ScriptInvoker m_OnItemAddedToHands
Definition man.c:83
bool JunctureTakeEntityAsAttachment(notnull EntityAI item)
as att juncture
Definition man.c:445
bool TakeEntityToCargoImpl(InventoryMode mode, notnull EntityAI item)
Definition man.c:435
bool ServerReplaceItemInHandsWithNewElsewhere(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:360
override bool PredictiveTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Definition man.c:489
void UpdateInventoryMenu()
bool JunctureTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
to target cgo juncture
Definition man.c:716
bool LocalReplaceItemElsewhereWithNewInHands(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:315
override bool PredictiveDropEntity(notnull EntityAI item)
Definition man.c:126
override bool ServerTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Definition man.c:740
override bool ServerTakeEntityToCargo(notnull EntityAI item)
Definition man.c:430
bool JunctureDropEntity(notnull EntityAI item)
drop juncture
Definition man.c:121
bool LocalReplaceItemInHandsWithNewElsewhere(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:355
ScriptInvoker GetOnItemAddedToHands()
Definition man.c:89
bool IsInventorySoftLocked()
Definition man.c:957
void SetInventorySoftLock(bool status)
override bool PredictiveTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:625
bool LocalReplaceItemInHandsWithNew(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:335
override bool LocalTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:386
bool IsInTransport()
returns true if man is in transport, false otherwise
Definition man.c:965
proto native void StatSyncToClient()
override bool ServerTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Definition man.c:783
bool ServerSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Definition man.c:551
array< InventoryItem > OnDrawOptics2D()
Definition man.c:982
override bool LocalTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Definition man.c:503
void LocalDestroyEntityInHands()
Definition man.c:223
ref CachedEquipmentStorageBase m_CachedEquipmentStorage
Definition man.c:87
override bool PredictiveTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Definition man.c:764
void JunctureTakeEntityToHands(notnull EntityAI item)
hand juncture
Definition man.c:166
bool SwapEntitiesImpl(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
Definition man.c:556
override bool ServerTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:391
bool ReplaceItemWithNewImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
!hand -> !hand replace
Definition man.c:287
bool JunctureTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
as att ex juncture
Definition man.c:484
bool ReplaceItemElsewhereWithNewInHandsImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
!hand replace -> hand
Definition man.c:307
void TakeEntityToHandsImpl(InventoryMode mode, EntityAI item)
Definition man.c:195
bool ServerReplaceItemWithNew(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:300
override bool LocalTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Definition man.c:778
proto native float StatGet(string name)
Gets counter value of the specified stat type.
void OnItemInHandsChanged()
Definition man.c:161
override bool LocalTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Definition man.c:817
override bool PredictiveTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Definition man.c:721
override bool PredictiveTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Definition man.c:803
bool PredictiveForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Definition man.c:578
bool JunctureSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
swap juncture
Definition man.c:523
bool JunctureTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
to target inv juncture
Definition man.c:620
proto native void StatInvokeUpdate()
override bool CanBeSkinned()
Definition man.c:883
void ServerTakeEntityToHands(EntityAI item)
Definition man.c:190
void LocalTakeEntityToHands(EntityAI item)
Definition man.c:185
bool TakeEntityAsAttachmentExImpl(InventoryMode mode, notnull EntityAI item, int slot)
Definition man.c:513
override bool CanDropEntity(notnull EntityAI item)
Definition man.c:159
CachedEquipmentStorageBase GetCachedEquipment()
Definition man.c:895
override bool ServerTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition man.c:701
bool LocalSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Definition man.c:546
void EEItemIntoHands(EntityAI item)
Definition man.c:106
bool PhysicalPredictiveDropItem(EntityAI entity, bool heavy_item_only=true)
void StopDeathDarkeningEffect()
bool PredictiveTakeOrSwapAttachment(notnull EntityAI item)
Definition man.c:639
proto void StatGetCounter(string name, out string value)
Gets counter value as string of the specified stat type.
override bool DisableVicinityIcon()
Definition man.c:888
bool JunctureTakeEntityToCargo(notnull EntityAI item)
to cgo juncture
Definition man.c:406
bool TakeEntityToTargetAttachmentExImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item, int slot)
Definition man.c:788
bool JunctureTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
to inv juncture
Definition man.c:367
bool ServerReplaceItemElsewhereWithNewInHands(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:320
bool LocalForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Definition man.c:596
bool JunctureTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
to target att ex juncture
Definition man.c:759
bool JunctureTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
to dst juncture
Definition man.c:839
bool ForceSwapEntitiesImpl(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Definition man.c:606
override bool ServerTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition man.c:863
proto native bool StatRegister(string name)
override bool LocalTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition man.c:696
bool TakeToDstImpl(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
Definition man.c:868
bool JunctureTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
to target att juncture
Definition man.c:798
bool ServerForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Definition man.c:601
override bool LocalTakeEntityAsAttachment(notnull EntityAI item)
Definition man.c:464
override bool LocalTakeEntityToCargo(notnull EntityAI item)
Definition man.c:425
override bool LocalTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Definition man.c:735
override bool ServerDropEntity(notnull EntityAI item)
Definition man.c:145
proto native void StatUpdate(string name, float value)
Updates stat counter with given value.
bool NeedInventoryJunctureFromServer(notnull EntityAI item, EntityAI currParent, EntityAI newParent)
Definition man.c:163
bool TakeEntityToTargetAttachmentImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
Definition man.c:827
override bool ServerTakeEntityAsAttachment(notnull EntityAI item)
Definition man.c:469
proto native void StatUpdateByPosition(string name)
Updates stat counter by player's actual position.
bool JunctureForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
ForceSwap juncture.
Definition man.c:573
bool CanPlaceItem(EntityAI item)
void SetProcessUIWarning(bool state)
ref ScriptInvoker m_OnItemRemovedFromHands
Definition man.c:85
void JunctureDeleteItem(EntityAI item)
Definition man.c:878
bool DropEntityImpl(InventoryMode mode, notnull EntityAI owner, notnull EntityAI item)
Definition man.c:150
bool TakeEntityToTargetCargoImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
Definition man.c:748
bool TakeEntityToTargetCargoExImpl(InventoryMode mode, notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition man.c:706
void Transport()
Definition transport.c:71
proto void StatGetAsTime(string name, out string value)
Gets counter value as formatted time string of the specified stat type.
bool ServerReplaceItemInHandsWithNew(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:340
override bool ServerTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Definition man.c:508
void PredictiveMoveItemFromHandsToInventory()
ToDo: Old system method. Might should be adjusted to new system at some point.
Definition man.c:231
override bool LocalDropEntity(notnull EntityAI item)
Definition man.c:140
void OnGameplayDataHandlerSync()
void EEItemOutOfHands(EntityAI item)
Definition man.c:113
bool TakeEntityToTargetInventoryImpl(InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:667
ScriptInvoker GetOnItemRemovedFromHands()
Definition man.c:98
void PredictiveTakeEntityToHands(EntityAI item)
Definition man.c:171
override bool PredictiveTakeEntityToCargo(notnull EntityAI item)
Definition man.c:411
bool TakeEntityAsAttachmentImpl(InventoryMode mode, notnull EntityAI item)
Definition man.c:474
proto native void StatUpdateByGivenPos(string name, vector pos)
Updates stat counter by given position.
bool PredictiveSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Definition man.c:528
override bool PredictiveTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition man.c:682
bool ReplaceItemInHandsWithNewElsewhereImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
hand replace2
Definition man.c:347
bool LocalReplaceItemWithNew(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:295
bool TakeEntityToInventoryImpl(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:396
void EntityAIType()
Definition entityaitype.c:3
script counterpart to engine's class Inventory
Definition inventory.c:81
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition inventory.c:630
proto native int GetSlotId(int index)
attachments
proto native int GetSlotIdCount()
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)...
inventory for plain man/human
InventoryLocation.
Definition man.c:9
The class that will be instanced (moddable).
Definition gameplay.c:389
base class for transformation operations (creating one item from another)
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override bool HasFixedActionTargetCursorPosition()
Definition dayzanimal.c:120
DayZGame g_Game
Definition dayzgame.c:3942
override string GetDebugName()
EPlayerStates
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
proto void Print(void var)
Prints content of variable to console/log.
proto native void SetFlags(ShapeFlags flags)
EntityFlags
Entity flags.
Definition enentity.c:115
Object GetParent()
Get parent of the Effect.
Definition effect.c:422
FindInventoryLocationType
flags for searching locations in inventory