aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorproller <proller@github.com>2013-07-28 17:11:59 +0400
committerproller <proller@github.com>2013-07-28 17:14:31 +0400
commit037e84d377e91f37026cb5814145bdceac135534 (patch)
tree4e74e3d60e797605353d2539d2b2fbc399b684a9 /builtin
parent3aedfac9685c2d9ae8bac5a5b7e72e527f22c08d (diff)
downloadminetest-037e84d377e91f37026cb5814145bdceac135534.tar.gz
minetest-037e84d377e91f37026cb5814145bdceac135534.tar.bz2
minetest-037e84d377e91f37026cb5814145bdceac135534.zip
Better snow fall, finite liquid transform, leveled nodes api
Diffstat (limited to 'builtin')
-rw-r--r--builtin/falling.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/builtin/falling.lua b/builtin/falling.lua
index 91e732a4b..605252b7b 100644
--- a/builtin/falling.lua
+++ b/builtin/falling.lua
@@ -59,7 +59,14 @@ minetest.register_entity("__builtin:falling_node", {
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].buildable_to and (minetest.get_node_group(self.node.name, "float") == 0 or minetest.registered_nodes[bcn.name].liquidtype == "none") then
+ if minetest.registered_nodes[bcn.name].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
+ 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
minetest.remove_node(bcp)
return
end
@@ -152,11 +159,13 @@ function nodeupdate_single(p, delay)
-- Note: walkable is in the node definition, not in item groups
if minetest.registered_nodes[n_bottom.name] and
(minetest.get_node_group(n.name, "float") == 0 or minetest.registered_nodes[n_bottom.name].liquidtype == "none") and
+ (n.name ~= n_bottom.name or (minetest.registered_nodes[n_bottom.name].leveled and minetest.env:get_node_level(p_bottom) < minetest.env:get_node_max_level(p_bottom))) and
(not minetest.registered_nodes[n_bottom.name].walkable or
minetest.registered_nodes[n_bottom.name].buildable_to) then
if delay then
minetest.after(0.1, nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false)
else
+ n.level = minetest.env:get_node_level(p)
minetest.remove_node(p)
spawn_falling_node(p, n)
nodeupdate(p)