ID:141365
 
Code:
obj/overlay/torchicon

obj/equippable/Torch
equipped = /obj/overlay/torch

mob/proc/Equip(obj/O)
overlays += O.equipped
mob/proc/Unequip(obj/O)
overlays -= O.equipped

(those should be the only relevant pieces of code- I don't think the save system itself is causing the issue, but just in case it's Evi of Au's save system)

Problem description:
The equipment/overlay system works fine except that when I for example equip a torch and then relog, when I unequip the torch its graphic remains on the character and it's impossible to remove. The equipment system continues to work, but the character permanently has that overlay's graphic blotched on.

I tried manually saving without relogging and it caused no issues, which makes sense considering the save system does not do anything with overlays. I've tried quite a few things, but I haven't found an effective way to fix this.

What is the problem, exactly? Is there a way to fix it that wouldn't require rewriting the way the equipment/overlay system works (var representing the overlay object type)?
Try using the forum search. This has been answered a lot of times. The problem lies in the saving of overlays; after overlays is loaded from a savefile you can't remove those overlays individually. You have to work around this, like by not saving overlays at all and instead rebuilding them after the mob is recreated. In this case you could loop through all of the mob's equipped equipment and add their overlays.
In response to Kaioken
Kaioken wrote:
Try using the forum search. This has been answered a lot of times. The problem lies in the saving of overlays; after overlays is loaded from a savefile you can't remove those overlays individually. You have to work around this, like by not saving overlays at all and instead rebuilding them after the mob is recreated. In this case you could loop through all of the mob's equipped equipment and add their overlays.

I've already tried nulling overlays and rebuilding them upon loading the character, but I haven't found an effective way of doing so. I'm bad with lists and loops and stuff. :(

I tried searching, but couldn't find anything that actually relates to this problem. Can you link some of them that might help me with finding a solution?
In response to Zaole
Rebuilding the overlays list works. Nullifying the overlays(overlays=null) will break it, I think. overlays=list() should work.
In response to Kaiochao
Kaiochao wrote:
Rebuilding the overlays list works. Nullifying the overlays(overlays=null) will break it, I think. overlays=list() should work.

I changed my search methods and found a few posts about this (all of which you were in) and got it to work. Thanks. :)

edit: it was one of the Kaios anyways. are you two related?
In response to Zaole
Well, not really. :P
I'll also note for the other Kaio that if you're setting a regular var that contains a list to null instead, then of course you'll indeed need to re-set it to a list object before you can treat it as a list (eg add items to it), but not with the built-in list vars, which are all special and handled internally in various different ways than normal lists (and vars), one of which being they are automagically reset to an empty list for you if you set them to say, null.