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)
end
end,
digiline = {
digilines = {
receptor = {},
effector = {
action = function() end

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

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

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

@ -90,7 +90,7 @@ for zmy=0, 1 do
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
digiline =
digilines =
{
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)
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].digiline then
-- need to make sure that node exists (unknown nodes!)
local function check_and_update(pos, node)
if digilines.getspec(node) then
digilines.update_autoconnect(pos)
end
end)
end
minetest.register_on_placenode(check_and_update)
minetest.register_on_dignode(check_and_update)
function digilines.update_autoconnect(pos, secondcall)
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)
end
local def = minetest.registered_nodes[minetest.get_node(pos).name]
local digilinespec = def and def.digiline
local digilinespec = digilines.getspec(minetest.get_node(pos))
if not (digilinespec and digilinespec.wire and
digilinespec.wire.use_autoconnect) then
return nil