720 {
722
723 if (!selectedEntity || !targetEntity)
724 return InventoryCombinationFlags.NONE;
725
728
729
730 ActionManagerClient amc = ActionManagerClient.Cast(player.GetActionManager());
731
732 if (relevantFlags & InventoryCombinationFlags.PERFORM_ACTION)
733 {
735 return InventoryCombinationFlags.PERFORM_ACTION;
736 }
737
738 if (relevantFlags & InventoryCombinationFlags.SET_ACTION)
739 {
741 return InventoryCombinationFlags.SET_ACTION;
742 }
743
744 if (relevantFlags & InventoryCombinationFlags.COMBINE_QUANTITY2)
745 {
746 if (targetEntity.CanBeCombined(selectedEntity))
747 {
748 return InventoryCombinationFlags.COMBINE_QUANTITY2;
749 }
750 }
751
752 if (relevantFlags & InventoryCombinationFlags.ADD_AS_ATTACHMENT)
753 {
754 if (targetEntity.GetInventory().CanAddAttachment(selectedEntity))
755 {
756 return InventoryCombinationFlags.ADD_AS_ATTACHMENT;
757 }
758 }
759
760 if (relevantFlags & InventoryCombinationFlags.ADD_AS_CARGO)
761 {
762 if (!targetEntity.GetInventory().HasEntityInInventory(selectedEntity) && targetEntity.GetInventory().CanAddEntityInCargo( selectedEntity, selectedEntity.GetInventory().GetFlipCargo() ))
763 {
764 return InventoryCombinationFlags.ADD_AS_CARGO;
765 }
766 }
767
768 if (relevantFlags & InventoryCombinationFlags.SWAP_MAGAZINE)
769 {
770 Magazine mag = Magazine.Cast(targetEntity);
771 Weapon_Base wpn = Weapon_Base.Cast(targetEntity.GetHierarchyParent());
772 if (wpn && mag)
773 {
774 if (player.GetWeaponManager().CanSwapMagazine(wpn, Magazine.Cast(selectedEntity)))
775 {
776 return InventoryCombinationFlags.SWAP_MAGAZINE;
777 }
778 }
779 }
780
781 if (relevantFlags & InventoryCombinationFlags.SWAP)
782 {
783 if (GameInventory.CanSwapEntitiesEx(selectedEntity, targetEntity))
784 {
785 return InventoryCombinationFlags.SWAP;
786 }
787 }
788
789 if (relevantFlags & InventoryCombinationFlags.FSWAP)
790 {
791 if (GameInventory.CanForceSwapEntitiesEx(selectedEntity, null, targetEntity, dst))
792 {
793 return InventoryCombinationFlags.FSWAP;
794 }
795 }
796
797 return InventoryCombinationFlags.NONE;
798 }
class GP5GasMask extends MaskBase ItemBase
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
proto native CGame GetGame()