Differences From
Artifact [5b83bf6142]:
71 71 is_air = function(pos)
72 72 local n = sorcery.lib.node.force(pos)
73 73 if n.name == 'air' then return true end
74 74 local d = minetest.registered_nodes[n.name]
75 75 if not d then return false end
76 76 return not d.walkable
77 77 end;
78 +
79 + is_clear = function(pos)
80 + if not sorcery.lib.node.is_air(pos) then return false end
81 + local ents = minetest.get_objects_inside_radius(pos,0.5)
82 + if #ents > 0 then return false end
83 + return true
84 + end;
78 85
79 86 get_arrival_point = function(pos)
80 - local air = sorcery.lib.node.is_air
81 - if air(pos) then
82 - local n = {x=0,y=1,z=0}
83 - if air(vector.add(pos,n)) then return pos end
84 - local down = vector.subtract(pos,n)
85 - if air(down) then return down end
86 - else return nil end
87 + local try = function(p)
88 + local air = sorcery.lib.node.is_clear
89 + if air(p) then
90 + if air(vector.offset(p,0,1,0)) then return p end
91 + if air(vector.offset(p,0,-1,0)) then return vector.offset(p,0,-1,0) end
92 + end
93 + return false
94 + end
95 +
96 + do local t = try(pos) if t then return t end end
97 + for _,o in pairs(ofs.neighbors) do
98 + local p = vector.add(pos, o)
99 + do local t = try(p) if t then return t end end
100 + end
87 101 end;
88 102
89 103 amass = function(startpoint,names,directions)
90 104 if not directions then directions = ofs.neighbors end
91 105 local nodes, positions, checked = {},{},{}
92 106 local checkedp = function(pos)
93 107 for _,v in pairs(checked) do