summaryrefslogtreecommitdiff
path: root/mesecons_mvps
diff options
context:
space:
mode:
Diffstat (limited to 'mesecons_mvps')
-rw-r--r--mesecons_mvps/init.lua27
1 files changed, 13 insertions, 14 deletions
diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua
index bfbd774..2f4edfc 100644
--- a/mesecons_mvps/init.lua
+++ b/mesecons_mvps/init.lua
@@ -15,16 +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
- if get_stopper == nil
- and not minetest.registered_nodes[node.name] then
- -- unknown nodes must be stoppers
- mesecon.mvps_stoppers[node.name] = true
- get_stopper = true
- end
+
return get_stopper
end
@@ -53,16 +53,15 @@ function mesecon.mvps_process_stack(stack)
end
end
--- tests if the node can't be pushed
-local replaceable_cache = {air = true, ignore = false}
+-- tests if the node can be pushed into, e.g. air, water, grass
local function node_replaceable(name)
- if replaceable_cache[name] ~= nil then
- return replaceable_cache[name]
+ if name == "ignore" then return true end
+
+ if minetest.registered_nodes[name] then
+ return minetest.registered_nodes[name].buildable_to or false
end
- --local replaceable = not minetest.registered_nodes[name] or minetest.registered_nodes[name].buildable_to or false
- local replaceable = (minetest.registered_nodes[name] and minetest.registered_nodes[name].buildable_to) or false
- replaceable_cache[name] = replaceable
- return replaceable
+
+ return false
end
function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky)