aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasimir <jul.lutz@gmx.net>2013-08-18 01:15:38 +0200
committersapier <Sapier at GMX dot net>2014-08-22 11:14:15 +0200
commit08f7ac5704e9156076c6f6a4fc6ae2658fae4179 (patch)
treea8aa934a8b0797f642e1e75d3a9a2ec178fbf0ef
parentd9df592da824629149bf744726beba33f604dc2d (diff)
downloadminetest-08f7ac5704e9156076c6f6a4fc6ae2658fae4179.tar.gz
minetest-08f7ac5704e9156076c6f6a4fc6ae2658fae4179.tar.bz2
minetest-08f7ac5704e9156076c6f6a4fc6ae2658fae4179.zip
Remove buildable_to nodes without dropping item when replaced by a falling node
-rw-r--r--builtin/game/falling.lua29
1 files changed, 18 insertions, 11 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua
index b3d5a9a8b..8f3b41d5a 100644
--- a/builtin/game/falling.lua
+++ b/builtin/game/falling.lua
@@ -79,17 +79,24 @@ core.register_entity(":__builtin:falling_node", {
local np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
-- Check what's here
local n2 = core.get_node(np)
- -- remove node and replace it with it's drops
- local drops = core.get_node_drops(n2.name, "")
- core.remove_node(np)
- local _, dropped_item
- for _, dropped_item in ipairs(drops) do
- core.add_item(np, dropped_item)
- end
- -- Run script hook
- local _, callback
- for _, callback in ipairs(core.registered_on_dignodes) do
- callback(np, n2, nil)
+ -- If it's not air or liquid, remove node and replace it with
+ -- it's drops
+ if n2.name ~= "air" and (not core.registered_nodes[n2.name] or
+ core.registered_nodes[n2.name].liquidtype == "none") then
+ core.remove_node(np)
+ if core.registered_nodes[n2.name].buildable_to == false then
+ -- Add dropped items
+ local drops = core.get_node_drops(n2.name, "")
+ local _, dropped_item
+ for _, dropped_item in ipairs(drops) do
+ core.add_item(np, dropped_item)
+ end
+ end
+ -- Run script hook
+ local _, callback
+ for _, callback in ipairs(core.registered_on_dignodes) do
+ callback(np, n2, nil)
+ end
end
-- Create node and remove entity
core.add_node(np, self.node)