Update the mesecons mod and dependencies

This touches a lot of the existing Mesecons mods.
Also add mesecons_wires.
This commit is contained in:
Wuzzy 2017-07-31 00:12:21 +02:00
parent 66829c91c3
commit b299b95fac
27 changed files with 1542 additions and 554 deletions

View file

@ -2,15 +2,15 @@
local rotate_torch_rules = function (rules, param2)
if param2 == 5 then
return mesecon:rotate_rules_right(rules)
return mesecon.rotate_rules_right(rules)
elseif param2 == 2 then
return mesecon:rotate_rules_right(mesecon:rotate_rules_right(rules)) --180 degrees
return mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules)) --180 degrees
elseif param2 == 4 then
return mesecon:rotate_rules_left(rules)
return mesecon.rotate_rules_left(rules)
elseif param2 == 1 then
return mesecon:rotate_rules_down(rules)
return mesecon.rotate_rules_down(rules)
elseif param2 == 0 then
return mesecon:rotate_rules_up(rules)
return mesecon.rotate_rules_up(rules)
else
return rules
end
@ -128,26 +128,26 @@ minetest.register_abm({
action = function(pos, node)
local is_powered = false
for _, rule in ipairs(torch_get_input_rules(node)) do
local src = mesecon:addPosRule(pos, rule)
if mesecon:is_power_on(src) then
local src = vector.add(pos, rule)
if mesecon.is_power_on(src) then
is_powered = true
end
end
if is_powered then
if node.name == "mesecons_torch:mesecon_torch_on" then
mesecon:swap_node(pos, "mesecons_torch:mesecon_torch_off")
mesecon:receptor_off(pos, torch_get_output_rules(node))
minetest.swap_node(pos, {name="mesecons_torch:mesecon_torch_off", param2=node.param2})
mesecon.receptor_off(pos, torch_get_output_rules(node))
elseif node.name == "mesecons_torch:mesecon_torch_on_wall" then
mesecon:swap_node(pos, "mesecons_torch:mesecon_torch_off_wall")
mesecon:receptor_off(pos, torch_get_output_rules(node))
minetest.swap_node(pos, {name="mesecons_torch:mesecon_torch_off_wall", param2=node.param2})
mesecon.receptor_off(pos, torch_get_output_rules(node))
end
elseif node.name == "mesecons_torch:mesecon_torch_off" then
mesecon:swap_node(pos, "mesecons_torch:mesecon_torch_on")
mesecon:receptor_on(pos, torch_get_output_rules(node))
minetest.swap_node(pos, {name="mesecons_torch:mesecon_torch_on", param2=node.param2})
mesecon.receptor_on(pos, torch_get_output_rules(node))
elseif node.name == "mesecons_torch:mesecon_torch_off_wall" then
mesecon:swap_node(pos, "mesecons_torch:mesecon_torch_on_wall")
mesecon:receptor_on(pos, torch_get_output_rules(node))
minetest.swap_node(pos, {name="mesecons_torch:mesecon_torch_on_wall", param2=node.param2})
mesecon.receptor_on(pos, torch_get_output_rules(node))
end
end
})