Diode works.

Warning: it may quickly crash the server if you short-cirtuit it!
master
number Zero 2017-01-08 01:02:40 +03:00
commit 2da87e9372
4 changed files with 67 additions and 0 deletions

1
depends.txt Normal file
View File

@ -0,0 +1 @@
digilines

57
diode.lua Normal file
View File

@ -0,0 +1,57 @@
-- © 2017 numberZero
-- License: GNU Lesser General Public License, version 2 (or any later version)
local rules_in = {
[0] = {{x = -1, y = 0, z = 0}},
[1] = {{x = 0, y = 0, z = 1}},
[2] = {{x = 1, y = 0, z = 0}},
[3] = {{x = 0, y = 0, z = -1}},
}
local rules_out = {
[0] = {{x = 1, y = 0, z = 0}},
[1] = {{x = 0, y = 0, z = -1}},
[2] = {{x = -1, y = 0, z = 0}},
[3] = {{x = 0, y = 0, z = 1}},
}
local function diode_rules_in(node)
return rules_in[node.param2]
end
local function diode_rules_out(node)
return rules_out[node.param2]
end
local function diode_action(pos, node, channel, msg)
digiline:receptor_send(pos, diode_rules_out(node), channel, msg)
end
minetest.register_node("digiline_routing:diode", {
description = "Digiline Diode",
drawtype = "nodebox",
tiles = {
"digiline_routing_metal.png"
},
paramtype = "light",
paramtype2 = "facedir",
groups = {dig_immediate=2},
node_box = {
type = "fixed",
fixed = {
{ -8/16, -8/16, -1/16, 8/16, -7/16, 1/16 },
{ 1/16, -8/16, -2/16, 3/16, -6/16, 2/16 },
{ -3/16, -8/16, -4/16, -1/16, -6/16, 4/16 },
{ -1/16, -8/16, -3/16, 1/16, -6/16, 3/16 },
},
},
digiline = {
effector = {
action = diode_action,
rules = diode_rules_in,
},
receptor = {
rules = diode_rules_out,
},
},
})

9
init.lua Normal file
View File

@ -0,0 +1,9 @@
-- © 2017 numberZero
-- License: GNU Lesser General Public License, version 2 (or any later version)
-- License for textures: CreativeCommoms BY-ShareAlike
local MODNAME = "digiline_routing"
local MODPATH = minetest.get_modpath(MODNAME)
-- dofile(MODPATH.."/overheating.lua")
dofile(MODPATH.."/diode.lua")

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B