This is accomplished by attaching a script to the TileSet which overrides the undocumented _is_tile_bound() virtual method. This method is called (at least) 8 times for each tile, with each of the neighbouring tile IDs, and should return whether those two tiles are considered to be part of the same group of tiles or not.
It turns out that adding this overload only makes autotiling about 10-20% slower, because it's slow anyway.
Example:
extends TileSet
# "tool" makes this also apply when placing tiles by hand in the tilemap editor too.
tool
const BRIDGE = 4
const BRICKS = 5
const CHASM = 6
var binds = {
CHASM: [BRIDGE],
BRIDGE: [BRICKS],
BRICKS: [BRIDGE],
}
func _is_tile_bound(id, neighbour_id):
if id in binds:
return neighbour_id in binds[id]
return false
Just chasm tiles:
Bridge tiles added. Note that the bridge affects the chasm autotiling but not vice-versa.
Brick ground tiles added. Note that the brick and bridge tiles join together.