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

Added Builders.remove_decoratives(shape) to builders.lua

Builders.remove_decoratives(shape) removes any decoratives in the given shape.
Update the map scripts, snakey_swamp and snakier_swamp to use this to remove decoratives from the dividers.
This commit is contained in:
Soggs 2019-10-20 05:24:35 +02:00
parent d360169ab7
commit 78dbd16b30
3 changed files with 21 additions and 3 deletions

View File

@ -39,7 +39,8 @@ local path =
b.translate(divider, (path_width + divider_width) / 2, path_width / 2),
b.translate(divider, -(path_width + divider_width) / 2, -path_width / 2)
}
path = b.change_tile(path, true, 'water-shallow')
path = b.change_tile(path, true, 'water-mud')
path = b.remove_decoratives(path)
-- Water Border
local water_rectangle = b.rectangle(tile_width, water_height)

View File

@ -13,9 +13,9 @@ Event.on_init(
end
)
--input
local divider_tile = 'water-shallow'
local divider_tile = 'water-mud'
local path_width = 30
local path_length = 100
local path_length = 120
local turns = 6 -- must be even; 0 makes a normal ribbon world
local divider_width = 10
local water_height = 60 -- setting it to 0 will eliminate the water border; make sure to add another source of water if you do so
@ -58,6 +58,7 @@ local path = b.any
}
path = b.change_tile(path, true, divider_tile)
path = b.remove_decoratives(path)
-- Water Border
local water_rectangle = b.rectangle(tile_width, water_height)

View File

@ -986,6 +986,22 @@ function Builders.apply_decoratives(shape, decorative_shapes)
end
end
--- Removes the decoratives in the given shape
--- This is useful for example when using shapes of 'water-shallow'
function Builders.remove_decoratives(shape)
return function(x, y, world)
local tile = shape(x, y, world)
if not tile then
return false
end
world.surface.destroy_decoratives({position = {x=world.x, y=world.y}})
return tile
end
end
-- pattern builders
--- Docs: https://github.com/Refactorio/RedMew/wiki/Using-the-Builders#builderssingle_pattern