mob/var/list/Overlys = list()
mob
proc
Add_Overlays(obj/o)
if(!o) return
src.Overlys += o
src.Refresh_Overlays()
Del_Overlays(obj/o)
if(!o||!Overlys.Find(o)) return 0
src.Overlys -= o
src.Refresh_Overlays()
Refresh_Overlays()
src.overlays = null
for(var/I in Overlys)
src.overlays += image(I)
mob
var
list/clones = list()
verb
Make_Copy(mob/M in oview(5))
usr.clones += M
Become_Person(mob/M in clones)
usr.Overlys = null
for(var/I in M.Overlys) // also tryed var/obj/I if that matters.
usr.Overlys += I
spawn(1) usr.Refresh_Overlays()
Problem description:
This is a tiny bit of code that i put togheter to make a clone ability, now.. my game is set in a way that the players overlays are handeled trough a list called Overlys.(as shown). So i thought i could just make a for loop and add the player in "clones" overlys to the player trying to clone's overlys, and that way "copy" it.
This however doesn't seem to be working, allthough i have not tested it under "good conditions".
My own guess would be that adding M to clones does not add what i think it adds.
Oh and while im at it, When i wear shirts etc.. the walking stuff is allright, but when flicking the "punch" the shirt acts as if it does not have a "punch" icon_state by dissapearing really quick, yet there is a "punch" icon_state. any reasons to why this might be happening?
But since we know for a while that it's possible to interact with (but not modify) the contents of the under/overlays list, you most likely don't need any such contrived backup-Overlays-list anymore at all. I may come up with a library sometime for clean under/overlays usage.
Lastly, since what the overlays var contains is really a /list object, if you want to copy overlays from one atom to the other, you can just set their one atom's overlays var to the other's.
In a normal situation, that would make both atoms' vars refer to the same list object. Therefore when you change this list through any of them, the changes will appear on both atoms, since they both have the same list. So if you don't want that, you would've had to use Copy() so both atoms have separate lists.
However, we're dealing with a special built-in var here. All built-in lists (and their vars) are special in one way or another.
You can't actually modify the value of the overlays var. If you try to, it will seem to work, but DM just "tricks" you by working around the limitation. If you try to set the overlays var to a different list, DM will simply empty the existing list in the overlays var, then add the different-list's contents to it. So since you still end up with the original overlays list intact, there are still 2 separate lists, you don't have to Copy().