digicontrol/compatibility.lua

29 lines
1.1 KiB
Lua
Raw Normal View History

2021-01-24 12:41:06 +01:00
if not minetest.get_modpath("digiline_routing") then
-- Aliases for main nodes
minetest.register_alias("digiline_routing:diode", "digicontrol:diode")
minetest.register_alias("digiline_routing:filter", "digicontrol:filter")
minetest.register_alias("digiline_routing:splitter", "digicontrol:splitter")
-- 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"
2021-01-24 12:41:06 +01:00
minetest.register_lbm({
label = "Digicontrol digiline_routing compatibility",
name = "digicontrol:routing_compat",
nodenames = {
"digiline_routing:filter_b",
"digiline_routing:splitter_b"
},
action = function(pos, node)
2021-02-21 07:22:26 +01:00
local pos2 = vector.subtract(pos, minetest.facedir_to_dir(node.param2))
local node2 = minetest.get_node(pos2)
2021-01-24 12:41:06 +01:00
local p = (node.param2 + 1) % 4
2021-02-21 07:22:26 +01:00
-- Replace invisible node
minetest.set_node(pos, {name = connector, param2 = p})
-- Rotate main node
minetest.swap_node(pos2, {name = node2.name, param2 = p})
2021-01-24 12:41:06 +01:00
end
})
end