ID:2397012
 
Code:
obj/Roof
appearance_flags =KEEP_TOGETHER
layer=MOB_LAYER+1
icon = 'stssf.dmi'
density = 0
New()
..()
for(var/turf/v in view(1))
v.vis_contents += new src.type
world<<"sucess"
del(src)
Cross()
Hide()
return 1
Uncross()
Show()
return 1
proc
Hide()
world<<"hide"
for(var/obj/v in range(5))
animate(v, alpha = 0, time = 5)
Show()
for(var/obj/v in range(5))
animate(v, alpha = 255, time = 5)


Problem description:Hello, I'm trying to make house Roofs with vis_contents but it's not working the way that I was thinking. It's not adding to the turf vis contents the obj type. What I can do?
Hi, I have seen them and I'm trying to do this exact same effect with vis_contents
according to the author, this method is unacceptable because vis_contents
Just at a glance, you're adding src.type to vis_contents, and not src itself.
In response to Nadrew
hi Nadrew, I already tried
        for(var/turf/v in view(1))
v.vis_contents += src
and for some reason it still dont work :/
You're literally calling del(src) in New(), what do you expect to happen there?
To elaborate: The object has to exist to be visible within vis_contents, if you delete it, it won't have anything to show.
Like I would like to it be on the place where it be created but as a vis_content for the turf,so it will create a roof effect (like if one person enters this way the whole obj will become alpha 0 and not only the one for the client) because this I tried to create a new type.
        for(var/turf/v in view(1))
v.vis_contents += new src
I tried this way but I still cant see the obj
You're still not adding the object properly. You're trying to add a new instance of the object to the tiles, that's probably not ideal since you should only need one copy of the object per structure (if that).

for(var/turf/v in range(1)) // Unless you're relying on opacity, use range() instead of view().
v.vis_contents += src


As long as the roof object exists it should be visible.
In response to Nadrew
Hey nadrew this actually don't worked with New(), but worked with a verb.
mob/verb/AllTurfs()
for(var/turf/v in range(5))
v.vis_contents += new /obj/Roof
But it dont recognize Cross() and Uncross(), it only have a visual effect. I cant even call hide() proc then they're in vis_contents, what I can do?
The name vis_contents literally tells you it's only visual. You'd want your trigger to be a part of the building, not the roof.
In response to Nadrew
Ohhh, I think I've got it
obj/Roof
icon = 'stssf.dmi'
appearance_flags =KEEP_TOGETHER
obj/RoofCheck
icon = null
layer=MOB_LAYER+1
density = 0
New()
..()
src.vis_contents += new /obj/Roof
proc/Hide()

I'm making this way and it's working, but, it's making the Roof going to alpha 0 to every client, and I would like it to become alpha 0 just for the one that's entering in the obj, KEEP_TOGETHER would not make something like this?
You'd have to use images if you wanted to show different things to different clients.
In response to Nadrew
should I make this way but like then call Hide() I create an image for every other client but not for yourself or another inside the roof?