ID:179200
 
i cant seem to figure this out. i want my character to be able to walk up to an oblect i made (i put a group of the object in a 5x6 square) and click one of them, and have its icon state change and all the others in the group change thier icon states with it at the same time. thx if u can help.
How are they grouped? Do you have a list of the grouped items, or must you check for near objects when it happens?
In response to Shadowdarke
i have an icon called "roof" and it starts with the icon state "out" and they are all grouped in a 5 by 6 square. i want to be able to go up to one and click on it and have them all change to icon state "out" which is blank so that they disapear. i can only get one to disapear at a time so that u have to go up to the building click on a roof square and that one disapears and u have to keep clicking on each one. but i want them all to dissapear at once when u click on one.
In response to Loduwijk
The easiest (but far from best) way would be to look at all the roof obj's within view(5,src) and change all their icon_states to "out".

(The following assumes the roof is an obj. Your post wasn't clear about what atom type they were.)

obj/roof/Click()
for(var/obj/roof/R in view(5,src))
R.icon_state = "out"

There are other better ways to make sure it only flips roof tiles connected to the one you clicked.

For instance, this one will flip all the roof tiles connected to the clicked one, but it's recursive nature may cause massive lag if used on large expanses of roof.

obj/roof
Click()
src.Flood("out")

proc/Flood(IconState)
if(icon_state == IconState) return // already got this one
icon_state = IconState
for(var/direction in list(NORTH,SOUTH,EAST,WEST))
var/turf/T = get_step(src,direction)
if(T) // if there was a turf there
var/obj/roof/R
for(R in T) break // will stop when it finds the first roof in the turf
if(R) R.Flood(IconState)

The best way, in my opinion, would be to create roofed areas as an area atom.

area/roofed
layer = FLY_LAYER
icon = 'roof.dmi'

Click()
icon_state = "out" // changes the icon state for every tile within the area