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

Merge pull request #514 from Jayefuu/patch-4

Added builders.circular_pattern
This commit is contained in:
grilledham 2018-12-07 19:32:19 +00:00 committed by GitHub
commit d8ad43b171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -963,6 +963,17 @@ function Builders.grid_pattern_full_overlap(pattern, columns, rows, width, heigh
end
end
-- Tile a shape in a circular pattern
function Builders.circular_pattern(shape, quantity, radius)
local pattern = {}
local angle = tau / quantity
for i = 1, quantity do
local shape2 = Builders.rotate(Builders.translate(shape, 0, radius), i * angle)
table.insert(pattern, shape2)
end
return Builders.any(pattern)
end
local function is_spiral(x, y)
local a = -math.max(math.abs(x), math.abs(y))