ID:138846
 
So currently I have a map with 3 islands made of the turf grass with a sand edge to them. Where the grass and sand meet I would like those tiles to be replaced with a tile that merges the two. I have the tiles and I could manually go through the entire map to place them but I would like them to be updated on run-time instead.

I understand this would use world/New() but I'm having trouble checking what directions sand can be found in.

For example :

var/turf/Grass = /turf/Grass
for(Grass)
var/South = get_step(Grass,SOUTH)
if(istype(South, /turf/Sand)


I don't believe get_step works with turf for starters and I understand there is a limit to the amount of objects on a map so I can't make them objects. Any ideas on how I can do this? Thanks.
Despa1r wrote:
> var/turf/Grass = /turf/Grass
>

What's that supposed to do? As you've written it, it makes a variable called Grass, which holds a turf, and then stores the path /turf/Grass in it (which isn't a turf, it's the path to a type of turf)
It doesn't even matter what the variable contains, because the for loop overwrites it.

Despa1r wrote:
> for(Grass)
> var/South = get_step(Grass,SOUTH)
> if(istype(South, /turf/Sand)
>


get_step works fine with turfs.

The only thing I can see wrong is that the type of Grass is /turf, not /turf/Grass. If you want a variable called Grass with a type of /turf/Grass, use
var/turf/Grass/Grass


You can also combine the first two lines to make it slightly easier to read:
for(var/turf/Grass/Grass)
var/South = get_step(Grass, SOUTH)
if(istype(South, /turf/Sand))
In response to Immibis
That's the thing, get_step doesn't work with turf.
In response to Despa1r
turf/verb
test1()
var/turf/T = get_step(src,SOUTH)
usr<<"[T.type]"
test2()
var/turf/T = locate(src.x,src.y-1,src.z)
usr<<"[T.type]"

If you try it, both verbs work.
Now, you might ask why get_step didn't work in your code. It's actually very simple, just change
     var/South = get_step(Grass,SOUTH)

to
     var/turf/South = get_step(Grass,SOUTH)

It didn't work because you didn't say South is a turf, so compiler didn't search for it's type var.