625 {
627 if ( m_am_entity1 == null || m_am_entity2 == null ) return;
628
629 if ( combinationFlags == InventoryCombinationFlags.NONE ) return;
630
631 if ( combinationFlags & InventoryCombinationFlags.LOAD_CHAMBER )
632 {
633 Magazine mag;
634 if ( Class.CastTo(mag, m_am_entity2 ) )
635 {
637 return;
638 }
639 }
640
641 if ( combinationFlags & InventoryCombinationFlags.ADD_AS_ATTACHMENT )
642 {
644 {
645 m_Body.RemoveItem(
m_Atts.GetWrapper() );
647 }
648 if( m_am_entity2.GetSlotsCountCorrect() > 0 )
649 {
650 m_Atts =
new Attachments(
this, m_am_entity2 );
651 m_Atts.InitAttachmentGrid( 1 );
652
653 }
654
657
658 Weapon_Base wpn1;
659 Magazine mag1;
660 if ( Class.CastTo(wpn1, m_am_entity1 ) && Class.CastTo(mag1, m_am_entity2 ) )
661 {
663 {
665 return;
666 }
667 }
668
669 SplitItemUtils.TakeOrSplitToInventory(
m_player, m_am_entity1, m_am_entity2);
670
671 }
672
673 if ( combinationFlags & InventoryCombinationFlags.ADD_AS_CARGO )
674 {
675 m_player.PredictiveTakeEntityToTargetCargo( m_am_entity1, m_am_entity2 );
676 }
677
678 if ( combinationFlags & InventoryCombinationFlags.SWAP )
679 {
680 Magazine swapmag1;
681 Magazine swapmag2;
682 if (Class.CastTo(swapmag1, m_am_entity1) && Class.CastTo(swapmag2, m_am_entity2 ) )
683 {
685 {
687 return;
688 }
689
691 {
693 return;
694 }
695 }
696 if ( !
m_player.PredictiveSwapEntities( m_am_entity1, m_am_entity2 ) &&
m_player.GetHumanInventory().CanAddEntityInHands( m_am_entity1 ) )
697 {
698 m_player.PredictiveTakeEntityToHands( m_am_entity1 );
699 }
700 }
701
702 if ( combinationFlags & InventoryCombinationFlags.TAKE_TO_HANDS )
703 {
705 {
706 m_Body.RemoveItem(
m_Atts.GetWrapper() );
708 }
709
710 if ( m_am_entity2.GetSlotsCountCorrect() > 0 )
711 {
712 m_Atts =
new Attachments(
this, m_am_entity2 );
713 m_Atts.InitAttachmentGrid( 1 );
714
715 }
718
719 if (
m_player.GetHumanInventory().CanAddEntityInHands( m_am_entity2 ) )
720 {
721 m_player.PredictiveTakeEntityToHands( m_am_entity2 );
722 }
723 }
724 }
WeaponManager GetWeaponManager()
bool CanAttachMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
bool AttachMagazine(Magazine mag, ActionBase control_action=NULL)
bool LoadBullet(Magazine mag, ActionBase control_action=NULL)
bool CanSwapMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
bool SwapMagazine(Magazine mag, ActionBase control_action=NULL)
proto native CGame GetGame()