Skip to content

Commit

Permalink
Fix wires not connecting to nodes using digilines def (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
OgelGames committed Jan 21, 2021
1 parent dc6cc0b commit ff525c0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion inventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lightsensor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion rtc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion wire_std.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ for zmy=0, 1 do
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
digiline =
digilines =
{
wire =
{
Expand Down
18 changes: 7 additions & 11 deletions wires_common.lua
Original file line number Diff line number Diff line change
@@ -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}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ff525c0

Please sign in to comment.