Skip to content

Commit f67653c

Browse files
this might fix the landfill stuff
1 parent 1e334bc commit f67653c

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

migrations/PyBlock_3.2.0.lua

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
11
local surfaces = game.surfaces
22

33
for _, surface in pairs(game.surfaces) do
4+
-- get non-landfill non-water tiles that do have a hidden tile but not double hidden (i.e. stone bricks on landfill not on water)
5+
local double_tiles = surface.find_tiles_filtered{
6+
collision_mask = "water_tile",
7+
name = "landfill",
8+
has_hidden_tile = false,
9+
has_double_hidden_tile = true,
10+
invert = true
11+
}
12+
13+
-- set water as the double hidden tile for those tiles
14+
for _, tile in pairs(double_tiles) do
15+
surface.set_double_hidden_tile(tile.position, "water")
16+
end
17+
18+
-- find landfill tiles that do not have a hidden tile (i.e. landfill as the base tile, not minable)
419
local landfill = surface.find_tiles_filtered{
520
name = "landfill",
621
has_hidden_tile = false
722
}
23+
824
-- set water as hidden tile
925
for _, tile in pairs(landfill) do
1026
surface.set_hidden_tile(tile.position, "water")
1127
end
1228

13-
-- get normal non-water tiles
29+
-- get non-landfill non-water tiles that do not have a hidden tile and not double hidden (i.e. mapgen placed dirt or sand)
1430
local tiles = surface.find_tiles_filtered{
1531
collision_mask = "water_tile",
1632
name = "landfill",
33+
has_hidden_tile = true,
1734
invert = true
1835
}
36+
1937
local to_replace = {}
2038
for _, tile in pairs(tiles) do
2139
to_replace[#to_replace+1] = {
@@ -29,8 +47,8 @@ for _, surface in pairs(game.surfaces) do
2947
to_replace
3048
)
3149

32-
-- set water as hidden tile
50+
-- set water as hidden tile (order required because reasons)
3351
for _, tile in pairs(to_replace) do
3452
surface.set_hidden_tile(tile.position, "water")
3553
end
36-
end
54+
end

0 commit comments

Comments
 (0)