filter allows all when channel is empty, simpler compat

This commit is contained in:
OgelGames 2021-01-25 15:46:34 +11:00
parent 1d37eae1a7
commit de14e9bbc3
4 changed files with 4 additions and 183 deletions

@ -8,7 +8,6 @@ Adds nodes to control the flow of digiline messages.
## TODO ## TODO
- router (sorting tube for digiline messages) - router (sorting tube for digiline messages)
- crossing and double corner insulated wires
- craft recipes - craft recipes
## License ## License

@ -7,6 +7,7 @@ if not minetest.get_modpath("digiline_routing") then
-- Alias for crafting item -- Alias for crafting item
minetest.register_alias("digiline_routing:connector", "digilines:wire_std_00000000") minetest.register_alias("digiline_routing:connector", "digilines:wire_std_00000000")
-- LBM to replace nodes -- LBM to replace nodes
local connector = minetest.get_modpath("digistuff") and "digistuff:insulated_straight" or "digicontrol:filter"
minetest.register_lbm({ minetest.register_lbm({
label = "Digicontrol digiline_routing compatibility", label = "Digicontrol digiline_routing compatibility",
name = "digicontrol:routing_compat", name = "digicontrol:routing_compat",
@ -22,187 +23,8 @@ if not minetest.get_modpath("digiline_routing") then
if node.name == "digicontrol:splitter" or node.name == "digicontrol:filter" then if node.name == "digicontrol:splitter" or node.name == "digicontrol:filter" then
minetest.swap_node(pos, {name = node.name, param2 = p}) minetest.swap_node(pos, {name = node.name, param2 = p})
else else
minetest.swap_node(pos, {name = "digistuff:insulated_straight", param2 = p}) minetest.swap_node(pos, {name = connector, param2 = p})
end end
end end
}) })
end end
if minetest.get_modpath("digistuff") then
-- Use digicontrol on_rotate
for _,n in pairs({"insulated_straight", "insulated_tjunction", "insulated_corner"}) do
minetest.override_item("digistuff:"..n, {
on_rotate = digicontrol.on_rotate
})
end
else
-- Register digistuff's insulated wires
minetest.register_node(":digistuff:insulated_straight", {
description = "Insulated Digiline (straight)",
tiles = {
"digistuff_insulated_full.png",
"digistuff_insulated_full.png",
"digistuff_insulated_edge.png",
"digistuff_insulated_edge.png",
"digistuff_insulated_full.png",
"digistuff_insulated_full.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {dig_immediate = 3},
walkable = false,
node_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.1,0.5,-0.4,0.1}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.15,0.5,-0.35,0.15}
}
},
on_rotate = digicontrol.on_rotate,
after_place_node = digilines.update_autoconnect,
after_destruct = digilines.update_autoconnect,
digiline = {
wire = {
rules = function(node)
return {
digicontrol.get_rule(1, node.param2),
digicontrol.get_rule(3, node.param2)
}
end
}
}
})
minetest.register_node(":digistuff:insulated_tjunction", {
description = "Insulated Digiline (T junction)",
tiles = {
"digistuff_insulated_full.png",
"digistuff_insulated_full.png",
"digistuff_insulated_edge.png",
"digistuff_insulated_edge.png",
"digistuff_insulated_full.png",
"digistuff_insulated_edge.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {dig_immediate = 3},
walkable = false,
node_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.1,0.5,-0.4,0.1},
{-0.1,-0.5,-0.5,0.1,-0.4,-0.1}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,-0.35,0.15}
}
},
on_rotate = digicontrol.on_rotate,
after_place_node = digilines.update_autoconnect,
after_destruct = digilines.update_autoconnect,
digiline = {
receptor = {},
wire = {
rules = function(node)
return {
digicontrol.get_rule(1, node.param2),
digicontrol.get_rule(2, node.param2),
digicontrol.get_rule(3, node.param2)
}
end
}
}
})
minetest.register_node(":digistuff:insulated_corner", {
description = "Insulated Digiline (corner)",
tiles = {
"digistuff_insulated_full.png",
"digistuff_insulated_full.png",
"digistuff_insulated_full.png",
"digistuff_insulated_edge.png",
"digistuff_insulated_full.png",
"digistuff_insulated_edge.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {dig_immediate = 3},
walkable = false,
node_box = {
type = "fixed",
fixed = {
{-0.1,-0.5,-0.5,0.1,-0.4,0.1},
{-0.5,-0.5,-0.1,0.1,-0.4,0.1}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.15,-0.35,0.15}
}
},
on_rotate = digicontrol.on_rotate,
after_place_node = digilines.update_autoconnect,
after_destruct = digilines.update_autoconnect,
digiline = {
receptor = {},
wire = {
rules = function(node)
return {
digicontrol.get_rule(2, node.param2),
digicontrol.get_rule(3, node.param2)
}
end
}
}
})
minetest.register_node(":digistuff:insulated_fourway", {
description = "Insulated Digiline (four-way junction)",
tiles = {
"digistuff_insulated_full.png",
"digistuff_insulated_full.png",
"digistuff_insulated_edge.png",
"digistuff_insulated_edge.png",
"digistuff_insulated_edge.png",
"digistuff_insulated_edge.png"
},
paramtype = "light",
is_ground_content = false,
groups = {dig_immediate = 3},
walkable = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.1,0.5,-0.4,0.1},
{-0.1,-0.5,-0.5,0.1,-0.4,-0.1},
{-0.1,-0.5,0.1,0.1,-0.4,0.5}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,-0.35,0.5}
}
},
after_place_node = digilines.update_autoconnect,
after_destruct = digilines.update_autoconnect,
digiline = {
wire = {
rules = digicontrol.all_rules
}
}
})
end

@ -33,7 +33,7 @@ minetest.register_node("digicontrol:filter", {
semiconductor = { semiconductor = {
rules = function(node, pos, _, channel) rules = function(node, pos, _, channel)
local setchannel = minetest.get_meta(pos):get_string("channel") local setchannel = minetest.get_meta(pos):get_string("channel")
if channel ~= setchannel then return {} end if setchannel ~= "" and channel ~= setchannel then return {} end
return { return {
digicontrol.get_rule(1, node.param2), digicontrol.get_rule(1, node.param2),
digicontrol.get_rule(3, node.param2) digicontrol.get_rule(3, node.param2)

@ -48,7 +48,7 @@ local MP = minetest.get_modpath("digicontrol")
-- Overrides to digilines functions -- Overrides to digilines functions
dofile(MP.."/override.lua") dofile(MP.."/override.lua")
-- Compatibility for digiline_routing and digistuff -- Compatibility for replacing digiline_routing
dofile(MP.."/compatibility.lua") dofile(MP.."/compatibility.lua")
-- Digicontrol nodes -- Digicontrol nodes