From de14e9bbc31f0cb8f4261b42ee430aaf2d281513 Mon Sep 17 00:00:00 2001 From: OgelGames Date: Mon, 25 Jan 2021 15:46:34 +1100 Subject: [PATCH] filter allows all when channel is empty, simpler compat --- README.md | 1 - compatibility.lua | 182 +--------------------------------------------- filter.lua | 2 +- init.lua | 2 +- 4 files changed, 4 insertions(+), 183 deletions(-) diff --git a/README.md b/README.md index 48e5b88..014c542 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Adds nodes to control the flow of digiline messages. ## TODO - router (sorting tube for digiline messages) -- crossing and double corner insulated wires - craft recipes ## License diff --git a/compatibility.lua b/compatibility.lua index 59679f1..317236d 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -7,6 +7,7 @@ if not minetest.get_modpath("digiline_routing") then -- Alias for crafting item minetest.register_alias("digiline_routing:connector", "digilines:wire_std_00000000") -- LBM to replace nodes + local connector = minetest.get_modpath("digistuff") and "digistuff:insulated_straight" or "digicontrol:filter" minetest.register_lbm({ label = "Digicontrol digiline_routing compatibility", 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 minetest.swap_node(pos, {name = node.name, param2 = p}) else - minetest.swap_node(pos, {name = "digistuff:insulated_straight", param2 = p}) + minetest.swap_node(pos, {name = connector, param2 = p}) 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 diff --git a/filter.lua b/filter.lua index f6342ff..58dcac4 100644 --- a/filter.lua +++ b/filter.lua @@ -33,7 +33,7 @@ minetest.register_node("digicontrol:filter", { semiconductor = { rules = function(node, pos, _, 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 { digicontrol.get_rule(1, node.param2), digicontrol.get_rule(3, node.param2) diff --git a/init.lua b/init.lua index 704cc58..ed5ae43 100644 --- a/init.lua +++ b/init.lua @@ -48,7 +48,7 @@ local MP = minetest.get_modpath("digicontrol") -- Overrides to digilines functions dofile(MP.."/override.lua") --- Compatibility for digiline_routing and digistuff +-- Compatibility for replacing digiline_routing dofile(MP.."/compatibility.lua") -- Digicontrol nodes