ID:915010
 
Code:
obj
Clothes
Click()
var/nname
if(loc == usr)
nname = name
name = null
if(!equipped)
usr.overlays += src
equipped = 1
else
usr.overlays -= src
equipped = 0
name = nname
layer = MOB_LAYER + 1
var
equipped = 0


Problem description:

Hey! I followed DarkCampainger's idea about the overlay references, and it worked great for what I was thinking, until I was messing around and relogged. The overlays are saved, and so when I reloaded I found they were bugged.. (Assuming the references were reloaded, and thus are incorrect because they now have the names.)

I'm thinking this may be something which can be worked around, but I'm not quite sure if it's worth going after, or if finding/creating a new way to display clothing and such is more beneficial.

Overlays just seem so buggy..

Don't save the overlays. Save a list of what you had in your overlays, then pop them back on when you load.
Don't store any visual information like overlays. Instead store information that can be used to recreate it. Either keep a list of the items the player has equipped like so:

mob/var/list/equipped_items = list( "head", "arms", "legs" )
// In various procs:
equipped_items["head"] = Derp_Helmet
equipped_items["arms"] = HandsnFingers


or

You could just run through the mob's contents and add any equipped items to their overlays.