791 {
792 int flags = 0;
795
796 if (!entity1 || !entity2) return flags;
797
798 Magazine swapmag1;
799 Magazine swapmag2;
800 bool skipSwap = false;
801
802 if (Class.CastTo(swapmag1, entity1) && Class.CastTo(swapmag2, entity2))
803 {
804 Weapon_Base parentWpn;
805
806 if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
807 {
808 skipSwap = true;
810 flags = flags | InventoryCombinationFlags.SWAP;
811 }
812
813 if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
814 {
815 skipSwap = true;
817 flags = flags | InventoryCombinationFlags.SWAP;
818
819 }
820 }
821
822 if ( !skipSwap )
823 {
824 if (entity1 ==
m_player.GetHumanInventory().GetEntityInHands() ) flags = flags | InventoryCombinationFlags.TAKE_TO_HANDS;
825 else if (GameInventory.CanSwapEntitiesEx( entity1, entity2 ))
826 {
827 if (!entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ))
828 {
829 flags = flags | InventoryCombinationFlags.SWAP;
830 }
831 }
832 }
833
835 {
837 if (ent1.
CanBeCombined(
ItemBase.Cast( entity2 ) )) flags = flags | InventoryCombinationFlags.COMBINE_QUANTITY2;
838 }
839
840 else if (entity1.GetInventory().CanAddAttachment( entity2 ))
841 {
842 if (!entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ) && !entity2.IsInherited( ZombieBase ) && !entity2.IsInherited( Car ))
843 {
844 flags = flags | InventoryCombinationFlags.ADD_AS_ATTACHMENT;
845 }
846 }
847 if (!entity1.GetInventory().HasEntityInInventory(entity2) && entity1.GetInventory().CanAddEntityInCargo( entity2, entity2.GetInventory().GetFlipCargo() )) flags = flags | InventoryCombinationFlags.ADD_AS_CARGO;
848
849 if (entity1 ==
m_player.GetHumanInventory().GetEntityInHands() || entity2 ==
m_player.GetHumanInventory().GetEntityInHands())
850 {
851 ActionManagerClient amc;
852 Class.CastTo(amc,
m_player.GetActionManager());
853 if (entity1 ==
m_player.GetHumanInventory().GetEntityInHands())
854 {
856 {
857 flags = flags | InventoryCombinationFlags.SET_ACTION;
858 }
859 }
860 else
861 {
863 {
864 flags = flags | InventoryCombinationFlags.SET_ACTION;
865 }
866 }
867 }
868
870 {
871 flags = flags | InventoryCombinationFlags.RECIPE_ANYWHERE;
872 }
873 return flags;
874 }
class GP5GasMask extends MaskBase ItemBase
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
WeaponManager GetWeaponManager()
int GetRecipeCount(bool recipe_anywhere, EntityAI entity1, EntityAI entity2)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
bool CanSwapMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
proto native CGame GetGame()