digicontrol/splitter.lua

47 lines
1.1 KiB
Lua
Raw Normal View History

2021-01-23 11:27:31 +01:00
minetest.register_node("digicontrol:splitter", {
description = "Digilines Splitter",
inventory_image = "digicontrol_splitter.png",
tiles = {
"digicontrol_splitter.png",
"digicontrol_bottom.png",
"digicontrol_side.png",
"digicontrol_side_port.png",
"digicontrol_side_port.png",
"digicontrol_side_port.png"
},
drawtype = "nodebox",
node_box = digicontrol.node_box,
selection_box = digicontrol.selection_box,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {digicontrol = 1, dig_immediate = 2},
digiline = {
semiconductor = {
rules = function(node, pos, from)
local side = digicontrol.get_side(pos, from, node.param2)
if side == 3 then
return {
digicontrol.get_rule(0, node.param2),
digicontrol.get_rule(2, node.param2)
}
elseif side == 0 or side == 2 then
return {
digicontrol.get_rule(3, node.param2)
}
end
end
},
wire = {
rules = function(node)
return {
digicontrol.get_rule(0, node.param2),
digicontrol.get_rule(2, node.param2),
digicontrol.get_rule(3, node.param2)
}
end
}
}
})