Dayz Explorer 1.28.160049
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
8#ifdef FEATURE_NETWORK_RECONCILIATION
9class Man extends Person
10#else
11class Man extends EntityAI
12#endif
13{
15 proto native UAInterface GetInputInterface();
17 proto native PlayerIdentity GetIdentity();
19 proto native EntityAI GetDrivingVehicle();
20
21 proto native owned string GetCurrentWeaponMode();
22
24 proto native void SetSpeechRestricted(bool state);
26 proto native bool IsSpeechRestricted();
27
29 proto native void SetFaceTexture(string texture_name);
31 proto native void SetFaceMaterial(string material_name);
32
33 proto native bool IsSoundInsideBuilding();
34 proto native bool IsCameraInsideVehicle();
35
36 proto native owned string GetMasterAttenuation();
37 proto native void SetMasterAttenuation(string masterAttenuation);
38
39 void Man()
40 {
41 SetFlags(EntityFlags.TOUCHTRIGGERS, false);
42 }
43
44 override bool IsMan()
45 {
46 return true;
47 }
48
49 override bool IsHealthVisible()
50 {
51 return false;
52 }
53
55 {
56 return true;
57 }
58
59 bool IsUnconscious();
61 bool IsUnconsciousStateOnly();
62
63 int GetPlayerState()
64 {
65 if (IsAlive())
66 return EPlayerStates.ALIVE;
67
68 return EPlayerStates.DEAD;
69 }
70
71 void AddItemToDelete(EntityAI item);
72
75 proto native HumanInventory GetHumanInventory();
76 //Called when an item is removed from the cargo of this item
78 //Called when an item is moved around in the cargo of this item
80
82 {
83 if (!m_OnItemAddedToHands)
84 m_OnItemAddedToHands = new ScriptInvoker();
85
87 }
88
89
91 {
92 if( !m_OnItemRemovedFromHands )
93 m_OnItemRemovedFromHands = new ScriptInvoker;
94
96 }
97
99 {
100 SetWeightDirty();
101 if( m_OnItemAddedToHands )
102 m_OnItemAddedToHands.Invoke( item, this );
103 }
104
106 {
107 SetWeightDirty();
108 if( m_OnItemRemovedFromHands )
109 m_OnItemRemovedFromHands.Invoke( item, this );
110 }
111
113 bool JunctureDropEntity (notnull EntityAI item)
114 {
115 return DropEntityImpl(InventoryMode.JUNCTURE, this, item);
116 }
117
118 override bool PredictiveDropEntity (notnull EntityAI item)
119 {
120 if (!ScriptInputUserData.CanStoreInputUserData())
121 {
122 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveDropEntity input data not sent yet, cannot allow another input action");
123 return false;
124 }
125
126 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
127 return JunctureDropEntity(item);
128 else
129 return DropEntityImpl(InventoryMode.PREDICTIVE, this, item);
130 }
131
132 override bool LocalDropEntity (notnull EntityAI item)
133 {
134 return DropEntityImpl(InventoryMode.LOCAL, this, item);
135 }
136
137 override bool ServerDropEntity (notnull EntityAI item)
138 {
139 return DropEntityImpl(InventoryMode.SERVER, this, item);
140 }
141
142 protected bool DropEntityImpl (InventoryMode mode, notnull EntityAI owner, notnull EntityAI item)
143 {
144 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::DropEntity(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
145 bool code = GetHumanInventory().DropEntity(mode, owner, item);
147 return code;
148 }
150
151 override bool CanDropEntity (notnull EntityAI item) { return true; }
152
154
155 bool NeedInventoryJunctureFromServer (notnull EntityAI item, EntityAI currParent, EntityAI newParent) { return false; }
156
159 {
160 TakeEntityToHandsImpl(InventoryMode.JUNCTURE, item);
161 }
162
164 {
165 if (!ScriptInputUserData.CanStoreInputUserData())
166 {
167 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityToHands input data not sent yet, cannot allow another input action");
168 return;
169 }
170
171 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
173 else
174 TakeEntityToHandsImpl(InventoryMode.PREDICTIVE, item);
175 }
176
178 {
180 }
181
183 {
185 }
186
188 {
189 if (!GetGame().IsDedicatedServer() )
190 {
192 il.SetHands(this, item);
193 //GetInventory().AddInventoryReservationEx(item, il ,GameInventory.c_InventoryReservationTimeoutShortMS);
194 }
195
196 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Hands(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
197 EntityAI itemInHands = GetHumanInventory().GetEntityInHands();
198
200 if (item.GetInventory().GetCurrentInventoryLocation(src_item))
201 {
202 if (itemInHands == null)
203 {
205 hand_dst.SetHands(this, item);
206 GetHumanInventory().TakeToDst(mode, src_item, hand_dst);
207 }
208 else if (GetHumanInventory().CanSwapEntitiesEx(itemInHands, item))
209 GetInventory().SwapEntities(mode, itemInHands, item);
211 }
212 }
214
216 {
217 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Destroy IH=" + GetHumanInventory().GetEntityInHands());
218 GetHumanInventory().LocalDestroyEntity(GetHumanInventory().GetEntityInHands());
220 }
221
224 {
225 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Stash IH=" + GetHumanInventory().GetEntityInHands());
226 if (!ScriptInputUserData.CanStoreInputUserData())
227 {
228 Print("[inv] PredictiveMoveItemFromHandsToInventory input data not sent yet, cannot allow another input action");
229 return;
230 }
231
232 InventoryMode invMode = InventoryMode.PREDICTIVE;
233 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
234
235 if (NeedInventoryJunctureFromServer(entityInHands, this, this))
236 invMode = InventoryMode.JUNCTURE;
237
239 if (entityInHands.m_OldLocation && entityInHands.m_OldLocation.IsValid())
240 {
242 entityInHands.GetInventory().GetCurrentInventoryLocation(invLoc);
243
245 if (entityInHands.m_OldLocation.GetParent() && entityInHands.m_OldLocation.GetParent().GetHierarchyRootPlayer())
246 {
247 GetHumanInventory().ClearInventoryReservation(entityInHands, entityInHands.m_OldLocation);
248 if (GetHumanInventory().LocationCanMoveEntity(invLoc, entityInHands.m_OldLocation))
249 {
250 EntityAI oldLocEntity = GetHumanInventory().LocationGetEntity(entityInHands.m_OldLocation);
251 if (!oldLocEntity && GetHumanInventory().TakeToDst(invMode, invLoc, entityInHands.m_OldLocation))
252 {
254 return;
255 }
256 else
257 {
258 InventoryLocation newLocation = new InventoryLocation;
259 if (GetHumanInventory().FindFreeLocationFor(entityInHands, FindInventoryLocationType.CARGO, newLocation))
260 {
261 if (GetHumanInventory().TakeToDst(invMode, invLoc, newLocation))
262 {
264 return;
265 }
266 }
267 }
268 }
269 }
270 }
271
272 GetHumanInventory().TakeEntityToInventory(invMode, FindInventoryLocationType.ATTACHMENT | FindInventoryLocationType.CARGO, GetHumanInventory().GetEntityInHands());
274 }
275
278 {
279 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Replace !HND lambda=" + lambda.DumpToString());
280 bool code = GetHumanInventory().ReplaceItemWithNew(mode, lambda);
282 return code;
283 }
284
289
295
298 {
299 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Replace !HND->HND lambda=" + lambda.DumpToString());
300 bool code = GetHumanInventory().ReplaceItemElsewhereWithNewInHands(mode, lambda);
302 return code;
303 }
304
309
315
318 {
319 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Replace HND->HND lambda=" + lambda.DumpToString());
320 bool code = GetHumanInventory().ReplaceItemInHandsWithNew(mode, lambda);
322 return code;
323 }
324
329
335
338 {
339 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Replace HND->elsewhere lambda=" + lambda.DumpToString());
340 bool code = GetHumanInventory().ReplaceItemInHandsWithNewElsewhere(mode, lambda);
342 return code;
343 }
344
349
355
358 {
359 return TakeEntityToInventoryImpl(InventoryMode.JUNCTURE, flags, item);
360 }
361
363 {
364 if (!ScriptInputUserData.CanStoreInputUserData())
365 {
366 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityToInventory input data not sent yet, cannot allow another input action");
367 return false;
368 }
369
370 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
371 return JunctureTakeEntityToInventory(flags, item);
372 else
373 return TakeEntityToInventoryImpl(InventoryMode.PREDICTIVE, flags, item);
374 }
375
377 {
378 return TakeEntityToInventoryImpl(InventoryMode.LOCAL, flags, item);
379 }
380
382 {
383 return TakeEntityToInventoryImpl(InventoryMode.SERVER, flags, item);
384 }
385
387 {
388 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
389 bool code = GetHumanInventory().TakeEntityToInventory(mode, flags, item);
391 return code;
392 }
394
397 {
398 return TakeEntityToCargoImpl(InventoryMode.JUNCTURE, item);
399 }
400
401 override bool PredictiveTakeEntityToCargo (notnull EntityAI item)
402 {
403 if (!ScriptInputUserData.CanStoreInputUserData())
404 {
405 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityToCargo input data not sent yet, cannot allow another input action");
406 return false;
407 }
408
409 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
410 return JunctureTakeEntityToCargo(item);
411 else
412 return TakeEntityToCargoImpl(InventoryMode.PREDICTIVE, item);
413 }
414
415 override bool LocalTakeEntityToCargo (notnull EntityAI item)
416 {
417 return TakeEntityToCargoImpl(InventoryMode.LOCAL, item);
418 }
419
420 override bool ServerTakeEntityToCargo (notnull EntityAI item)
421 {
422 return TakeEntityToCargoImpl(InventoryMode.SERVER, item);
423 }
424
425 protected bool TakeEntityToCargoImpl (InventoryMode mode, notnull EntityAI item)
426 {
427 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Cgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
428 bool code = GetHumanInventory().TakeEntityToCargo(mode, item);
430 return code;
431 }
433
436 {
437 return TakeEntityAsAttachmentImpl(InventoryMode.JUNCTURE, item);
438 }
439
440 override bool PredictiveTakeEntityAsAttachment (notnull EntityAI item)
441 {
442 if (!ScriptInputUserData.CanStoreInputUserData())
443 {
444 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityAsAttachment input data not sent yet, cannot allow another input action");
445 return false;
446 }
447
448 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
450 else
451 return TakeEntityAsAttachmentImpl(InventoryMode.PREDICTIVE, item);
452 }
453
454 override bool LocalTakeEntityAsAttachment (notnull EntityAI item)
455 {
456 return TakeEntityAsAttachmentImpl(InventoryMode.LOCAL, item);
457 }
458
459 override bool ServerTakeEntityAsAttachment (notnull EntityAI item)
460 {
461 return TakeEntityAsAttachmentImpl(InventoryMode.SERVER, item);
462 }
463
464 protected bool TakeEntityAsAttachmentImpl (InventoryMode mode, notnull EntityAI item)
465 {
466 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Att(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
467 bool code = GetHumanInventory().TakeEntityAsAttachment(mode, item);
469 return code;
470 }
472
474 bool JunctureTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
475 {
476 return TakeEntityAsAttachmentExImpl(InventoryMode.JUNCTURE, item, slot);
477 }
478
479 override bool PredictiveTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
480 {
481 if (!ScriptInputUserData.CanStoreInputUserData())
482 {
483 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityAsAttachmentEx input data not sent yet, cannot allow another input action");
484 return false;
485 }
486
487 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), this))
488 return JunctureTakeEntityAsAttachmentEx(item, slot);
489 else
490 return TakeEntityAsAttachmentExImpl(InventoryMode.PREDICTIVE, item, slot);
491 }
492
493 override bool LocalTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
494 {
495 return TakeEntityAsAttachmentExImpl(InventoryMode.LOCAL, item, slot);
496 }
497
498 override bool ServerTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
499 {
500 return TakeEntityAsAttachmentExImpl(InventoryMode.SERVER, item, slot);
501 }
502
503 protected bool TakeEntityAsAttachmentExImpl (InventoryMode mode, notnull EntityAI item, int slot)
504 {
505 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2AttEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
506 bool code = GetHumanInventory().TakeEntityAsAttachmentEx(mode, item, slot);
508 return code;
509 }
511
513 bool JunctureSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
514 {
515 return SwapEntitiesImpl(InventoryMode.JUNCTURE, item1, item2);
516 }
517
518 bool PredictiveSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
519 {
520 if (!ScriptInputUserData.CanStoreInputUserData())
521 {
522 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveSwapEntities input data not sent yet, cannot allow another input action");
523 return false;
524 }
525
526 bool need_j1 = NeedInventoryJunctureFromServer(item1, item1.GetHierarchyParent(), item2.GetHierarchyParent());
527 bool need_j2 = NeedInventoryJunctureFromServer(item2, item2.GetHierarchyParent(), item1.GetHierarchyParent());
528 if (need_j1 || need_j2)
529 return SwapEntitiesImpl(InventoryMode.JUNCTURE, item1, item2);
530 else
531 return SwapEntitiesImpl(InventoryMode.PREDICTIVE, item1, item2);
532 }
533
534 bool LocalSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
535 {
536 return SwapEntitiesImpl(InventoryMode.LOCAL, item1, item2);
537 }
538
539 bool ServerSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
540 {
541 return SwapEntitiesImpl(InventoryMode.SERVER, item1, item2);
542 }
543
544 protected bool SwapEntitiesImpl (InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
545 {
546 bool code;
547 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::SwapImpl(" + typename.EnumToString(InventoryMode, mode) + ") item1=" + Object.GetDebugName(item1) + " item2=" + item2.GetDebugName(this));
548 if (!GameInventory.CanSwapEntitiesEx(item1, item2))
549 Error("[inv] (Man@" + this + ") SwapEntitiesImpl - cannot swap items!");
550
551 code = GetHumanInventory().SwapEntities(mode, item1, item2);
552
554 if (!code)
555 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " SwapEntitiesImpl - cannot swap or forceswap");
556 return code;
557 }
559
561 bool JunctureForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
562 {
563 return ForceSwapEntitiesImpl(InventoryMode.JUNCTURE, item1, item2, item2_dst);
564 }
565
566 bool PredictiveForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
567 {
568 if (!ScriptInputUserData.CanStoreInputUserData())
569 {
570 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveForceSwapEntities input data not sent yet, cannot allow another input action");
571 return false;
572 }
573
574 bool need_j1 = NeedInventoryJunctureFromServer(item1, item1.GetHierarchyParent(), item2.GetHierarchyParent());
575 bool need_j2 = NeedInventoryJunctureFromServer(item2, item2.GetHierarchyParent(), item1.GetHierarchyParent());
576 if (need_j1 || need_j2)
577 return ForceSwapEntitiesImpl(InventoryMode.JUNCTURE, item1, item2, item2_dst);
578 else
579 return ForceSwapEntitiesImpl(InventoryMode.PREDICTIVE, item1, item2, item2_dst);
580 }
581
582 bool LocalForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
583 {
584 return ForceSwapEntitiesImpl(InventoryMode.LOCAL, item1, item2, item2_dst);
585 }
586
587 bool ServerForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
588 {
589 return ForceSwapEntitiesImpl(InventoryMode.SERVER, item1, item2, item2_dst);
590 }
591
592 protected bool ForceSwapEntitiesImpl (InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
593 {
594 bool code = false;
595 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ForceSwapImpl(" + typename.EnumToString(InventoryMode, mode) + ") item1=" + Object.GetDebugName(item1) + " item2=" + item2.GetDebugName(this));
596 code = GetHumanInventory().ForceSwapEntities(mode, item1, item2, item2_dst);
597
599 if (!code)
600 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ForceSwapEntitiesImpl - cannot Forceswap");
601 return code;
602 }
604
607 {
608 return TakeEntityToTargetInventoryImpl(InventoryMode.JUNCTURE, target, flags, item);
609 }
610
611 override bool PredictiveTakeEntityToTargetInventory (notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
612 {
613 if (!ScriptInputUserData.CanStoreInputUserData())
614 {
615 Print("[inv] " + GetSimulationTimeStamp() + " ::PredictiveTakeEntityToTargetInventory input data not sent yet, cannot allow another input action");
616 return false;
617 }
618
619 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), target))
620 return JunctureTakeEntityToTargetInventory(target, flags, item);
621 else
622 return TakeEntityToTargetInventoryImpl(InventoryMode.PREDICTIVE, target, flags, item);
623 }
624
626 {
627 if( GetInventory().CanAddAttachment( item ) )
628 {
630 }
631 else
632 {
633 for( int i = 0; i < item.GetInventory().GetSlotIdCount(); i++ )
634 {
635 int slot_id = item.GetInventory().GetSlotId(i);
636 EntityAI slot_item = GetInventory().FindAttachment( slot_id );
637 if( slot_item && GetInventory().CanSwapEntitiesEx( item, slot_item ) )
638 {
639 return PredictiveSwapEntities(item, slot_item);
640 }
641 }
642 }
643 return false;
644 }
645
646 override bool LocalTakeEntityToTargetInventory (notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
647 {
648 return TakeEntityToTargetInventoryImpl(InventoryMode.LOCAL, target, flags, item);
649 }
650
651 protected bool TakeEntityToTargetInventoryImpl (InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
652 {
653 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2TargetInv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
654 bool code = GetInventory().TakeEntityToTargetInventory(mode, target, flags, item);
656 return code;
657 }
659
661 bool JunctureTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
662 {
663 return TakeEntityToTargetCargoExImpl(InventoryMode.JUNCTURE, cargo, item, row, col);
664 }
665
666 override bool PredictiveTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
667 {
668 if (!ScriptInputUserData.CanStoreInputUserData())
669 {
670 Print("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::PredictiveTakeEntityToTargetCargoEx input data not sent yet, cannot allow another input action");
671 return false;
672 }
673
674 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), cargo.GetCargoOwner()))
675 return JunctureTakeEntityToTargetCargoEx(cargo, item, row, col);
676 else
677 return TakeEntityToTargetCargoExImpl(InventoryMode.PREDICTIVE, cargo, item, row, col);
678 }
679
680 override bool LocalTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
681 {
682 return TakeEntityToTargetCargoExImpl(InventoryMode.LOCAL, cargo, item, row, col);
683 }
684
685 override bool ServerTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
686 {
687 return TakeEntityToTargetCargoExImpl(InventoryMode.SERVER, cargo, item, row, col);
688 }
689
690 protected bool TakeEntityToTargetCargoExImpl (InventoryMode mode, notnull CargoBase cargo, notnull EntityAI item, int row, int col)
691 {
692 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2TargetCgoEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
693 bool code = GetInventory().TakeEntityToTargetCargoEx(mode, cargo, item, row, col);
695 return code;
696 }
698
700 bool JunctureTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
701 {
702 return TakeEntityToTargetCargoImpl(InventoryMode.JUNCTURE, target, item);
703 }
704
705 override bool PredictiveTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
706 {
707 if (!ScriptInputUserData.CanStoreInputUserData())
708 {
709 Print("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::PredictiveTakeEntityToTargetCargo input data not sent yet, cannot allow another input action");
710 return false;
711 }
712
713 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), target))
714 return JunctureTakeEntityToTargetCargo(target, item);
715 else
716 return TakeEntityToTargetCargoImpl(InventoryMode.PREDICTIVE, target, item);
717 }
718
719 override bool LocalTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
720 {
721 return TakeEntityToTargetCargoImpl(InventoryMode.LOCAL, target, item);
722 }
723
724 override bool ServerTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
725 {
726 if (IsAlive())
727 return TakeEntityToTargetCargoImpl(InventoryMode.SERVER, target, item);
728 else
729 return TakeEntityToTargetCargoImpl(InventoryMode.SERVER, target, item);
730 }
731
732 protected bool TakeEntityToTargetCargoImpl (InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
733 {
734 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Take2TargetCgo(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
735
736 bool code = GetInventory().TakeEntityToTargetInventory(mode, target, FindInventoryLocationType.CARGO, item);
738 return code;
739 }
741
743 bool JunctureTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
744 {
745 return TakeEntityToTargetAttachmentExImpl(InventoryMode.JUNCTURE, target, item, slot);
746 }
747
748 override bool PredictiveTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
749 {
750 if (!ScriptInputUserData.CanStoreInputUserData())
751 {
752 Print("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::PredictiveTakeEntityToTargetAttachmentEx input data not sent yet, cannot allow another input action");
753 return false;
754 }
755
756 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), target))
757 return JunctureTakeEntityToTargetAttachmentEx(target, item, slot);
758 else
759 return TakeEntityToTargetAttachmentExImpl(InventoryMode.PREDICTIVE, target, item, slot);
760 }
761
762 override bool LocalTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
763 {
764 return TakeEntityToTargetAttachmentExImpl(InventoryMode.LOCAL, target, item, slot);
765 }
766
767 override bool ServerTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
768 {
769 return TakeEntityToTargetAttachmentExImpl(InventoryMode.SERVER, target, item, slot);
770 }
771
772 protected bool TakeEntityToTargetAttachmentExImpl (InventoryMode mode, notnull EntityAI target, notnull EntityAI item, int slot)
773 {
774 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2TargetAtt(" + typename.EnumToString(InventoryMode, mode) + ") item=" + Object.GetDebugName(item));
775 bool code = GetInventory().TakeEntityAsTargetAttachmentEx(mode, target, item, slot);
777 return code;
778 }
780
782 bool JunctureTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
783 {
784 return TakeEntityToTargetAttachmentImpl(InventoryMode.JUNCTURE, target, item);
785 }
786
787 override bool PredictiveTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
788 {
789 if (!ScriptInputUserData.CanStoreInputUserData())
790 {
791 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeEntityToTargetAttachment input data not sent yet, cannot allow another input action");
792 return false;
793 }
794
795 if (NeedInventoryJunctureFromServer(item, item.GetHierarchyParent(), target))
796 return JunctureTakeEntityToTargetAttachment(target, item);
797 else
798 return TakeEntityToTargetAttachmentImpl(InventoryMode.PREDICTIVE, target, item);
799 }
800
801 override bool LocalTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
802 {
803 return TakeEntityToTargetAttachmentImpl(InventoryMode.LOCAL, target, item);
804 }
805
806 override bool ServerTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
807 {
808 return TakeEntityToTargetAttachmentImpl(InventoryMode.SERVER, target, item);
809 }
810
811 protected bool TakeEntityToTargetAttachmentImpl (InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
812 {
814 if( target.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.ATTACHMENT, il) )
815 {
816 return TakeEntityToTargetAttachmentExImpl(mode, target, item, il.GetSlot());
817 }
818 return false;
819 }
821
824 {
825 return TakeToDstImpl(InventoryMode.JUNCTURE, src, dst);
826 }
827
828 override bool PredictiveTakeToDst (notnull InventoryLocation src, notnull InventoryLocation dst)
829 {
830 if (!ScriptInputUserData.CanStoreInputUserData())
831 {
832 Print("[inv] " + GetSimulationTimeStamp() + " Man@" + this + " ::PredictiveTakeToDst input data not sent yet, cannot allow another input action");
833 return false;
834 }
835
836 if (NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
837 return JunctureTakeToDst(src, dst);
838 else
839 return TakeToDstImpl(InventoryMode.PREDICTIVE, src, dst);
840 }
841
842 override bool LocalTakeToDst (notnull InventoryLocation src, notnull InventoryLocation dst)
843 {
844 return TakeToDstImpl(InventoryMode.LOCAL, src, dst);
845 }
846
847 override bool ServerTakeToDst (notnull InventoryLocation src, notnull InventoryLocation dst)
848 {
849 return TakeToDstImpl(InventoryMode.SERVER, src, dst);
850 }
851
852 protected bool TakeToDstImpl (InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
853 {
854 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " ::Take2Dst(" + typename.EnumToString(InventoryMode, mode) + ") src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
855 bool code = GetHumanInventory().TakeToDst(mode, src, dst);
857 return code;
858 }
861
863 {
864
865 }
866
867 override bool CanBeSkinned()
868 {
869 return !GetIsFrozen();
870 }
871
872 override bool DisableVicinityIcon()
873 {
874 return true;
875 }
876
878
881
884 proto native bool StatRegister( string name );
886
889 proto native float StatGet( string name );
891
895 proto void StatGetCounter( string name, out string value );
897
901 proto void StatGetAsTime( string name, out string value );
903
907 proto native void StatUpdate( string name, float value );
909
913 proto native void StatUpdateByTime( string name );
915
919 proto native void StatUpdateByPosition( string name );
921
925 proto native void StatUpdateByGivenPos( string name, vector pos );
929 proto native void StatInvokeUpdate();
933 proto native void StatSyncToClient();
935
937 {
938 return false;
939 }
940
941 void SetInventorySoftLock(bool status);
942
945 {
946 return Transport.Cast(GetParent()) != null;
947 }
948
950 bool PhysicalPredictiveDropItem(EntityAI entity, bool heavy_item_only = true);
951 void SetProcessUIWarning(bool state);
952 void OnGameplayDataHandlerSync(); //depricated, sync now happens before the player is created, calling of this event still happens for legacy reasons
954
962 {
963 return null;
964 }
965};
void syncDebugPrint(string s)
Definition debug.c:1
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
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:317
override bool ServerTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Definition man.c:806
proto native void StatUpdateByTime(string name)
Updates stat counter by time.
override bool PredictiveTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition man.c:828
override bool LocalTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:646
override bool PredictiveTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:362
override bool LocalTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition man.c:842
override bool PredictiveTakeEntityAsAttachment(notnull EntityAI item)
Definition man.c:440
bool JunctureTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
to target cgo ex juncture
Definition man.c:661
ref ScriptInvoker m_OnItemAddedToHands
Definition man.c:77
bool JunctureTakeEntityAsAttachment(notnull EntityAI item)
as att juncture
Definition man.c:435
bool TakeEntityToCargoImpl(InventoryMode mode, notnull EntityAI item)
Definition man.c:425
bool ServerReplaceItemInHandsWithNewElsewhere(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:350
override bool PredictiveTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Definition man.c:479
void UpdateInventoryMenu()
bool JunctureTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
to target cgo juncture
Definition man.c:700
bool LocalReplaceItemElsewhereWithNewInHands(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:305
override bool PredictiveDropEntity(notnull EntityAI item)
Definition man.c:118
override bool ServerTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Definition man.c:724
override bool ServerTakeEntityToCargo(notnull EntityAI item)
Definition man.c:420
bool JunctureDropEntity(notnull EntityAI item)
drop juncture
Definition man.c:113
bool LocalReplaceItemInHandsWithNewElsewhere(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:345
ScriptInvoker GetOnItemAddedToHands()
Definition man.c:81
bool IsInventorySoftLocked()
Definition man.c:936
void SetInventorySoftLock(bool status)
override bool PredictiveTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:611
bool LocalReplaceItemInHandsWithNew(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:325
override bool LocalTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:376
bool IsInTransport()
returns true if man is in transport, false otherwise
Definition man.c:944
proto native void StatSyncToClient()
override bool ServerTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Definition man.c:767
bool ServerSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Definition man.c:539
array< InventoryItem > OnDrawOptics2D()
Definition man.c:961
override bool LocalTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Definition man.c:493
void LocalDestroyEntityInHands()
Definition man.c:215
override bool PredictiveTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Definition man.c:748
void JunctureTakeEntityToHands(notnull EntityAI item)
hand juncture
Definition man.c:158
bool SwapEntitiesImpl(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
Definition man.c:544
override bool ServerTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:381
bool ReplaceItemWithNewImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
!hand -> !hand replace
Definition man.c:277
bool JunctureTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
as att ex juncture
Definition man.c:474
bool ReplaceItemElsewhereWithNewInHandsImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
!hand replace -> hand
Definition man.c:297
void TakeEntityToHandsImpl(InventoryMode mode, EntityAI item)
Definition man.c:187
bool ServerReplaceItemWithNew(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:290
override bool LocalTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Definition man.c:762
proto native float StatGet(string name)
Gets counter value of the specified stat type.
void OnItemInHandsChanged()
Definition man.c:153
override bool LocalTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Definition man.c:801
override bool PredictiveTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Definition man.c:705
override bool PredictiveTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Definition man.c:787
bool PredictiveForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Definition man.c:566
bool JunctureSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
swap juncture
Definition man.c:513
bool JunctureTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
to target inv juncture
Definition man.c:606
proto native void StatInvokeUpdate()
override bool CanBeSkinned()
Definition man.c:867
void ServerTakeEntityToHands(EntityAI item)
Definition man.c:182
void LocalTakeEntityToHands(EntityAI item)
Definition man.c:177
bool TakeEntityAsAttachmentExImpl(InventoryMode mode, notnull EntityAI item, int slot)
Definition man.c:503
override bool CanDropEntity(notnull EntityAI item)
Definition man.c:151
override bool ServerTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition man.c:685
bool LocalSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Definition man.c:534
void EEItemIntoHands(EntityAI item)
Definition man.c:98
bool PhysicalPredictiveDropItem(EntityAI entity, bool heavy_item_only=true)
void StopDeathDarkeningEffect()
bool PredictiveTakeOrSwapAttachment(notnull EntityAI item)
Definition man.c:625
proto void StatGetCounter(string name, out string value)
Gets counter value as string of the specified stat type.
override bool DisableVicinityIcon()
Definition man.c:872
bool JunctureTakeEntityToCargo(notnull EntityAI item)
to cgo juncture
Definition man.c:396
bool TakeEntityToTargetAttachmentExImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item, int slot)
Definition man.c:772
bool JunctureTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
to inv juncture
Definition man.c:357
bool ServerReplaceItemElsewhereWithNewInHands(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:310
bool LocalForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Definition man.c:582
bool JunctureTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
to target att ex juncture
Definition man.c:743
bool JunctureTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
to dst juncture
Definition man.c:823
bool ForceSwapEntitiesImpl(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Definition man.c:592
override bool ServerTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition man.c:847
proto native bool StatRegister(string name)
override bool LocalTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition man.c:680
bool TakeToDstImpl(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
Definition man.c:852
bool JunctureTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
to target att juncture
Definition man.c:782
bool ServerForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
Definition man.c:587
override bool LocalTakeEntityAsAttachment(notnull EntityAI item)
Definition man.c:454
override bool LocalTakeEntityToCargo(notnull EntityAI item)
Definition man.c:415
override bool LocalTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Definition man.c:719
override bool ServerDropEntity(notnull EntityAI item)
Definition man.c:137
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:155
bool TakeEntityToTargetAttachmentImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
Definition man.c:811
override bool ServerTakeEntityAsAttachment(notnull EntityAI item)
Definition man.c:459
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:561
bool CanPlaceItem(EntityAI item)
void SetProcessUIWarning(bool state)
ref ScriptInvoker m_OnItemRemovedFromHands
Definition man.c:79
void JunctureDeleteItem(EntityAI item)
Definition man.c:862
bool DropEntityImpl(InventoryMode mode, notnull EntityAI owner, notnull EntityAI item)
Definition man.c:142
bool TakeEntityToTargetCargoImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
Definition man.c:732
bool TakeEntityToTargetCargoExImpl(InventoryMode mode, notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition man.c:690
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:330
override bool ServerTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Definition man.c:498
void PredictiveMoveItemFromHandsToInventory()
ToDo: Old system method. Might should be adjusted to new system at some point.
Definition man.c:223
override bool LocalDropEntity(notnull EntityAI item)
Definition man.c:132
void OnGameplayDataHandlerSync()
void EEItemOutOfHands(EntityAI item)
Definition man.c:105
bool TakeEntityToTargetInventoryImpl(InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:651
ScriptInvoker GetOnItemRemovedFromHands()
Definition man.c:90
void PredictiveTakeEntityToHands(EntityAI item)
Definition man.c:163
override bool PredictiveTakeEntityToCargo(notnull EntityAI item)
Definition man.c:401
bool TakeEntityAsAttachmentImpl(InventoryMode mode, notnull EntityAI item)
Definition man.c:464
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:518
override bool PredictiveTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition man.c:666
bool ReplaceItemInHandsWithNewElsewhereImpl(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
hand replace2
Definition man.c:337
bool LocalReplaceItemWithNew(ReplaceItemWithNewLambdaBase lambda)
Definition man.c:285
bool TakeEntityToInventoryImpl(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
Definition man.c:386
script counterpart to engine's class Inventory
Definition inventory.c:79
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition inventory.c:628
inventory for plain man/human
InventoryLocation.
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
Native class for boats - handles physics simulation.
Definition boat.c:28
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override bool HasFixedActionTargetCursorPosition()
Definition dayzanimal.c:120
override string GetDebugName()
override bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
EPlayerStates
proto native CGame GetGame()
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
FindInventoryLocationType
flags for searching locations in inventory