diff --git a/api.lua b/api.lua index f93f6a8..ca21cd3 100644 --- a/api.lua +++ b/api.lua @@ -601,7 +601,7 @@ industrialtest.api.getConnections=function(pos,direction) local powerOutput=(sourceDef.groups._industrialtest_cable or industrialtest.api.isPowerOutput(sourceMeta,normalizedKey)) local powerInput=(sourceDef.groups._industrialtest_cable or industrialtest.api.isPowerInput(sourceMeta,normalizedKey)) if def.groups._industrialtest_cable or industrialtest.api.hasPowerStorage(meta) then - local side=industrialtest.api.getOppositeSide(normalizedKey) + local side=industrialtest.api.normalizeSide(conn,industrialtest.api.getOppositeSide(normalizedKey)) if (powerOutput and directionInput and (def.groups._industrialtest_cable or industrialtest.api.isPowerInput(meta,side))) or ((def.groups._industrialtest_cable or industrialtest.api.isPowerOutput(meta,side)) and powerInput and directionOutput) then table.insert(result,conn) end diff --git a/machines/common.lua b/machines/common.lua index fa38072..eec610c 100644 --- a/machines/common.lua +++ b/machines/common.lua @@ -148,12 +148,11 @@ machine.onDestruct=function(pos) end endpointMeta:set_string("industrialtest.networks",minetest.serialize(networks)) end - else - local networks=industrialtest.api.isAttachedToNetwork(meta) - if networks then - for _,network in ipairs(networks) do - industrialtest.api.removeNodeFromNetwork(network,pos) - end + end + local networks=industrialtest.api.isAttachedToNetwork(meta) + if networks then + for _,network in ipairs(networks) do + industrialtest.api.removeNodeFromNetwork(network,pos) end end end