626 {
628 if ( m_am_entity1 == null || m_am_entity2 == null ) return;
629
630 if ( combinationFlags == InventoryCombinationFlags.NONE ) return;
631
632 if ( combinationFlags & InventoryCombinationFlags.LOAD_CHAMBER )
633 {
634 Magazine mag;
635 if ( Class.CastTo(mag, m_am_entity2 ) )
636 {
638 return;
639 }
640 }
641
642 if ( combinationFlags & InventoryCombinationFlags.ADD_AS_ATTACHMENT )
643 {
645 {
646 m_Body.RemoveItem(
m_Atts.GetWrapper() );
648 }
649 if( m_am_entity2.GetSlotsCountCorrect() > 0 )
650 {
651 m_Atts =
new Attachments(
this, m_am_entity2 );
652 m_Atts.InitAttachmentGrid( 1 );
653
654 }
655
658
659 Weapon_Base wpn1;
660 Magazine mag1;
661 if ( Class.CastTo(wpn1, m_am_entity1 ) && Class.CastTo(mag1, m_am_entity2 ) )
662 {
664 {
666 return;
667 }
668 }
669
670 SplitItemUtils.TakeOrSplitToInventory(
m_player, m_am_entity1, m_am_entity2);
671
672 }
673
674 if ( combinationFlags & InventoryCombinationFlags.ADD_AS_CARGO )
675 {
676 m_player.PredictiveTakeEntityToTargetCargo( m_am_entity1, m_am_entity2 );
677 }
678
679 if ( combinationFlags & InventoryCombinationFlags.SWAP )
680 {
681 Magazine swapmag1;
682 Magazine swapmag2;
683 if (Class.CastTo(swapmag1, m_am_entity1) && Class.CastTo(swapmag2, m_am_entity2 ) )
684 {
686 {
688 return;
689 }
690
692 {
694 return;
695 }
696 }
697 if ( !
m_player.PredictiveSwapEntities( m_am_entity1, m_am_entity2 ) &&
m_player.GetHumanInventory().CanAddEntityInHands( m_am_entity1 ) )
698 {
699 m_player.PredictiveTakeEntityToHands( m_am_entity1 );
700 }
701 }
702
703 if ( combinationFlags & InventoryCombinationFlags.TAKE_TO_HANDS )
704 {
706 {
707 m_Body.RemoveItem(
m_Atts.GetWrapper() );
709 }
710
711 if ( m_am_entity2.GetSlotsCountCorrect() > 0 )
712 {
713 m_Atts =
new Attachments(
this, m_am_entity2 );
714 m_Atts.InitAttachmentGrid( 1 );
715
716 }
719
720 if (
m_player.GetHumanInventory().CanAddEntityInHands( m_am_entity2 ) )
721 {
722 m_player.PredictiveTakeEntityToHands( m_am_entity2 );
723 }
724 }
725 }
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()