1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-05 13:15:03 +02:00

Fix collapse not revealing all removed tiles

This commit is contained in:
Gerkiz 2024-03-23 16:53:35 +01:00
parent d7c5cacb0e
commit 91b3514a68
2 changed files with 8 additions and 6 deletions

View File

@ -218,7 +218,7 @@ function Public.reset_map()
Collapse.set_speed(8) Collapse.set_speed(8)
Collapse.set_amount(1) Collapse.set_amount(1)
-- Collapse.set_max_line_size(zone_settings.zone_width) -- Collapse.set_max_line_size(zone_settings.zone_width)
Collapse.set_max_line_size(540) Collapse.set_max_line_size(550)
Collapse.set_surface_index(surface.index) Collapse.set_surface_index(surface.index)
Collapse.start_now(false) Collapse.start_now(false)

View File

@ -31,7 +31,7 @@ local directions = {
if width > this.max_line_size then if width > this.max_line_size then
width = this.max_line_size width = this.max_line_size
end end
local a = width * 0.5 + 1 local a = width * 0.5 + 4
this.vector = {0, -1} this.vector = {0, -1}
this.area = {{position.x - a, position.y - 1}, {position.x + a, position.y}} this.area = {{position.x - a, position.y - 1}, {position.x + a, position.y}}
end, end,
@ -103,7 +103,8 @@ local function set_collapse_tiles(surface)
print_debug(45) print_debug(45)
end end
game.forces.player.chart(surface, this.area) game.forces.player.chart(surface, this.area)
this.tiles = surface.find_tiles_filtered({area = this.area}) this.tiles = surface.find_tiles_filtered({area = this.area, name = 'out-of-map', invert = true})
if not this.tiles then if not this.tiles then
return return
end end
@ -115,7 +116,8 @@ local function set_collapse_tiles(surface)
local v = this.vector local v = this.vector
local area = this.area local area = this.area
this.area = {{area[1][1] + v[1], area[1][2] + v[2]}, {area[2][1] + v[1], area[2][2] + v[2]}} this.area = {{area[1][1] + v[1], area[1][2] + v[2]}, {area[2][1] + v[1], area[2][2] + v[2]}}
game.forces.player.chart(surface, this.area) local chart_area = {{area[1][1] + v[1] + 4, area[1][2] + v[2] + 4}, {area[2][1] + v[1] + 4, area[2][2] + v[2] + 4}}
game.forces.player.chart(surface, chart_area)
end end
local function progress() local function progress()
@ -156,7 +158,7 @@ local function progress()
if this.specific_entities.enabled then if this.specific_entities.enabled then
local position = {tile.position.x + 0.5, tile.position.y + 0.5} local position = {tile.position.x + 0.5, tile.position.y + 0.5}
local entities = this.specific_entities.entities local entities = this.specific_entities.entities
for _, e in pairs(surface.find_entities_filtered({area = {{position[1] - 2, position[2] - 2}, {position[1] + 2, position[2] + 2}}})) do for _, e in pairs(surface.find_entities_filtered({area = {{position[1] - 4, position[2] - 2}, {position[1] + 4, position[2] + 2}}})) do
if entities[e.name] and e.valid and e.health then if entities[e.name] and e.valid and e.health then
e.die() e.die()
elseif e.valid then elseif e.valid then
@ -166,7 +168,7 @@ local function progress()
end end
if this.kill then if this.kill then
local position = {tile.position.x + 0.5, tile.position.y + 0.5} local position = {tile.position.x + 0.5, tile.position.y + 0.5}
for _, e in pairs(surface.find_entities_filtered({area = {{position[1] - 2, position[2] - 2}, {position[1] + 2, position[2] + 2}}})) do for _, e in pairs(surface.find_entities_filtered({area = {{position[1] - 4, position[2] - 2}, {position[1] + 4, position[2] + 2}}})) do
if e.valid and e.health then if e.valid and e.health then
e.die() e.die()
end end