Fix two issues with network map handling

This commit is contained in:
mrkubax10 2024-03-21 19:33:35 +01:00
parent b1fc8b104f
commit 84b853b39d
2 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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