I was working on a system to update a player's icon based on what gear the mob was wearing. It was a simple matter of adding an image based on the object to the mob's overlays when the object is worn and remove it when the obj is removed. Then I ran into a problem. When the mob is saved via Deadron's character handling lib and reloaded, the same process to remove the image doesn't seem to work anymore. Why? As far as I can tell
mob.overlays+=image(obj.icon, icon_state="worn")

should be reverted by:
mob.overlays-=image(obj.icon, icon_state="worn")

What am I doing wrong?
You're trying to save overlays as raw images. Save references to the images instead and clear the overlays list before saving, then rebuild after loading from the saved references.
In response to Xooxer
That's what I suspected. The overlays are merged into the icon, yes?
In response to Jmurph
Most likely merged into a single overlay icon, but I'm not sure. I never dug that deep.
In response to Xooxer
Yeah, that's what I meant. Regardless, it's better for savefile space to clear out the overlay and rebuild it....
In response to Jmurph
This might shed some light on the question.