proc
Equip(mob/m, Equipment/item)
if(item.equipped)
if(m.equipment["[item.slot_type]"])
var/Equipment/e = m.equipment["[item.slot_type]"]
m.overlays -= e.icon
var/type = null
if(item.slot_type == "Accessory")
type = (m.equipment["Accessory 1"]) ? "Accessory 2" :"Accessory 2"
if(type)
m.equipment[type] = item
else
m.equipment["[item.slot_type]"] = item
m.overlays += item.icon
item.overlays+='Equipped.dmi'
else
if(item.type == "Accessory")
if(m.equipment["Accessory 1"] == item)
m.equipment["Accessory 1"] = null
else
m.equipment["Accessory 2"] = null
else
m.equipment["[item.slot_type]"] = null
m.overlays -= item.icon
item.overlays-='Equipped.dmi'
item.equipped = !item.equipped
Problem description:
I am trying to make an equipment system which if an item with a lower layer-precedence than any of the items already overlayed on the mob; it'll move itself underneath the equipment. I know that a way to do this would be to re-adjust the overlays every time something is equipped which sounds very inefficient because, I would need to use a for-loop() to do so. Anyone got any suggestions or algorithms I can use because, I don't know what I need to do.