Turf Edges

by Forum_account
Turf Edges
Automatically generates edge icons for turfs and places them on the map.
ID:297358
 
This demo contains code to generate edge icons for turfs and to automatically place them on the map. It generates an 8-directional edge icon for each icon state. You can specify a custom mask icon to determine how exactly one turf will blend into the next.

Here's an example. This is the map without edges:



And this is the same map with the edges generated by this demo:



All you have to do is generate the edge icon state and set the edge_layer var for each turf.
Dude. You are a savior. This is very useful for a project I'm working on.
In response to Branks
Branks wrote:
Dude. You are a savior. This is very useful for a project I'm working on.

Glad to hear!
Forum_account, you are doing fantastic job! Whenever I look for some new and good quality libraries and demos, I first go there: http://www.byond.com/members/Forumaccount?tab=creations

So beautiful like most of your contributions, forum_account. Thank you.
I just updated the demo to change the way edges are added. The old code is still in there, it's just commented out, in case you want to use the old method. The change removes some redundant edges, for example:

   +---+
| 1 |
+---+
| 2 |
+---+

If you're adding edges around both of those tiles, turf 1 would get edges on 7 sides (all but south) and turf 2 would get edges on all sides but north. The northeast overlay added to turf 2 would overlap turf 1's southeast overlay.

With this update, turf 1 would only get 5 edges (west, northwest, north, northeast, and east) so it doesn't have any overlays that overlap turf 2's edge overlays.

Kisioj wrote:
Forum_account, you are doing fantastic job! Whenever I look for some new and good quality libraries and demos, I first go there: http://www.byond.com/members/Forumaccount?tab=creations

Thanks! That's always good to hear =)
Wow, a really great and useful library. Thanks FA.