Integrated Circuitry

by judos

Status bars, compact-combinators to hide your gigantic circuitry inside a 2x2 entity with has 12 io-ports, circuit-poles, optimized lamps for displays. (All UPS friendly)

Content
4 years ago
0.15 - 0.18
53
Circuit network

b Fix for incorrect wire disconection

3 years ago
(updated 3 years ago)

If you reviev entities from the ghost by mods (creative tools or such) "circuitPole_build_electric_pole", rise an uncontrolled error.
So, need to add additional check for neighbour entities before disconect copper wire:

function circuitPole_build_electric_pole(entity)
if not entity.valid or entity.type ~= "electric-pole" then
return
end
-- diconnect all circuit poles and measure distance to poles
local d={}
for k,e in pairs(entity.neighbours.copper) do
-- additional check
if e.valid and e.type == "electric-pole" then
entity.disconnect_neighbour(e)
local distance = math2d.position.distance(entity.position, e.position)
table.insert(d, { distance= distance, entity = e} )
end
end

table.sort(d, function(x, y)
return x.distance < y.distance
end)

for _,arr in pairs(d) do
local e = arr.entity
entity.connect_neighbour(e)
if # entity.neighbours.copper >= 2 then
break
end
end

end

New response