I struggle sometimes at understanding things, if I'm honest, I have to re-read certain subjects/topics multiple times, but I try.
So I was reading the part about turf borders and I wanted your opinion on whether or not you believe I've interpreted it correctly, using the comments I added on the code.
turf
starting_line
density = 1
icon_state = "starting-line"
New()
..()
if(density)
var/n = 0
var/turf/t
t = locate(x, y + 1, z)
if(t && t.density) n += 1 //these set of numbers are used because there is only one way to make 15. By adding them all together.
t = locate(x + 1, y, z) //if we were to double these amounts to make n < 30. The icons states would need to be changed also. lowest possible number to highest.
if(t && t.density) n += 2
t = locate(x, y - 1, z)
if(t) //for shadows
if(t.density)
n += 4
else //if there is no dense turf in y - 1,
t.overlays += icon('outline.dmi', "shadow") //add the shadow
t = locate(x - 1, y, z)
if(t && t.density) n += 8
if(n < 15)
overlays += icon('outline.dmi', "[n]") //n = icon_state
To answer your question, it also appears as if you got the hang of what this code does. Pay particular attention to the n variable. The reason these numbers are used are because you can "take them off" in reverse order from largest to smallest and know what directions contributed to the total value.
For instance, if n = 14. You know it is made of the individual components of 8, 4, and 2; corresponding to WEST, SOUTH, and EAST.
You'll have to ask one of the more knowledgeable persons about the technical term for this useage of variables, but I know this use of variables was common in MUDs. It seems to be a more efficient way of storing similar, but separate information. In this example, you have one variable effectively capable of storing information about 4 independent directions.