1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-20 19:52:58 +02:00
RedMew/map_gen/presets/web.lua

66 lines
1.7 KiB
Lua
Raw Normal View History

2018-05-08 22:23:07 +02:00
local b = require "map_gen.shared.builders"
2018-01-21 17:30:42 +02:00
local stripe_thickness = 24
local stripe_distance = 384
2018-05-08 22:23:07 +02:00
local stripes = b.throttle_y(b.full_shape,stripe_thickness,stripe_distance)
local joint = b.rectangle(64)
joint = b.rotate(joint,degrees(45))
joint = b.translate(joint, 0, stripe_thickness / 2)
local joints = b.single_y_pattern(joint, stripe_distance)
2018-01-21 17:30:42 +02:00
2018-05-08 22:23:07 +02:00
stripes = b.any{stripes, joints}
2018-01-21 17:30:42 +02:00
local lines = {}
local count = 8
local angle = 360 / count
local offset = (180 / count) + 90
for i = 0, count - 1 do
2018-05-08 22:23:07 +02:00
local line =b.rotate(stripes, degrees(i * angle + offset))
2018-01-21 17:30:42 +02:00
table.insert(lines, line)
end
2018-05-08 22:23:07 +02:00
local web = b.segment_pattern(lines)
web = b.rotate(web, degrees(180 / count))
2018-01-21 17:30:42 +02:00
2018-05-08 22:23:07 +02:00
local path = b.path(stripe_thickness)
2018-01-21 17:30:42 +02:00
2018-05-08 22:23:07 +02:00
local leg = b.rectangle(32,480)
local head = b.translate (b.oval(32, 64), 0, -64)
local body = b.translate (b.circle(64), 0, 64)
2018-01-21 17:30:42 +02:00
local count = 10
local angle = 360 / count
local list = { head, body }
for i = 1, (count / 2) - 1 do
2018-05-08 22:23:07 +02:00
local shape = b.rotate(leg, degrees(i * angle))
2018-01-21 17:30:42 +02:00
table.insert( list, shape )
end
2018-05-08 22:23:07 +02:00
local spider = b.any(list)
spider = b.scale(spider,2,2)
2018-01-21 17:30:42 +02:00
2018-05-08 22:23:07 +02:00
local e = b.empty_shape
2018-01-21 17:30:42 +02:00
local function s(r)
2018-05-08 22:23:07 +02:00
return b.rotate(spider, degrees(r))
2018-01-21 17:30:42 +02:00
end
local pattern =
{
{e , s(90) , e , s(0) , e , s(270)},
{s(0) , e , e , e , e , e },
{e , e , s(45) , e , s(315), e },
{s(90) , e , e , e , e , e },
{e , e , s(135), e , s(225), e },
{s(180), e , e , e , e , e },
}
2018-05-08 22:23:07 +02:00
local spiders = b.grid_pattern(pattern, 6, 6, 820, 820)
2018-01-21 17:30:42 +02:00
2018-05-08 22:23:07 +02:00
local map = b.any{ web, path, b.rotate(path, degrees(45)), spiders }
2018-01-21 17:30:42 +02:00
2018-05-08 22:23:07 +02:00
local start = b.circle(150)
map = b.choose(start, b.full_shape, map)
2018-01-21 17:30:42 +02:00
2018-05-08 22:23:07 +02:00
--map = b.scale(map, 0.5, 0.5)
2018-01-21 17:30:42 +02:00
return map