From d8335494f3e78366da271717163ba3fa57cca02d Mon Sep 17 00:00:00 2001 From: Jayefuu Date: Wed, 5 Dec 2018 13:50:02 +0000 Subject: [PATCH] Added builders.circular_pattern --- map_gen/shared/builders.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/map_gen/shared/builders.lua b/map_gen/shared/builders.lua index dbbdb22f..a47903cd 100644 --- a/map_gen/shared/builders.lua +++ b/map_gen/shared/builders.lua @@ -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))