diff options
author | HybridDog <ovvv@web.de> | 2016-02-09 11:32:09 +0100 |
---|---|---|
committer | HybridDog <ovvv@web.de> | 2016-02-09 11:32:09 +0100 |
commit | 3f00c1d1cb3823f405558b2bd23465813580d5e3 (patch) | |
tree | aaa4f9771fceb8390162a0e88dc9b2b8ff615295 | |
parent | f56c4ce35cc4fd4f6eace5d4345400283e1536a3 (diff) | |
download | mesecons-3f00c1d1cb3823f405558b2bd23465813580d5e3.tar mesecons-3f00c1d1cb3823f405558b2bd23465813580d5e3.tar.gz mesecons-3f00c1d1cb3823f405558b2bd23465813580d5e3.tar.bz2 mesecons-3f00c1d1cb3823f405558b2bd23465813580d5e3.tar.xz mesecons-3f00c1d1cb3823f405558b2bd23465813580d5e3.zip |
fix pistons not working in every buildable_to node
-rw-r--r-- | mesecons_mvps/init.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua index beec94b..6f455f7 100644 --- a/mesecons_mvps/init.lua +++ b/mesecons_mvps/init.lua @@ -47,6 +47,17 @@ function mesecon.mvps_process_stack(stack) end end +-- tests if the node can't be pushed +local replaceable_cache = {air = true, ignore = false} +local function node_replaceable(name) + if replaceable_cache[name] ~= nil then + return replaceable_cache[name] + end + local replaceable = not minetest.registered_nodes[name] or minetest.registered_nodes[name].buildable_to or false + replaceable_cache[name] = replaceable + return replaceable +end + function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky) -- determine the number of nodes to be pushed local nodes = {} @@ -56,9 +67,7 @@ function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky) local np = frontiers[1] local nn = minetest.get_node(np) - if nn.name ~= "air" - and minetest.registered_nodes[nn.name] - and minetest.registered_nodes[nn.name].liquidtype == "none" then + if not node_replaceable(nn.name) then table.insert(nodes, {node = nn, pos = np}) if #nodes > maximum then return nil end |