Module:Items: Difference between revisions

Added p._canItemUseSlot
(Slightly changed formatting on provided runes)
(Added p._canItemUseSlot)
Line 36: Line 36:
function p.getItems(checkFunc)
function p.getItems(checkFunc)
     return GameData.getEntities('items', checkFunc)
     return GameData.getEntities('items', checkFunc)
end
function p._canItemUseSlot(item, equipSlot)
--Function to easily check if an item can fit in a given equipment slot
--Ex: p._canItemUseSlot({Bronze Platebody}, 'Platebody') returns true
if type(item) == 'string' then
item = p.getItem(item)
end
return item.validSlots ~= nil and Shared.contains(item.validSlots, equipSlot)
end
end