792 {
793 int flags = 0;
796
797 if (!entity1 || !entity2) return flags;
798
799 Magazine swapmag1;
800 Magazine swapmag2;
801 bool skipSwap = false;
802
803 if (Class.CastTo(swapmag1, entity1) && Class.CastTo(swapmag2, entity2))
804 {
805 Weapon_Base parentWpn;
806
807 if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
808 {
809 skipSwap = true;
811 flags = flags | InventoryCombinationFlags.SWAP;
812 }
813
814 if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
815 {
816 skipSwap = true;
818 flags = flags | InventoryCombinationFlags.SWAP;
819
820 }
821 }
822
823 if ( !skipSwap )
824 {
825 if (entity1 ==
m_player.GetHumanInventory().GetEntityInHands() ) flags = flags | InventoryCombinationFlags.TAKE_TO_HANDS;
826 else if (GameInventory.CanSwapEntitiesEx( entity1, entity2 ))
827 {
828 if (!entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ))
829 {
830 flags = flags | InventoryCombinationFlags.SWAP;
831 }
832 }
833 }
834
836 {
838 if (ent1.
CanBeCombined(
ItemBase.Cast( entity2 ) )) flags = flags | InventoryCombinationFlags.COMBINE_QUANTITY2;
839 }
840
841 else if (entity1.GetInventory().CanAddAttachment( entity2 ))
842 {
843 if (!entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ) && !entity2.IsInherited( ZombieBase ) && !entity2.IsInherited( Car ))
844 {
845 flags = flags | InventoryCombinationFlags.ADD_AS_ATTACHMENT;
846 }
847 }
848 if (!entity1.GetInventory().HasEntityInInventory(entity2) && entity1.GetInventory().CanAddEntityInCargo( entity2, entity2.GetInventory().GetFlipCargo() )) flags = flags | InventoryCombinationFlags.ADD_AS_CARGO;
849
850 if (entity1 ==
m_player.GetHumanInventory().GetEntityInHands() || entity2 ==
m_player.GetHumanInventory().GetEntityInHands())
851 {
852 ActionManagerClient amc;
853 Class.CastTo(amc,
m_player.GetActionManager());
854 if (entity1 ==
m_player.GetHumanInventory().GetEntityInHands())
855 {
857 {
858 flags = flags | InventoryCombinationFlags.SET_ACTION;
859 }
860 }
861 else
862 {
864 {
865 flags = flags | InventoryCombinationFlags.SET_ACTION;
866 }
867 }
868 }
869
871 {
872 flags = flags | InventoryCombinationFlags.RECIPE_ANYWHERE;
873 }
874 return flags;
875 }
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()