wasplib: add get_reachable_airpocket
parent
54b6b951c6
commit
b530187316
|
@ -843,6 +843,19 @@ function ws.inside_wall(pos)
|
|||
return false
|
||||
end
|
||||
|
||||
function ws.find_closest_reachable_airpocket(pos)
|
||||
local lp=ws.dircoord(0,0,0)
|
||||
local nds=minetest.find_nodes_near(lp,5,{'air'})
|
||||
local odst=10
|
||||
local rt=lp
|
||||
for k,v in ipairs(nds) do
|
||||
local dst=vector.distance(pos,v)
|
||||
if dst < odst then odst=dst rt=v end
|
||||
end
|
||||
if odst==10 then return false end
|
||||
return vector.add(rt,vector.new(0,-1,0))
|
||||
end
|
||||
|
||||
|
||||
-- DEBUG
|
||||
local function printwieldedmeta()
|
||||
|
|
Loading…
Reference in New Issue