bool IInventoryController.CanEquip(Slots slot, IEntity entity, bool flagsCheck) { var slotMask = SlotMasks[slot]; if ((slotMask & (SlotFlags.POCKET | SlotFlags.IDCARD)) != SlotFlags.NONE) { // Can't wear stuff in ID card or pockets unless you have a uniform. if (_inventory.GetSlotItem(Slots.INNERCLOTHING) == null) { return(false); } if (slotMask == SlotFlags.POCKET) { var itemComponent = entity.GetComponent <ItemComponent>(); // If this item is small enough then it always fits in pockets. if (itemComponent.ObjectSize <= (int)ReferenceSizes.Pocket) { return(true); } } } // Standard flag check. return(flagsCheck); }
bool IInventoryController.CanEquip(Slots slot, IEntity entity, bool flagsCheck, out string reason) { var slotMask = SlotMasks[slot]; reason = null; if ((slotMask & (SlotFlags.POCKET | SlotFlags.IDCARD)) != SlotFlags.NONE) { // Can't wear stuff in ID card or pockets unless you have a uniform. if (_inventory.GetSlotItem(Slots.INNERCLOTHING) == null) { reason = Loc.GetString(slotMask == SlotFlags.IDCARD ? "You need a uniform to store something in your ID slot!" : "You need a uniform to store something in your pockets!"); return(false); } if (slotMask == SlotFlags.POCKET) { var itemComponent = entity.GetComponent <ItemComponent>(); // If this item is small enough then it always fits in pockets. if (itemComponent.ObjectSize <= (int)ReferenceSizes.Pocket) { return(true); } else if (!flagsCheck) { reason = Loc.GetString("This is too large!"); } } } // Standard flag check. return(flagsCheck); }