Add minetest.spawn_falling_node(pos) (#5339)

* Add minetest.spawn_falling_node(pos)

* lua_api.txt: Add minetest.spawn_falling_node(pos)

* Update minetest.spawn_falling_node(pos)
This commit is contained in:
zaoqi
2017-03-05 01:36:37 +08:00
committed by Loïc Blot
parent 6de83a2756
commit c9ac722ea9
2 changed files with 17 additions and 0 deletions

View File

@@ -118,6 +118,20 @@ local function spawn_falling_node(p, node)
end
end
function core.spawn_falling_node(pos)
local node = core.get_node(pos)
if node.name == "air" or node.name == "ignore" then
return false
end
local obj = core.add_entity(pos, "__builtin:falling_node")
if obj then
obj:get_luaentity():set_node(node)
core.remove_node(pos)
return true
end
return false
end
local function drop_attached_node(p)
local nn = core.get_node(p).name
core.remove_node(p)