mob
proc
Equip(obj/O)
if(!O || !O.slot) return
if(equipment && equipment[O.slot])
Unequip(equipment[O.slot])
if(equipment && equipment[O.slot]) return // unequip failed
if(!equipment) equipment = new
equipment[O.slot] = O
UpdateInventory()
UpdateEquipment()
Unequip(obj/O)
if(!O || !O.slot) return
if(!equipment || equipment[O.slot]!=O) return // failed
equipment -= O.slot
if(!equipment.len) equipment = null // reclaim the list
UpdateInventory()
UpdateEquipment()
obj
verb
Equip()
if(slot) usr.Equip(src)
Unequip()
if(slot) usr.Unequip(src)
I don't know if this really matters but I'll be using icon states for this instead of individual icon files. For example the icon file would be items.dmi and the actual item I want to equip would be in that icon file with the name shirt.
Add the icon or object path to a list, named Overlays (notice the capitalization) or anything. Then when you add to it, it clears overlays and adds everything from that list to your overlays. And whenever you remove anything, you remove it from that list, remove all overlays again and re-apply from the list.
This WAS covered quite a few times, though.