atom
proc
neighbours(type)
if(locate(type) in get_step(src, 1)) . += list(type)
if(locate(type) in get_step(src, 2)) . += list(type)
if(locate(type) in get_step(src, 4)) . += list(type)
if(locate(type) in get_step(src, 8)) . += list(type)
It has many additional uses, as well. It can be used in A*, which also requires you to get a list of adjacent nodes. It only returns a list of nodes that are north, south, east, or west of the current node, but it's not hard to modify so that it returns a list of diagonal nodes too. Enjoy.