801 {
802 int flags = 0;
804
805 if (!entity1 || !entity2)
806 return flags;
807
809 {
812 flags = flags | InventoryCombinationFlags.COMBINE_QUANTITY2;
813 }
814
815 InventoryLocation il = new InventoryLocation();
816
818
819 if (il.
IsValid() && !entity1.GetInventory().FindAttachment(il.
GetSlot()))
820 {
821 if (!entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ) && !entity2.IsInherited( ZombieBase ) && !entity2.IsInherited( Car ))
822 {
823 flags = flags | InventoryCombinationFlags.ADD_AS_ATTACHMENT;
824 }
825 }
826 if (!entity1.GetInventory().HasEntityInInventory(entity2) && entity1.GetInventory().CanAddEntityInCargo( entity2, entity2.GetInventory().GetFlipCargo() )) flags = flags | InventoryCombinationFlags.ADD_AS_CARGO;
827
828 if (entity1 == player.GetHumanInventory().GetEntityInHands() || entity2 == player.GetHumanInventory().GetEntityInHands())
829 {
830 ActionManagerClient amc;
831 Class.CastTo(amc, player.GetActionManager());
832 if (entity1 == player.GetHumanInventory().GetEntityInHands())
833 {
835 {
836 flags = flags | InventoryCombinationFlags.PERFORM_ACTION;
837 }
839 {
840 flags = flags | InventoryCombinationFlags.SET_ACTION;
841 }
842 }
843 else
844 {
846 {
847 flags = flags | InventoryCombinationFlags.PERFORM_ACTION;
848 }
850 {
851 flags = flags | InventoryCombinationFlags.SET_ACTION;
852 }
853 }
854 }
855 return flags;
856 }
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
proto native bool IsValid()
verify current set inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
proto native CGame GetGame()