was trying to use areas to build a "coarse" pathfinder, but I can't seem to find a way to link areas together to form nodes. Does anyone know of a way to return any different areas that are touching the src area?
|
In response to Kozuma3
|
|
That's kinda what I expected, oh well - I guess i'll have to find an alternative or a workaround (I think I may have one, but it's a bit convoluted)
Thanks! |
In response to Braekyn
|
|
If you want adjacent areas of a contiguous piece of an area, starting with a specific turf, you can use a breadth-first search (flood-fill) with adjacent turfs and compare their areas (turf.loc) with the original.
I think that would be better than looping over turfs in area.contents, which internally is actually a loop over all turfs in the world. Also, the same instance of area can exist in multiple disconnected locations, so a floodfill might be more appropriate for whatever pathfinding you're doing. |
In response to Kaiochao
|
|
That's basically what I ended up doing - starting with every "door", flooding each room and assigning them a room and their adjacent doors to connect nodes
|
After testing around and as described in the reference, each /area object is only created once. The location of said area is the first bottom-left use of it within a map.
I created a 2x2 map, top red, bottom blue.
blue xyz = 1,1,1
red xyz = 1,2,1
No matter where you click said area/turf those coords will be displayed.
A possible work-around would be to at run-time initialize /area's on every tile but I don't know the cost of doing so.