mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-07 21:47:30 +01:00
check if node is registered before checking if walkable
This commit is contained in:
parent
06c076a885
commit
bb15b744ff
3
init.lua
3
init.lua
@ -80,7 +80,8 @@ function tp.find_free_position_near(pos)
|
|||||||
}
|
}
|
||||||
for _,d in pairs(tries) do
|
for _,d in pairs(tries) do
|
||||||
local p = vector.add(pos, d)
|
local p = vector.add(pos, d)
|
||||||
if not minetest.registered_nodes[minetest.get_node(p).name].walkable then
|
local def = minetest.registered_nodes[minetest.get_node(p).name]
|
||||||
|
if def and not def.walkable then
|
||||||
return p, true
|
return p, true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user