/obj/security_monitor
name = "Monitor"
appearance_flags = KEEP_TOGETHER
icon_state = "monitor"
var/image/full_image = new
New()
..()
full_image.appearance_flags = KEEP_TOGETHER
src.full_image = image('stuff.dmi', "crate")
src.overlays += src.full_image
mob/verb/add_contents()
for (var/obj/security_monitor/M in world)
//delete vis_contents contents
M.full_image.vis_contents = null
//populate vis_contents
for (var/i in view(1, src))
if (isturf(i))
M.full_image.vis_contents += i
world << "added"
break
Problem description:
Basically, I'm trying to make a TV screen that will display a group of turfs somewhere else on the map. I thought the easiest way to do so would be to make a TV monitor frame Icon, and add a blank image as an overlay to that object for which I will add the turfs to its vis_contents so that I can offset and scale down the displayed turfs to fit snugly in any sized TV monitor I want to make with a few transforms.
I can't seem to display the vis_contents of the /image when it's added as an overlay to that object, the correct image icon will appear, the crate(placeholder), but not vis_contents.
For explanation purposes, I have a world with a single obj/security_monitor on the map. In the add_contents verb on /mob, I try to add the turfs adjacent to the mob to vis_contents of the /image in that security_monitor object.
It seems like the code executes properly, and the "added" printf displays in the chat log, but the image does not display its vis_contents.
I assume that the problem is that there's some weirdness with displaying something with vis_contents as an overlay. If that's the case I'm really not sure what the best way to do this is, maybe just another blank object to represent the screen and add its vis_contents, but that seemed clunky to me.
Basically with an overlay you're adding an appearance to overlays, not the actual object (though it is stored in the list using a reference to the object), so updates to that object won't be reflected by the one that's in your overlays unless you remove it and add it back, causing an appearance update.
vis_contents doesn't suffer this limitation and it's one of the biggest reasons to use it at all.