Rewrite Logic Gates: Makes it super-easy to add new gates and cleans up code

Fix bugs in the Luacontroller (when placing, false input pin values were given) and fix variables
leaking into the global environment in pistons.
This commit is contained in:
Jeija
2014-11-29 15:08:37 +01:00
parent d2373eb605
commit c326dc221a
6 changed files with 156 additions and 285 deletions

View File

@ -94,7 +94,7 @@ function mesecon.mvps_push(pos, dir, maximum) -- pos: pos of mvps; dir: directio
-- add nodes
for _, n in ipairs(nodes) do
np = mesecon.addPosRule(n.pos, dir)
local np = mesecon.addPosRule(n.pos, dir)
minetest.add_node(np, n.node)
minetest.get_meta(np):from_table(n.meta)
end
@ -123,8 +123,8 @@ mesecon.register_on_mvps_move(function(moved_nodes)
end)
function mesecon.mvps_pull_single(pos, dir) -- pos: pos of mvps; direction: direction of pull (matches push direction for sticky pistons)
np = mesecon.addPosRule(pos, dir)
nn = minetest.get_node(np)
local np = mesecon.addPosRule(pos, dir)
local nn = minetest.get_node(np)
if ((not minetest.registered_nodes[nn.name]) --unregistered node
or minetest.registered_nodes[nn.name].liquidtype == "none") --non-liquid node