diff --git a/mods/bg_api/util_node.lua b/mods/bg_api/util_node.lua index 21a9fc8..711171c 100644 --- a/mods/bg_api/util_node.lua +++ b/mods/bg_api/util_node.lua @@ -55,3 +55,14 @@ function blockgame.random_walk (data) end return pos end + + + +function blockgame.get_neighbors (pos, neighborhood) + neighborhood = neighborhood or blockgame.vector.dirs + local neighbors = {} + for _, dir in pairs(neighborhood) do + table.insert(neighbors, pos + dir) + end + return neighbors +end