public static bool CanPutItemToSlot(UISlotObject proposedSlotInfo) { if (proposedSlotInfo.IsEmpty() || !SendUpdateAllowed(proposedSlotInfo.SlotContents)) { return(false); } UI_ItemSlot uiItemSlot = InventorySlots[proposedSlotInfo.Slot]; PlayerScript lps = PlayerManager.LocalPlayerScript; if (!lps || lps.canNotInteract() || uiItemSlot == null || uiItemSlot.IsFull || !uiItemSlot.CheckItemFit(proposedSlotInfo.SlotContents)) { return(false); } return(true); }
public static bool CanPutItemToSlot(UISlotObject proposedSlotInfo) { if (proposedSlotInfo.IsEmpty() || !SendUpdateAllowed(proposedSlotInfo.SlotContents)) { return(false); } InventorySlot invSlot = InventoryManager.GetSlotFromUUID(proposedSlotInfo.SlotUUID, false); PlayerScript lps = PlayerManager.LocalPlayerScript; if (!lps || lps.canNotInteract() || invSlot.Item != null) { return(false); } UI_ItemSlot uiItemSlot = InventorySlotCache.GetSlotByUUID(invSlot.UUID); if (uiItemSlot == null) { //Could it be a storage obj that is closed? ItemSize checkMaxSizeOfStorage; if (SlotIsFromClosedBag(invSlot, out checkMaxSizeOfStorage)) { var itemAtts = proposedSlotInfo.SlotContents.GetComponent <ItemAttributes>(); if (itemAtts != null) { if (itemAtts.size <= checkMaxSizeOfStorage) { return(true); } } } return(false); } if (!uiItemSlot.CheckItemFit(proposedSlotInfo.SlotContents)) { return(false); } return(true); }