NOTE: This library is intended for STATIC objects, such as terrain or decorations, NOT for things that will be moving around, like blobs.
Each atom gets a new variable called 'autojoin', which can be set to either 13, 16 or 47 depending on the kind of joining that you want for that object.
turf/cave_walls
icon = 'cave_walls.dmi'
icon_state = "13"
autojoin = 13
Aside from that, all that's left is to determine what each object wants to join to. Do they join with the edge of the map? Do they join to other objects of their own type? Do they join to objects with a specific attribute? You can decide what each object joins to by overriding the atom.JoinMatch(direction) function, like this:
turf/river
icon_state = "river.dmi"
icon_state = "16"
autojoin = 16
JoinMatch(direction)
var/step = get_step(src, direction)
// Return 1 if you want to join with the edge.
if(!step)
return 1
// Do you want to join with turfs of same type?
if(step.type == src.type)
return 1
// Join with other turfs using the 'water' attribute.
if(findtext(step.attributes, "water"))
return 1
// Don't join with anything.
return 0
You can also view Autojoining.dm to see how the default JoinMatch function is arranged.
Once you've decided which objects will be autojoining and which other objects they'll be joining to, then you're all set and the library will take care of the rest.
http://www.byond.com/members/Tsfreaks/files/asdf.PNG
I assume you know this. Very cool. I will most certainly find uses for this.