Rotate dual delayer, signal changer and conductor signal changer
@ -4,7 +4,7 @@ local nodebox = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local function signalchanger_get_output_rules(node)
|
local function signalchanger_get_output_rules(node)
|
||||||
local rules = {{x=1, y=0, z=0}}
|
local rules = {{x=-1, y=0, z=0}}
|
||||||
for i = 0, node.param2 do
|
for i = 0, node.param2 do
|
||||||
rules = mesecon.rotate_rules_left(rules)
|
rules = mesecon.rotate_rules_left(rules)
|
||||||
end
|
end
|
||||||
@ -12,7 +12,7 @@ local function signalchanger_get_output_rules(node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function signalchanger_get_input_rules(node)
|
local function signalchanger_get_input_rules(node)
|
||||||
local rules = {{x=0, y=0, z=1, name="input_on"}, {x=0, y=0, z=-1, name="input_off"}, {x=-1, y=0, z=0, name="input_signal"}}
|
local rules = {{x=0, y=0, z=-1, name="input_on"}, {x=0, y=0, z=1, name="input_off"}, {x=1, y=0, z=0, name="input_signal"}}
|
||||||
for i = 0, node.param2 do
|
for i = 0, node.param2 do
|
||||||
rules = mesecon.rotate_rules_left(rules)
|
rules = mesecon.rotate_rules_left(rules)
|
||||||
end
|
end
|
||||||
@ -25,14 +25,14 @@ local update = function(pos, node, link, newstate)
|
|||||||
local input_on = meta:get_int("input_on") == 1
|
local input_on = meta:get_int("input_on") == 1
|
||||||
local input_off = meta:get_int("input_off") == 1
|
local input_off = meta:get_int("input_off") == 1
|
||||||
local input_signal = meta:get_int("input_signal") == 1
|
local input_signal = meta:get_int("input_signal") == 1
|
||||||
|
|
||||||
if input_on then
|
if input_on then
|
||||||
minetest.swap_node(pos, {name = "moremesecons_conductor_signalchanger:conductor_signalchanger_on", param2 = node.param2})
|
minetest.swap_node(pos, {name = "moremesecons_conductor_signalchanger:conductor_signalchanger_on", param2 = node.param2})
|
||||||
elseif input_off then
|
elseif input_off then
|
||||||
mesecon.receptor_off(pos, signalchanger_get_output_rules(node))
|
mesecon.receptor_off(pos, signalchanger_get_output_rules(node))
|
||||||
minetest.swap_node(pos, {name = "moremesecons_conductor_signalchanger:conductor_signalchanger_off", param2 = node.param2})
|
minetest.swap_node(pos, {name = "moremesecons_conductor_signalchanger:conductor_signalchanger_off", param2 = node.param2})
|
||||||
end
|
end
|
||||||
|
|
||||||
if input_signal and minetest.get_node(pos).name == "moremesecons_conductor_signalchanger:conductor_signalchanger_on" then -- Note : we must use "minetest.get_node(pos)" and not "node" because the node may have been changed
|
if input_signal and minetest.get_node(pos).name == "moremesecons_conductor_signalchanger:conductor_signalchanger_on" then -- Note : we must use "minetest.get_node(pos)" and not "node" because the node may have been changed
|
||||||
mesecon.receptor_on(pos, signalchanger_get_output_rules(node))
|
mesecon.receptor_on(pos, signalchanger_get_output_rules(node))
|
||||||
else
|
else
|
||||||
|
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 158 B |
@ -1,5 +1,5 @@
|
|||||||
local function dual_delayer_get_input_rules(node)
|
local function dual_delayer_get_input_rules(node)
|
||||||
local rules = {{x=-1, y=0, z=0}}
|
local rules = {{x=1, y=0, z=0}}
|
||||||
for i = 0, node.param2 do
|
for i = 0, node.param2 do
|
||||||
rules = mesecon.rotate_rules_left(rules)
|
rules = mesecon.rotate_rules_left(rules)
|
||||||
end
|
end
|
||||||
@ -7,7 +7,7 @@ local function dual_delayer_get_input_rules(node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function dual_delayer_get_output_rules(node)
|
local function dual_delayer_get_output_rules(node)
|
||||||
local rules = {{x=0, y=0, z=-1}, {x=0, y=0, z=1}}
|
local rules = {{x=0, y=0, z=1}, {x=0, y=0, z=-1}}
|
||||||
for i = 0, node.param2 do
|
for i = 0, node.param2 do
|
||||||
rules = mesecon.rotate_rules_left(rules)
|
rules = mesecon.rotate_rules_left(rules)
|
||||||
end
|
end
|
||||||
@ -68,7 +68,7 @@ for n,i in pairs({{0,0},{1,0},{1,1}}) do
|
|||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {{-6/16, -8/16, -1/16, 6/16, -7/16, 8/16 },
|
fixed = {{-6/16, -8/16, -8/16, 6/16, -7/16, 1/16 },
|
||||||
{-8/16, -8/16, 1/16, -6/16, -7/16, -1/16},
|
{-8/16, -8/16, 1/16, -6/16, -7/16, -1/16},
|
||||||
{8/16, -8/16, -1/16, 6/16, -7/16, 1/16}}
|
{8/16, -8/16, -1/16, 6/16, -7/16, 1/16}}
|
||||||
},
|
},
|
||||||
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 189 B |
@ -4,8 +4,8 @@ local nodebox = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local function signalchanger_get_output_rules(node)
|
local function signalchanger_get_output_rules(node)
|
||||||
local rules = {{x=1, y=0, z=0},
|
local rules = {{x=-1, y=0, z=0},
|
||||||
{x=-1, y=0, z=0}}
|
{x=1, y=0, z=0}}
|
||||||
for i = 0, node.param2 do
|
for i = 0, node.param2 do
|
||||||
rules = mesecon.rotate_rules_left(rules)
|
rules = mesecon.rotate_rules_left(rules)
|
||||||
end
|
end
|
||||||
@ -13,7 +13,7 @@ local function signalchanger_get_output_rules(node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function signalchanger_get_input_rules(node)
|
local function signalchanger_get_input_rules(node)
|
||||||
local rules = {{x=0, y=0, z=1, name="input_on"}, {x=0, y=0, z=-1, name="input_off"}}
|
local rules = {{x=0, y=0, z=-1, name="input_on"}, {x=0, y=0, z=1, name="input_off"}}
|
||||||
for i = 0, node.param2 do
|
for i = 0, node.param2 do
|
||||||
rules = mesecon.rotate_rules_left(rules)
|
rules = mesecon.rotate_rules_left(rules)
|
||||||
end
|
end
|
||||||
|
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 159 B |