add compatibility, fix rotation
This commit is contained in:
parent
a285363c92
commit
1d37eae1a7
@ -9,9 +9,7 @@ Adds nodes to control the flow of digiline messages.
|
|||||||
|
|
||||||
- router (sorting tube for digiline messages)
|
- router (sorting tube for digiline messages)
|
||||||
- crossing and double corner insulated wires
|
- crossing and double corner insulated wires
|
||||||
- compatibility for replacing `digiline_routing`
|
|
||||||
- craft recipes
|
- craft recipes
|
||||||
- insulated wires from `digistuff` (when not installed)
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
208
compatibility.lua
Normal file
208
compatibility.lua
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
|
||||||
|
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
|
||||||
|
minetest.register_lbm({
|
||||||
|
label = "Digicontrol digiline_routing compatibility",
|
||||||
|
name = "digicontrol:routing_compat",
|
||||||
|
nodenames = {
|
||||||
|
"digiline_routing:filter",
|
||||||
|
"digiline_routing:splitter",
|
||||||
|
"digiline_routing:filter_b",
|
||||||
|
"digiline_routing:splitter_b"
|
||||||
|
},
|
||||||
|
action = function(pos, node)
|
||||||
|
local p = (node.param2 + 1) % 4
|
||||||
|
-- For some reason the node name will be the aliased one...
|
||||||
|
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})
|
||||||
|
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
|
@ -17,6 +17,9 @@ minetest.register_node("digicontrol:diode", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {digicontrol = 1, dig_immediate = 2},
|
groups = {digicontrol = 1, dig_immediate = 2},
|
||||||
|
on_rotate = digicontrol.on_rotate,
|
||||||
|
after_place_node = digilines.update_autoconnect,
|
||||||
|
after_destruct = digilines.update_autoconnect,
|
||||||
digiline = {
|
digiline = {
|
||||||
semiconductor = {
|
semiconductor = {
|
||||||
rules = function(node)
|
rules = function(node)
|
||||||
|
@ -17,8 +17,11 @@ minetest.register_node("digicontrol:filter", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {digicontrol = 1, dig_immediate = 2},
|
groups = {digicontrol = 1, dig_immediate = 2},
|
||||||
|
on_rotate = digicontrol.on_rotate,
|
||||||
|
after_place_node = digilines.update_autoconnect,
|
||||||
|
after_destruct = digilines.update_autoconnect,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_meta(pos):set_string("formspec", "field[channel;Channel;${channel}]")
|
minetest.get_meta(pos):set_string("formspec", "field[channel;Digiline Channel;${channel}]")
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, _, fields, sender)
|
on_receive_fields = function(pos, _, fields, sender)
|
||||||
if minetest.is_protected(pos, sender:get_player_name()) then return end
|
if minetest.is_protected(pos, sender:get_player_name()) then return end
|
||||||
|
13
init.lua
13
init.lua
@ -35,12 +35,23 @@ function digicontrol.get_side(pos, from, param2)
|
|||||||
return ((facedir - param2) + 4) % 4
|
return ((facedir - param2) + 4) % 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function digicontrol.on_rotate(pos, node, _, mode, new_param2)
|
||||||
|
if mode ~= 1 then return false end
|
||||||
|
node.param2 = new_param2
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
digilines.update_autoconnect(pos)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
local MP = minetest.get_modpath("digicontrol")
|
local MP = minetest.get_modpath("digicontrol")
|
||||||
|
|
||||||
-- Overrides to digilines functions
|
-- Overrides to digilines functions
|
||||||
dofile(MP.."/override.lua")
|
dofile(MP.."/override.lua")
|
||||||
|
|
||||||
-- Nodes
|
-- Compatibility for digiline_routing and digistuff
|
||||||
|
dofile(MP.."/compatibility.lua")
|
||||||
|
|
||||||
|
-- Digicontrol nodes
|
||||||
dofile(MP.."/diode.lua")
|
dofile(MP.."/diode.lua")
|
||||||
dofile(MP.."/splitter.lua")
|
dofile(MP.."/splitter.lua")
|
||||||
dofile(MP.."/trisplitter.lua")
|
dofile(MP.."/trisplitter.lua")
|
||||||
|
@ -17,6 +17,9 @@ minetest.register_node("digicontrol:limiter", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {digicontrol = 1, dig_immediate = 2},
|
groups = {digicontrol = 1, dig_immediate = 2},
|
||||||
|
on_rotate = digicontrol.on_rotate,
|
||||||
|
after_place_node = digilines.update_autoconnect,
|
||||||
|
after_destruct = digilines.update_autoconnect,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", "field[limit;Message Limit (messages/second);${limit}]")
|
meta:set_string("formspec", "field[limit;Message Limit (messages/second);${limit}]")
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,5 +1,5 @@
|
|||||||
name = digicontrol
|
name = digicontrol
|
||||||
description = Adds nodes to control the flow of digiline messages
|
description = Adds nodes to control the flow of digiline messages
|
||||||
depends = default, digilines
|
depends = default, digilines
|
||||||
optional_depends = digiline_routing
|
optional_depends = digistuff
|
||||||
min_minetest_version = 5.0
|
min_minetest_version = 5.0
|
@ -17,6 +17,9 @@ minetest.register_node("digicontrol:splitter", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {digicontrol = 1, dig_immediate = 2},
|
groups = {digicontrol = 1, dig_immediate = 2},
|
||||||
|
on_rotate = digicontrol.on_rotate,
|
||||||
|
after_place_node = digilines.update_autoconnect,
|
||||||
|
after_destruct = digilines.update_autoconnect,
|
||||||
digiline = {
|
digiline = {
|
||||||
semiconductor = {
|
semiconductor = {
|
||||||
rules = function(node, pos, from)
|
rules = function(node, pos, from)
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
BIN
textures/digistuff_insulated_edge.png
Normal file
BIN
textures/digistuff_insulated_edge.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 103 B |
BIN
textures/digistuff_insulated_full.png
Normal file
BIN
textures/digistuff_insulated_full.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 B |
@ -17,6 +17,9 @@ minetest.register_node("digicontrol:trisplitter", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {digicontrol = 1, dig_immediate = 2},
|
groups = {digicontrol = 1, dig_immediate = 2},
|
||||||
|
on_rotate = digicontrol.on_rotate,
|
||||||
|
after_place_node = digilines.update_autoconnect,
|
||||||
|
after_destruct = digilines.update_autoconnect,
|
||||||
digiline = {
|
digiline = {
|
||||||
semiconductor = {
|
semiconductor = {
|
||||||
rules = function(node, pos, from)
|
rules = function(node, pos, from)
|
||||||
|
Loading…
Reference in New Issue
Block a user