ID:139673
 
Code:
turf
name = ""
New()
..()
spawn(13)
src.icon = turn(src.icon, pick(0,90,180,270))


Problem description:

Is this too much for BYOND to handle on New()? It makes my turfs look much better although now I cant even Run after compile.
You are creating a new icon for every single turf in your world. For example, a 100x100 map would create 10,000 new icons.

You need to cache those icons so only one of each is generated.
In response to DarkCampainger
Ok, how would I go about caching my icons?
In response to Slic3y
Slic3y wrote:
Ok, how would I go about caching my icons?

Here's your original code:
turf
name = ""
New()
..()
spawn(13)
src.icon = turn(src.icon, pick(0,90,180,270))


Problem: You are generating a new icon for every turf, instead of using a pre-existing one or saving the result to a variable and reusing it.

Your solution could be to pre-generate three extra icons for each unique turf type---one for each step in your rotation---but come on man, all you're doing is making 90-degree turns. Just go into your icon files and make them into directional icons. Give them a NORTH/SOUTH/EAST/WEST icon and in turf/New(), just change src.dir.

Alternatively, you could just do this whole randomizing process once and save the result, map the whole thing accordingly (perhaps via automation), and save yourself all of the calculations from then on.
In response to Kuraudo
Rather than messing with turn and everything... Why don't you just have 4 icon states for each dir, and then use a pick Like this
turf/Grass/New(){icon_state = pick("North","South","East","West")}

That way, it's a new experience every time ya play! :D
I tested it out, and it works really nicely.
In response to Yurokei
It would make even more sense to just use a directional icon state and change the dir of the turf.
In response to Garthor
Ohhh! So could you just replace icon with dir? Like
turf/Grass/New(){dir = pick(NORTH,SOUTH,EAST,WEST)}
In response to Yurokei
Sounds good, I think Ill just make some directional turfs.