Fix wires not connecting to nodes using digilines def (#68)

This commit is contained in:
OgelGames 2021-01-22 03:47:55 +11:00 committed by GitHub
parent dc6cc0b04a
commit ff525c09a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 16 deletions

@ -97,7 +97,7 @@ minetest.register_node("digilines:chest", {
minetest.get_meta(pos):set_string("channel",fields.channel) minetest.get_meta(pos):set_string("channel",fields.channel)
end end
end, end,
digiline = { digilines = {
receptor = {}, receptor = {},
effector = { effector = {
action = function() end action = function() end

@ -313,7 +313,7 @@ minetest.register_node("digilines:lcd", {
minetest.get_meta(pos):set_string("channel", fields.channel) minetest.get_meta(pos):set_string("channel", fields.channel)
end end
end, end,
digiline = { digilines = {
receptor = {}, receptor = {},
effector = { effector = {
action = on_digiline_receive action = on_digiline_receive

@ -39,7 +39,7 @@ minetest.register_node("digilines:lightsensor", {
groups = {dig_immediate=2}, groups = {dig_immediate=2},
selection_box = lsensor_selbox, selection_box = lsensor_selbox,
node_box = lsensor_nodebox, node_box = lsensor_nodebox,
digiline = digilines =
{ {
receptor = {}, receptor = {},
effector = { effector = {

@ -35,7 +35,7 @@ minetest.register_node("digilines:rtc", {
groups = {dig_immediate=2}, groups = {dig_immediate=2},
selection_box = rtc_selbox, selection_box = rtc_selbox,
node_box = rtc_nodebox, node_box = rtc_nodebox,
digiline = digilines =
{ {
receptor = {}, receptor = {},
effector = { effector = {

@ -90,7 +90,7 @@ for zmy=0, 1 do
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
digiline = digilines =
{ {
wire = wire =
{ {

@ -1,15 +1,12 @@
minetest.register_on_placenode(function(pos, node)
if minetest.registered_nodes[node.name].digiline then
digilines.update_autoconnect(pos)
end
end)
minetest.register_on_dignode(function(pos, node) local function check_and_update(pos, node)
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].digiline then if digilines.getspec(node) then
-- need to make sure that node exists (unknown nodes!)
digilines.update_autoconnect(pos) digilines.update_autoconnect(pos)
end end
end) end
minetest.register_on_placenode(check_and_update)
minetest.register_on_dignode(check_and_update)
function digilines.update_autoconnect(pos, secondcall) function digilines.update_autoconnect(pos, secondcall)
local xppos = {x=pos.x+1, y=pos.y, z=pos.z} local xppos = {x=pos.x+1, y=pos.y, z=pos.z}
@ -42,8 +39,7 @@ function digilines.update_autoconnect(pos, secondcall)
digilines.update_autoconnect(zmympos, true) digilines.update_autoconnect(zmympos, true)
end end
local def = minetest.registered_nodes[minetest.get_node(pos).name] local digilinespec = digilines.getspec(minetest.get_node(pos))
local digilinespec = def and def.digiline
if not (digilinespec and digilinespec.wire and if not (digilinespec and digilinespec.wire and
digilinespec.wire.use_autoconnect) then digilinespec.wire.use_autoconnect) then
return nil return nil