ID:175956
 
turf
New()

for(var/turf/T in world)
if(T.icon_state == "night")
src.icon_state = "night"
else
src.icon_state = ""
What I want is when a New() turf is made, depending on the other turfs if their icon_state = "night" then i want the new turf with the same icon state, but when the other turfs icon_state = "" then i want the New() turf to have the same icon state. Can anyone Help me out? this snippet of code causes DS to crash but there isnt any errors.
Instead of wasting cpu to cycle through every single turf (and setting the icon state of the new turf a hundred times in the process), simply declare a global variable:

var timestate="night"

turf
New()
icon_state=timestate


Then you can change timestate between "" or "night" as you wish, and make a new function to change out all of the turf's icon states when the time changes in your game.

splatty
In response to splattergnome
thanx that worked