1
1
local surfaces = game .surfaces
2
2
3
3
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)
4
19
local landfill = surface .find_tiles_filtered {
5
20
name = " landfill" ,
6
21
has_hidden_tile = false
7
22
}
23
+
8
24
-- set water as hidden tile
9
25
for _ , tile in pairs (landfill ) do
10
26
surface .set_hidden_tile (tile .position , " water" )
11
27
end
12
28
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)
14
30
local tiles = surface .find_tiles_filtered {
15
31
collision_mask = " water_tile" ,
16
32
name = " landfill" ,
33
+ has_hidden_tile = true ,
17
34
invert = true
18
35
}
36
+
19
37
local to_replace = {}
20
38
for _ , tile in pairs (tiles ) do
21
39
to_replace [# to_replace + 1 ] = {
@@ -29,8 +47,8 @@ for _, surface in pairs(game.surfaces) do
29
47
to_replace
30
48
)
31
49
32
- -- set water as hidden tile
50
+ -- set water as hidden tile (order required because reasons)
33
51
for _ , tile in pairs (to_replace ) do
34
52
surface .set_hidden_tile (tile .position , " water" )
35
53
end
36
- end
54
+ end
0 commit comments