So I recently switched all of my overlay adding to this system:
var/list
Overlays=list()
Underlays=list()
atom/proc/update()
overlays=null; underlays=null
for(var/i in Overlays) overlays+=i
for(var/i in Underlays) underlays+=i
And for all of my testing purposes, that was great. However it wasn't until I started hosting my game the silly error inside showed its ugly head. Everybody in the game who runs update() gets the overlays in Overlays, because I coded it as a world list. -.-
My question is how would I go about transfering it to suit an individuals needs? Obviously I would think the Overlays and Underlays lists would become mob/var/lists, but I get lost when it comes to update(). Would it be along the lines of
atom/proc/update()
var/list/Overlays=list()
for(var/i in src.overlays)
Overlays+=i
overlays=null; src.overlays+=Overlays
The above code does not work but that's what my mind think would be an answer.
Problem description:
And there's really no reason at all to do what you're doing, except I guess not actually understanding the overlays list. You don't need to remove and then re-add everything every time you add or remove just one thing.