forked from mrkubax10/industrialtest
Fix two issues with network map handling
This commit is contained in:
parent
b1fc8b104f
commit
84b853b39d
2
api.lua
2
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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user