Skip to content

Commit

Permalink
Refactor do_landfill_hidden_tile (#1454)
Browse files Browse the repository at this point in the history
  • Loading branch information
RedRafe authored Nov 23, 2024
1 parent e6fadf7 commit f04b99e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions map_gen/shared/generate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ local function do_tile_inner(tiles, tile, pos)
end
end

local function do_landfill_hidden_tile(tiles, tile, pos)
local tt = type(tile) == 'table'
local tile_name = (tt and tile.tile) or tile
local hidden_tile = tt and tile.hidden_tile
if tile_name == 'landfill' and not hidden_tile then
insert(tiles, {tile = 'water-shallow', position = pos})
end
end

local function do_tile(y, x, data, shape)
local pos = {x, y}

Expand Down Expand Up @@ -63,6 +72,7 @@ local function do_tile(y, x, data, shape)
else
do_tile_inner(data.tiles, tile, pos)
end
do_landfill_hidden_tile(data.hidden_tiles, tile, pos)
end

local function do_row(row, data, shape)
Expand Down Expand Up @@ -109,6 +119,7 @@ local function do_row(row, data, shape)
else
do_tile_inner(tiles, tile, pos)
end
do_landfill_hidden_tile(data.hidden_tiles, tile, pos)
end
end

Expand Down

0 comments on commit f04b99e

Please sign in to comment.