diff --git a/towntest_chest/init.lua b/towntest_chest/init.lua index 03233cf..e737c99 100644 --- a/towntest_chest/init.lua +++ b/towntest_chest/init.lua @@ -197,17 +197,34 @@ towntest_chest.update_needed = function(inv,building) inv:set_stack("needed", i, nil) end local materials = {} + + -- sort by y to prefer lower nodes in building order. At the same level prefer nodes nearly the chest + table.sort(building,function(a,b) + if a and b then + return ((a.y