diff options
author | Jeija <norrepli@gmail.com> | 2016-02-14 11:51:20 +0100 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2016-02-14 12:55:18 +0100 |
commit | c98805a5b5dac5f159a1ab67c2c7de279e9a7758 (patch) | |
tree | 383dd7c867eb590ca30c6421a605de3646867e74 | |
parent | fb4c440265a6e26740cb6a97844b98361596c634 (diff) | |
parent | cf45e24c57306450215b27d9bcbca43084d57d32 (diff) | |
download | mesecons-c98805a5b5dac5f159a1ab67c2c7de279e9a7758.tar mesecons-c98805a5b5dac5f159a1ab67c2c7de279e9a7758.tar.gz mesecons-c98805a5b5dac5f159a1ab67c2c7de279e9a7758.tar.bz2 mesecons-c98805a5b5dac5f159a1ab67c2c7de279e9a7758.tar.xz mesecons-c98805a5b5dac5f159a1ab67c2c7de279e9a7758.zip |
Merge branch 'fix_pistons' of https://github.com/HybridDog/minetest-mod-mesecons into HybridDog-fix_pistons
-rw-r--r-- | mesecons_mvps/init.lua | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua index beec94b..2f4edfc 100644 --- a/mesecons_mvps/init.lua +++ b/mesecons_mvps/init.lua @@ -15,10 +15,16 @@ end -- Nodes that cannot be pushed / pulled by movestones, pistons function mesecon.is_mvps_stopper(node, pushdir, stack, stackid) + -- unknown nodes are always stoppers + if not minetest.registered_nodes[node.name] then + return true + end + local get_stopper = mesecon.mvps_stoppers[node.name] if type (get_stopper) == "function" then get_stopper = get_stopper(node, pushdir, stack, stackid) end + return get_stopper end @@ -47,6 +53,17 @@ function mesecon.mvps_process_stack(stack) end end +-- tests if the node can be pushed into, e.g. air, water, grass +local function node_replaceable(name) + if name == "ignore" then return true end + + if minetest.registered_nodes[name] then + return minetest.registered_nodes[name].buildable_to or false + end + + return false +end + function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky) -- determine the number of nodes to be pushed local nodes = {} @@ -56,9 +73,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 |