ID:1492784
 
(See the best response by Kaiochao.)
Problem description:

So, my problem here is.. I'm thinking of setting up a new type of atom used for grouping turfs into rooms. In this case, I'm going to be using them to display roofs which cover the entire building until it's entered. However, I'm a little lost on how I might mimic an area's way of setting an icon and having it cover all the turfs located within the area.

My question is, can anyone give me any insight on how to go about this? I'll need to use images for the roof's appearance, so I can just add and remove them from a client's view when they enter / exit the room.

Best response
You might try studying Region, by Forum_account.

Essentially, there's not really any way to exactly mimic the "multi-tile" behavior of areas. You'll just have to settle for a for() loop to loop through all turfs in a list, where that list isn't the contents of an /area object.
In response to Kaiochao
I checked into that one, but didn't see any solution to the multi-tile icon thing, at least not from a glance. I'd imagine I could do this with loops and manually placing images.

I suppose I could generate the images when the room is created and attach them to the turfs in question, although I'm a little confused on displaying them to users. Would I output the images to the entire world, or would I output them on some event?

Trying to think of an efficient way of doing this without bogging the server down with tons of loops and checks.
In response to Kitsueki
Well, it sounds like you want a roof system similar to the roof demo included in the library. Did you run into any issues with that when you checked it out?
Ah, I see. It's even setup to allow an icon to be assigned to the roof region for use as the image. This does appear to be what I need. There are a couple parts in the code I don't really get the purpose of though;

        proc
hide(mob/m)

// keep track of whether or not the region is shown to this player
visible[m] = 0

// remove the image from all turfs in the region
for(var/turf/t in turfs)
var/d = get_dist(m, t)

if(d < world.view * 2)
spawn(d * world.tick_lag)
if(!visible[m])
m.client.images -= t.roof
else
m.client.images -= t.roof

show(mob/m)
visible[m] = 1

for(var/turf/t in turfs)
var/d = world.view - get_dist(m, t)

if(d > 0)
spawn(d * world.tick_lag)
if(visible[m])
m.client.images += t.roof
else
m.client.images += t.roof


In the get_dist() part, what exactly is it used for? I see the code, but I don't get the logic of it.

Looks like it's doing some kind of delay and making sure the mob in question is still supposed to see/not see the roof.

Edit: I see that it's using the distance in the delay calculation, which makes it do that gradual fade in/out effect.