1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00
This commit is contained in:
grilledham 2018-05-22 13:55:37 +01:00
parent ee8cc9b5d6
commit 49cfd3ae0a

View File

@ -1,8 +1,7 @@
--[[
This map uses custom ore gen. When generating the map, under the resource settings tab use Size = 'None' for all resources.
]]
local b = require "map_gen.shared.builders"
local b = require 'map_gen.shared.builders'
local ball_r = 16
local big_circle = b.circle(ball_r)
@ -13,13 +12,13 @@ local count = 8
local angle = math.pi / count
local offset_x = 32
local offset_y = 96
for i= 1, count do
for i = 1, count do
local x = offset_x * i
local y = offset_y * math.sin(angle * i)
local c = b.translate(big_circle, x, y)
table.insert(ribben, c)
end
for i= 0, count - 1 do
for i = 0, count - 1 do
local j = i + 0.5
local x = offset_x * j
local y = offset_y * math.sin(angle * j)
@ -28,24 +27,40 @@ for i= 0, count - 1 do
end
ribben = b.any(ribben)
local function value(mult,base)
return function(a, b)
return mult * (math.abs(a) + math.abs(b)) + base
end
local value = b.manhattan_value
local inf = function()
return 100000000
end
local oil_shape = b.circle(0.16 * ball_r)
oil_shape = b.throttle_world_xy(oil_shape, 1, 4, 1, 4)
local resources =
{
b.resource(b.circle(0.2 * ball_r), "iron-ore", value(0.5, 750)),
b.resource(b.circle(0.2 * ball_r), "copper-ore", value(0.5, 750)),
b.resource(b.circle(0.15 * ball_r), "stone", value(0.2, 400)),
b.resource(b.circle(0.05 * ball_r), "uranium-ore", value(0.2, 600)),
b.resource(oil_shape, "crude-oil", value(60, 160000)),
b.resource(b.circle(0.2 * ball_r), "coal", value(0.2, 600)),
b.resource(b.circle(0.2 * ball_r), "iron-ore", value(0.5, 750))
local resources = {
b.any {
b.resource(b.circle(0.02 * ball_r), 'iron-ore', inf),
b.resource(b.circle(0.2 * ball_r), 'iron-ore', value(750, 0.5))
},
b.any {
b.resource(b.circle(0.02 * ball_r), 'copper-ore', inf),
b.resource(b.circle(0.2 * ball_r), 'copper-ore', value(750, 0.5))
},
b.any {
b.resource(b.circle(0.015 * ball_r), 'stone', inf),
b.resource(b.circle(0.15 * ball_r), 'stone', value(400, 0.2))
},
b.any {
b.resource(b.circle(0.005 * ball_r), 'uranium-ore', inf),
b.resource(b.circle(0.05 * ball_r), 'uranium-ore', value(600, 0.2))
},
b.resource(oil_shape, 'crude-oil', value(120000, 50)),
b.any {
b.resource(b.circle(0.02 * ball_r), 'coal', inf),
b.resource(b.circle(0.2 * ball_r), 'coal', value(600, 0.2))
},
b.any {
b.resource(b.circle(0.02 * ball_r), 'iron-ore', inf),
b.resource(b.circle(0.2 * ball_r), 'iron-ore', value(750, 0.5))
}
}
local lines = {}
@ -59,7 +74,7 @@ for i = 1, count - 1 do
local c = lines_circle
c = b.apply_entity(c, resources[i])
c = b.change_map_gen_collision_tile(c,"water-tile", "grass-1")
c = b.change_map_gen_collision_tile(c, 'water-tile', 'grass-1')
local c = b.translate(c, x, 0)
table.insert(lines, c)
@ -67,57 +82,66 @@ for i = 1, count - 1 do
end
lines = b.any(lines)
local dna = b.any{lines, ribben, b.flip_y(ribben)}
local dna = b.any {lines, ribben, b.flip_y(ribben)}
local widith = offset_x * count
dna = b.translate(dna, -widith/ 2, 0)
dna = b.translate(dna, -widith / 2, 0)
local map = b.single_x_pattern(dna, widith)
--[[
local dna1 = b.single_pattern(dna, widith, 6 * widith)
local dna2 = b.single_pattern(dna, widith, 8 * widith)
dna2 = b.rotate(dna2, degrees(60))
dna2 = b.translate(dna2, -3 * widith, 0)
local dna3 = b.single_pattern(dna, widith, 8 * widith)
local dna3 = b.rotate(dna3, degrees(120))
dna3 = b.translate(dna3, 3 * widith, 0)
local map = b.any{dna1, dna2, dna3}
]]
map = b.translate(map, -widith/2, 0)
map = b.translate(map, -widith / 2, 0)
local sea = b.sine_fill(512, 208)
sea = b.any{b.line_x(2), sea, b.flip_y(sea)}
sea = b.change_tile(sea, true, "water")
sea = b.fish(sea, 0.005)
sea = b.any {b.line_x(2), sea, b.flip_y(sea)}
sea = b.change_tile(sea, true, 'water')
sea = b.fish(sea, 0.0025)
map = b.any{map, sea}
map = b.any {map, sea}
map = b.rotate(map, degrees(45))
local start_circle = b.circle(0.3 * ball_r)
local start_circle = b.circle(0.3 * ball_r)
local iron = b.apply_entity(b.scale(start_circle,0.5,0.5), b.resource(b.full_shape, "iron-ore", value(0, 700)))
local copper = b.apply_entity(b.scale(start_circle,0.5,0.5), b.resource(b.full_shape, "copper-ore", value(0, 500)))
local stone = b.apply_entity(b.scale(start_circle,0.5,0.5), b.resource(b.full_shape, "stone", value(0, 250)))
local oil = b.apply_entity(b.scale(start_circle,0.1,0.1), b.resource(b.full_shape, "crude-oil", value(0, 40000)))
local coal = b.apply_entity(b.scale(start_circle,0.5,0.5), b.resource(b.full_shape, "coal", value(0, 800)))
local start_iron =
b.any {
b.resource(b.rectangle(0.2), 'iron-ore', inf),
b.resource(b.full_shape, 'iron-ore', value(700, 0))
}
local start_copper =
b.any {
b.resource(b.rectangle(0.2), 'copper-ore', inf),
b.resource(b.full_shape, 'copper-ore', value(500, 0))
}
local start_stone =
b.any {
b.resource(b.rectangle(0.2), 'stone', inf),
b.resource(b.full_shape, 'stone', value(250, 0))
}
local start_coal =
b.any {
b.resource(b.rectangle(0.2), 'coal', inf),
b.resource(b.full_shape, 'coal', value(800, 0))
}
local start = b.any
{
local iron = b.apply_entity(b.scale(start_circle, 0.5, 0.5), start_iron)
local copper = b.apply_entity(b.scale(start_circle, 0.5, 0.5), start_copper)
local stone = b.apply_entity(b.scale(start_circle, 0.5, 0.5), start_stone)
local oil = b.apply_entity(b.scale(start_circle, 0.1, 0.1), b.resource(b.full_shape, 'crude-oil', value(40000, 0)))
local coal = b.apply_entity(b.scale(start_circle, 0.5, 0.5), start_coal)
local start =
b.any {
b.translate(iron, 0, -9),
b.translate(copper, 0, 9),
b.translate(stone, -9, 0),
b.translate(oil, 9, 9),
b.translate(coal, 9, 0),
b.translate(coal, 9, 0)
}
--start = b.change_map_gen_collision_tile(start,"water-tile", "grass-1")
start = b.any{start, big_circle}
start = b.any {start, big_circle}
map = b.choose(big_circle, start, map)
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
map = b.change_map_gen_collision_tile(map, 'water-tile', 'grass-1')
map = b.scale(map, 6, 6)
map = b.scale(map, 5, 5)
return map