To create an outline around walls, all you have to do is:
turf
New()
..()
if(density)
var/n = autojoin16("density")
overlays += icon('outline.dmi', "[n]")
The autojoin16() proc checks the density var of each neighbor and returns a number in the 0 .. 15 range based on which neighbors are dense. You can use this value to change the turf's icon_state or add an overlay that creates a visually consistent effect from tile to tile.
For 16 states, the bit values increase in clockwise order starting from the top (top = 1, right = 2, bottom = 4, left = 8). For 256 states, it's clockwise order starting from the top-left (top-left = 1, top = 2, top-right = 4, right = 8, bottom-right = 16, bottom = 32, bottom-left = 64, left = 128). 47-state autojoining uses the same values as 256-state, it just doesn't include all states (ex: there's no state for 2, 3, or 6 - if the 2 bit is set, so are the 1 and 4 bits).
This library also crosses A off the list of letters I didn't have libraries for. I still have B, C, E, G, J, L, N, Q, U, X, Y, and Z left, if anyone can think of a topic for one of those letters. I'm afraid I'll have to make xylophone, yo-yo, and zebra libraries =)