1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-26 03:52:00 +02:00

Fixed pumpjack deconstruction and miners not deconstructing next to wells

This commit is contained in:
Valansch 2017-10-04 01:51:42 +02:00
parent 96357fb0b3
commit 3cfd54b11e

View File

@ -5,9 +5,15 @@ local function is_depleted(drill)
if drill.name == "electric-mining-drill" then
area = {{position.x - 2, position.y - 2},{position.x + 2, position.y + 2}}
else
area = {{position.x - 1, position.y - 1},{position.x + 1, position.y + 1}}
area = {{position.x - 1, position.y - 1},{position.x + 1, position.y + 1}}
end
return #drill.surface.find_entities_filtered{type="resource", area = area} == 1
local count = -1
for _,resource in pairs(drill.surface.find_entities_filtered{type="resource", area = area}) do
if resource.name ~= "crude-oil" then
count = count + 1
end
end
return count == 0
end
local function mark_if_depleted(drill)
@ -20,7 +26,9 @@ local function on_resource_depleted(event)
local area = {{event.entity.position.x-1, event.entity.position.y-1}, {event.entity.position.x+1, event.entity.position.y + 1}}
local drills = event.entity.surface.find_entities_filtered{area = area, type="mining-drill"}
for _,drill in pairs(drills) do
mark_if_depleted(drill)
if drill.name ~= "pumpjack" then
mark_if_depleted(drill)
end
end
end