aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowNinja <noreply@gmail.com>2013-10-01 17:14:58 -0400
committerShadowNinja <noreply@gmail.com>2013-11-01 10:33:29 -0400
commit2f10cfb226c6de8024f5efa9bf14ea22b5b90ce2 (patch)
tree6fdf3d6cd0ea0191a4a63d55a9b17de8fa8a8fb0
parent8bc68645cb0c0145c8229bc6876bf590a8eef0ca (diff)
downloadminetest-2f10cfb226c6de8024f5efa9bf14ea22b5b90ce2.tar.gz
minetest-2f10cfb226c6de8024f5efa9bf14ea22b5b90ce2.tar.bz2
minetest-2f10cfb226c6de8024f5efa9bf14ea22b5b90ce2.zip
Made unknown nodes stop falling nodes properly and shorten lines
-rw-r--r--builtin/falling.lua22
1 files changed, 14 insertions, 8 deletions
diff --git a/builtin/falling.lua b/builtin/falling.lua
index 605252b7b..c8f3bc556 100644
--- a/builtin/falling.lua
+++ b/builtin/falling.lua
@@ -54,19 +54,25 @@ minetest.register_entity("__builtin:falling_node", {
local pos = self.object:getpos()
local bcp = {x=pos.x, y=pos.y-0.7, z=pos.z} -- Position of bottom center point
local bcn = minetest.get_node(bcp)
+ local bcd = minetest.registered_nodes[bcn.name]
-- Note: walkable is in the node definition, not in item groups
- if minetest.registered_nodes[bcn.name] and
- minetest.registered_nodes[bcn.name].walkable or
- (minetest.get_node_group(self.node.name, "float") ~= 0 and minetest.registered_nodes[bcn.name].liquidtype ~= "none")
- then
- if minetest.registered_nodes[bcn.name].leveled and bcn.name == self.node.name then
+ if not bcd or
+ (bcd.walkable or
+ (minetest.get_node_group(self.node.name, "float") ~= 0 and
+ bcd.liquidtype ~= "none")) then
+ if bcd and bcd.leveled and
+ bcn.name == self.node.name then
local addlevel = self.node.level
- if addlevel == nil or addlevel <= 0 then addlevel = minetest.registered_nodes[bcn.name].leveled end
- if minetest.env:add_node_level(bcp, addlevel) == 0 then
+ if addlevel == nil or addlevel <= 0 then
+ addlevel = bcd.leveled
+ end
+ if minetest.add_node_level(bcp, addlevel) == 0 then
self.object:remove()
return
end
- elseif minetest.registered_nodes[bcn.name].buildable_to and (minetest.get_node_group(self.node.name, "float") == 0 or minetest.registered_nodes[bcn.name].liquidtype == "none") then
+ elseif bcd and bcd.buildable_to and
+ (minetest.get_node_group(self.node.name, "float") == 0 or
+ bcd.liquidtype == "none") then
minetest.remove_node(bcp)
return
end