I want to do this for day and night and maybe for tides rising and falling. Previously I ran into problems adding day and night because turfs that had a turf on them, for example a floor turf with a chair on the floor would not get changed when I did a for(var/turf/t in world), only the chair would change.
I was wondering as far as memopry usage goes, if there are any pros or cons to starting the day night cycle in turf/New() as I did below.
turf
New()
..()
if(z==1)
Daynight()
proc
Daynight()
if(icon=='dayturf.dmi')
icon='nightturf.dmi'
if(icon=='nightturf.dmi')
icon='dayturf.dmi'
spawn(50000)
Daynight()
ID:152030
May 8 2008, 8:38 am
|
|
In response to Popisfizzy
|
|
Here's a trick.
If your using turfs, or something with a single state. Make DAY the NORTH state, NIGHT the SOUTH state. Then simply change the direction of all of the turfs. This makes it a lot faster because the icons are already cached. |
Personally, I would make it more like this:
With this method, you would simply use the instance editor to set on the cycle_state variable for turfs on the first z-level, which is much nicer than having an if to determine that.