Fixer miner circuit connections (#12)

This commit is contained in:
2024-12-06 21:09:25 +09:00
committed by GitHub
parent 214b2d8b3b
commit 26d3c9788e

View File

@@ -17,6 +17,8 @@ local function drop_target(entity)
if #entities > 0 then if #entities > 0 then
return entities[1] return entities[1]
else
return nil
end end
end end
end end
@@ -27,10 +29,16 @@ local function check_entity(entity)
return true return true
end end
if next(entity.circuit_connected_entities.red) ~= nil or next(entity.circuit_connected_entities.green) ~= nil then local egcn = entity.get_wire_connectors()
if egcn then
for k, _ in pairs(egcn) do
if k == defines.wire_connector_id.circuit_red or k == defines.wire_connector_id.circuit_green then
-- connected to circuit network -- connected to circuit network
return true return true
end end
end
end
if not entity.minable then if not entity.minable then
-- if it is minable -- if it is minable
@@ -53,6 +61,10 @@ end
local function chest_check(entity) local function chest_check(entity)
local target = drop_target(entity) local target = drop_target(entity)
if target == nil then
return
end
if check_entity(entity) then if check_entity(entity) then
return return
end end