mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
made builder functions local
This commit is contained in:
parent
abc221427f
commit
a975beb146
@ -5,10 +5,12 @@ map_gen_rows_per_tick = 4 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local pic = require "map_gen.data.presets.CSrMap"
|
||||
local pic = decompress(pic)
|
||||
local map = picture_builder(pic)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local map = single_pattern_builder(map, pic.width, pic.height)
|
||||
local pic = require "map_gen.data.presets.CSrMap"
|
||||
local pic = b.decompress(pic)
|
||||
local map = b.picture(pic)
|
||||
|
||||
local map = b.single_pattern(map, pic.width, pic.height)
|
||||
|
||||
return map
|
@ -5,10 +5,12 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local pic = require "map_gen.data.presets.GoT"
|
||||
local pic = decompress(pic)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
local shape = translate(shape, 752, -408)
|
||||
local pic = require "map_gen.data.presets.GoT"
|
||||
local pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
local shape = b.translate(shape, 752, -408)
|
||||
|
||||
return shape
|
||||
|
@ -5,17 +5,19 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.UK"
|
||||
local pic = decompress(pic)
|
||||
local map = picture_builder(pic)
|
||||
local pic = b.decompress(pic)
|
||||
local map = b.picture(pic)
|
||||
|
||||
-- this changes the size of the map
|
||||
map = scale(map, 2, 2)
|
||||
map = b.scale(map, 2, 2)
|
||||
|
||||
-- this moves the map, effectively changing the spawn point.
|
||||
map = translate(map, 0, 10)
|
||||
map = b.translate(map, 0, 10)
|
||||
|
||||
-- this sets the tile outside the bounds of the map to deepwater, remove this and it will be void.
|
||||
map = change_tile(map, false, "deepwater")
|
||||
map = b.change_tile(map, false, "deepwater")
|
||||
|
||||
return map
|
||||
|
@ -5,15 +5,17 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.antfarm"
|
||||
pic = decompress(pic)
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local scale_factor = 12
|
||||
local shape = picture_builder(pic)
|
||||
--shape = invert(shape)
|
||||
local shape = b.picture(pic)
|
||||
--shape = b.invert(shape)
|
||||
|
||||
local map = single_pattern_builder(shape, pic.width, pic.height)
|
||||
map = translate(map, -12, 2)
|
||||
map = scale(map, scale_factor, scale_factor)
|
||||
local map = b.single_pattern(shape, pic.width, pic.height)
|
||||
map = b.translate(map, -12, 2)
|
||||
map = b.scale(map, scale_factor, scale_factor)
|
||||
|
||||
return map
|
||||
|
@ -5,14 +5,16 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.broken_web"
|
||||
pic = decompress(pic)
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
shape = invert(shape)
|
||||
local shape = b.picture(pic)
|
||||
shape = b.invert(shape)
|
||||
|
||||
local map = single_pattern_builder(shape, pic.width, pic.height - 1)
|
||||
map = translate(map, 10, -27)
|
||||
map = scale(map, 12, 12)
|
||||
local map = b.single_pattern(shape, pic.width, pic.height - 1)
|
||||
map = b.translate(map, 10, -27)
|
||||
map = b.scale(map, 12, 12)
|
||||
|
||||
return map
|
@ -5,6 +5,8 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local function no_resources(x, y, world, tile)
|
||||
for _, e in ipairs(world.surface.find_entities_filtered({type = "resource", area = {{world.x, world.y}, {world.x + 1, world.y + 1}}})) do
|
||||
e.destroy()
|
||||
@ -33,55 +35,55 @@ local function no_enemies(x, y, world, tile)
|
||||
return tile
|
||||
end
|
||||
|
||||
local small_dot = circle_builder(96)
|
||||
local mediumn_dot = circle_builder(128)
|
||||
local big_dot = circle_builder(160)
|
||||
local small_dot = b.circle(96)
|
||||
local mediumn_dot = b.circle(128)
|
||||
local big_dot = b.circle(160)
|
||||
|
||||
local arms = path_builder(48)
|
||||
arms = change_tile(arms, true, "water")
|
||||
local arms = b.path(48)
|
||||
arms = b.change_tile(arms, true, "water")
|
||||
|
||||
local arms2 = rotate(arms, degrees(45))
|
||||
local arms2 = b.rotate(arms, degrees(45))
|
||||
|
||||
local shape = compound_or{translate(arms2, 480, 0), translate(arms2, -480, 0), mediumn_dot, arms}
|
||||
shape = apply_effect(shape, no_resources)
|
||||
--shape = apply_effect(shape, less_resources)
|
||||
shape = apply_effect(shape, no_enemies)
|
||||
local shape = b.any{b.translate(arms2, 480, 0), b.translate(arms2, -480, 0), mediumn_dot, arms}
|
||||
shape = b.apply_effect(shape, no_resources)
|
||||
--shape = b.apply_effect(shape, less_resources)
|
||||
shape = b.apply_effect(shape, no_enemies)
|
||||
|
||||
|
||||
local shape2 = compound_and{big_dot, invert(small_dot)}
|
||||
shape2 = choose(big_dot, shape2, compound_or{arms, rotate(arms, degrees(45))})
|
||||
--shape2 = apply_effect(shape2, less_resources)
|
||||
local start = apply_effect(mediumn_dot, no_resources)
|
||||
local shape2 = b.all{big_dot, b.invert(small_dot)}
|
||||
shape2 = b.choose(big_dot, shape2, b.any{arms, b.rotate(arms, degrees(45))})
|
||||
--shape2 = b.apply_effect(shape2, less_resources)
|
||||
local start = b.apply_effect(mediumn_dot, no_resources)
|
||||
|
||||
local iron = circle_builder(16)
|
||||
iron = translate(iron, 0, -96)
|
||||
--iron = rotate(iron, degrees(0))
|
||||
iron = resource_module_builder(iron, "iron-ore", function(x, y) return 700 end)
|
||||
local iron = b.circle(16)
|
||||
iron = b.translate(iron, 0, -96)
|
||||
--iron = b.rotate(iron, degrees(0))
|
||||
iron = b.resource(iron, "iron-ore", function(x, y) return 700 end)
|
||||
|
||||
local copper = circle_builder(12)
|
||||
copper = translate(copper, 0, -96)
|
||||
copper = rotate(copper, degrees(72))
|
||||
copper = resource_module_builder(copper, "copper-ore", function(x, y) return 600 end)
|
||||
local copper = b.circle(12)
|
||||
copper = b.translate(copper, 0, -96)
|
||||
copper = b.rotate(copper, degrees(72))
|
||||
copper = b.resource(copper, "copper-ore", function(x, y) return 600 end)
|
||||
|
||||
local stone = circle_builder(8)
|
||||
stone = translate(stone, 0, -96)
|
||||
stone = rotate(stone, degrees(144))
|
||||
stone = resource_module_builder(stone, "stone", function(x, y) return 1500 end)
|
||||
local stone = b.circle(8)
|
||||
stone = b.translate(stone, 0, -96)
|
||||
stone = b.rotate(stone, degrees(144))
|
||||
stone = b.resource(stone, "stone", function(x, y) return 1500 end)
|
||||
|
||||
local coal = circle_builder(10)
|
||||
coal = translate(coal, 0, -96)
|
||||
coal = rotate(coal, degrees(216))
|
||||
coal = resource_module_builder(coal, "coal", function(x, y) return 850 end)
|
||||
local coal = b.circle(10)
|
||||
coal = b.translate(coal, 0, -96)
|
||||
coal = b.rotate(coal, degrees(216))
|
||||
coal = b.resource(coal, "coal", function(x, y) return 850 end)
|
||||
|
||||
local oil = circle_builder(5)
|
||||
oil = throttle_xy(oil, 1, 3, 1, 3)
|
||||
oil = translate(oil, 0, -96)
|
||||
oil = rotate(oil, degrees(288))
|
||||
oil = resource_module_builder(oil, "crude-oil", function(x, y) return 60000 end)
|
||||
local oil = b.circle(5)
|
||||
oil = b.throttle_xy(oil, 1, 3, 1, 3)
|
||||
oil = b.translate(oil, 0, -96)
|
||||
oil = b.rotate(oil, degrees(288))
|
||||
oil = b.resource(oil, "crude-oil", function(x, y) return 60000 end)
|
||||
|
||||
start = builder_with_resource(mediumn_dot, compound_or{iron, copper, stone, coal, oil})
|
||||
start = b.apply_entity(mediumn_dot, b.any{iron, copper, stone, coal, oil})
|
||||
|
||||
start = apply_effect(start, no_resources)
|
||||
start = b.apply_effect(start, no_resources)
|
||||
|
||||
local pattern =
|
||||
{
|
||||
@ -89,9 +91,9 @@ local pattern =
|
||||
{shape2, shape}
|
||||
}
|
||||
|
||||
local map = grid_pattern_builder(pattern, 2, 2, 480, 480)
|
||||
map = choose(mediumn_dot, start, map)
|
||||
local map = b.grid_pattern(pattern, 2, 2, 480, 480)
|
||||
map = b.choose(mediumn_dot, start, map)
|
||||
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
|
||||
return map
|
||||
|
@ -5,6 +5,8 @@ map_gen_rows_per_tick = 4 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local seed1 = 666
|
||||
local seed2 = 999
|
||||
|
||||
@ -16,20 +18,20 @@ local Random = require "map_gen.shared.random"
|
||||
local random = Random.new(seed1, seed2)
|
||||
|
||||
local pic = require "map_gen.data.presets.cookie"
|
||||
local pic = decompress(pic)
|
||||
local cookie1 = picture_builder(pic)
|
||||
local cookie = scale(cookie1, 0.1, 0.1)
|
||||
local pic = b.decompress(pic)
|
||||
local cookie1 = b.picture(pic)
|
||||
local cookie = b.scale(cookie1, 0.1, 0.1)
|
||||
|
||||
local ore_shape = circle_builder(1.5)
|
||||
local ore_shape = b.circle(1.5)
|
||||
|
||||
local ores = {
|
||||
{resource_module_builder(ore_shape, "iron-ore", value), 24},
|
||||
{resource_module_builder(ore_shape, "copper-ore", value), 12},
|
||||
{resource_module_builder(ore_shape, "stone", value), 4},
|
||||
{resource_module_builder(ore_shape, "coal", value), 8},
|
||||
{resource_module_builder(ore_shape, "uranium-ore", value), 1},
|
||||
{resource_module_builder(circle_builder(1), "crude-oil", manhattan_ore_value(250000, 250)), 3},
|
||||
--{empty_builder, 10}
|
||||
{b.resource(ore_shape, "iron-ore", value), 24},
|
||||
{b.resource(ore_shape, "copper-ore", value), 12},
|
||||
{b.resource(ore_shape, "stone", value), 4},
|
||||
{b.resource(ore_shape, "coal", value), 8},
|
||||
{b.resource(ore_shape, "uranium-ore", value), 1},
|
||||
{b.resource(b.circle(1), "crude-oil", b.manhattan_value(250000, 250)), 3},
|
||||
--{b.empty_shape, 10}
|
||||
}
|
||||
|
||||
local total_weights = {}
|
||||
@ -48,7 +50,7 @@ local function makeChips()
|
||||
end
|
||||
|
||||
local shape = ores[index][1]
|
||||
if shape == empty_builder then
|
||||
if shape == b.empty_shape then
|
||||
return nil
|
||||
end
|
||||
|
||||
@ -57,7 +59,7 @@ local function makeChips()
|
||||
local x_offset = random:next_int(-20, 20)
|
||||
local y_offset = random:next_int(-20, 20)
|
||||
|
||||
local shape2 = translate(shape, x_offset, y_offset)
|
||||
local shape2 = b.translate(shape, x_offset, y_offset)
|
||||
|
||||
table.insert(chips, shape2)
|
||||
end
|
||||
@ -77,7 +79,7 @@ for c = 1, p_cols do
|
||||
|
||||
local shape
|
||||
if chips then
|
||||
shape = builder_with_resource(cookie, compound_or(chips))
|
||||
shape = b.apply_entity(cookie, b.any(chips))
|
||||
else
|
||||
shape = cookie
|
||||
end
|
||||
@ -87,16 +89,16 @@ for c = 1, p_cols do
|
||||
local x_offset = random:next_int(-8, 8)
|
||||
local y_offset = random:next_int(-8, 8)
|
||||
|
||||
shape = rotate(shape, degrees(angle))
|
||||
shape = scale(shape, s, s * 0.75)
|
||||
shape = translate(shape, x_offset, y_offset)
|
||||
shape = b.rotate(shape, degrees(angle))
|
||||
shape = b.scale(shape, s, s * 0.75)
|
||||
shape = b.translate(shape, x_offset, y_offset)
|
||||
|
||||
table.insert(row, shape)
|
||||
end
|
||||
end
|
||||
|
||||
local cookies = grid_pattern_full_overlap_builder(pattern, p_cols, p_rows, 64 * 1.25, 41 * 1.25 * 0.5)
|
||||
cookies = flip_y(cookies)
|
||||
local cookies = b.grid_pattern_full_overlap(pattern, p_cols, p_rows, 64 * 1.25, 41 * 1.25 * 0.5)
|
||||
cookies = b.flip_y(cookies)
|
||||
|
||||
local tablecloth = {
|
||||
height = 2,
|
||||
@ -106,11 +108,11 @@ local tablecloth = {
|
||||
{"water", "deepwater", }
|
||||
}
|
||||
}
|
||||
local tablecloth = picture_builder(tablecloth)
|
||||
tablecloth = single_pattern_builder(tablecloth, 2, 2)
|
||||
tablecloth = scale(tablecloth, 42, 42)
|
||||
tablecloth = spawn_fish(tablecloth, 0.005)
|
||||
local tablecloth = b.picture(tablecloth)
|
||||
tablecloth = b.single_pattern(tablecloth, 2, 2)
|
||||
tablecloth = b.scale(tablecloth, 42, 42)
|
||||
tablecloth = b.fish(tablecloth, 0.005)
|
||||
|
||||
map = shape_or_else(cookies, tablecloth)
|
||||
map = b.if_else(cookies, tablecloth)
|
||||
|
||||
return map
|
||||
|
@ -5,22 +5,24 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
require "map_gen.shared.generate_not_threaded"
|
||||
--require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.creation_of_adam"
|
||||
local pic = decompress(pic)
|
||||
local pic = b.decompress(pic)
|
||||
|
||||
local scale_factor = 3
|
||||
local shape = picture_builder(pic)
|
||||
shape = scale(shape, scale_factor, scale_factor)
|
||||
local shape = b.picture(pic)
|
||||
shape = b.scale(shape, scale_factor, scale_factor)
|
||||
|
||||
local pattern =
|
||||
{
|
||||
{ shape , flip_x(shape) },
|
||||
{ flip_y(shape), flip_xy(shape) }
|
||||
{ shape , b.flip_x(shape) },
|
||||
{ b.flip_y(shape), b.flip_xy(shape) }
|
||||
}
|
||||
|
||||
local map = grid_pattern_builder(pattern, 2, 2, pic.width * scale_factor, pic.height * scale_factor)
|
||||
map = translate(map, 128 * scale_factor, 26 * scale_factor)
|
||||
local map = b.grid_pattern(pattern, 2, 2, pic.width * scale_factor, pic.height * scale_factor)
|
||||
map = b.translate(map, 128 * scale_factor, 26 * scale_factor)
|
||||
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
|
||||
return map
|
@ -5,12 +5,14 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local pic = require "map_gen.data.presets.crosses"
|
||||
pic = decompress(pic)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
local map = single_pattern_builder(shape, pic.width, pic.height)
|
||||
map = translate(map, 10, -4)
|
||||
map = scale(map, 12, 12)
|
||||
local pic = require "map_gen.data.presets.crosses"
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
local map = b.single_pattern(shape, pic.width, pic.height)
|
||||
map = b.translate(map, 10, -4)
|
||||
map = b.scale(map, 12, 12)
|
||||
|
||||
return map
|
@ -5,16 +5,18 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local scale_factor = 64
|
||||
|
||||
local pic = require "map_gen.data.presets.crosses3"
|
||||
pic = decompress(pic)
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
shape = scale(shape, scale_factor, scale_factor)
|
||||
local shape = b.picture(pic)
|
||||
shape = b.scale(shape, scale_factor, scale_factor)
|
||||
|
||||
local map = single_pattern_builder(shape, (pic.width - 24.5 ) * scale_factor + 6, (pic.height - 21.5) * scale_factor - 6)
|
||||
map = rotate(map, degrees(45))
|
||||
map = translate(map, 48, -176)
|
||||
local map = b.single_pattern(shape, (pic.width - 24.5 ) * scale_factor + 6, (pic.height - 21.5) * scale_factor - 6)
|
||||
map = b.rotate(map, degrees(45))
|
||||
map = b.translate(map, 48, -176)
|
||||
|
||||
return map
|
@ -9,37 +9,39 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local body = rotate(oval_builder(128,256), degrees(20))
|
||||
local butt = translate(rotate(oval_builder(180, 128), degrees(30)), 130,100)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local shaft = translate(rotate(oval_builder(32, 80), degrees(0)), 220, -80)
|
||||
local ball1 = translate(rotate(oval_builder(32,16), degrees(10)), 250,-50)
|
||||
local ball2 = translate(rotate(oval_builder(48,16), degrees(5)), 240,-40)
|
||||
local body = b.rotate(b.oval(128,256), degrees(20))
|
||||
local butt = b.translate(b.rotate(b.oval(180, 128), degrees(30)), 130,100)
|
||||
|
||||
local leg1 = translate(rotate(rectangle_builder(16, 80), degrees(175)), 80, 280)
|
||||
local leg2 = translate(rotate(rectangle_builder(16, 80), degrees(5)), 180, 250)
|
||||
local foot1 = translate(rotate(rectangle_builder(16, 40), degrees(65)), 65, 315)
|
||||
local foot2 = translate(rotate(rectangle_builder(16, 40), degrees(65)), 170, 285)
|
||||
local shaft = b.translate(b.rotate(b.oval(32, 80), degrees(0)), 220, -80)
|
||||
local ball1 = b.translate(b.rotate(b.oval(32,16), degrees(10)), 250,-50)
|
||||
local ball2 = b.translate(b.rotate(b.oval(48,16), degrees(5)), 240,-40)
|
||||
|
||||
local eye1 = translate(circle_builder(32),-130, -100)
|
||||
local leg1 = b.translate(b.rotate(b.rectangle(16, 80), degrees(175)), 80, 280)
|
||||
local leg2 = b.translate(b.rotate(b.rectangle(16, 80), degrees(5)), 180, 250)
|
||||
local foot1 = b.translate(b.rotate(b.rectangle(16, 40), degrees(65)), 65, 315)
|
||||
local foot2 = b.translate(b.rotate(b.rectangle(16, 40), degrees(65)), 170, 285)
|
||||
|
||||
local dickbutt = compound_or({body,butt, shaft, ball1, ball2, leg1, leg2, foot1, foot2, eye1 })
|
||||
dickbutt = translate(dickbutt, -80, 0)
|
||||
local eye1 = b.translate(b.circle(32),-130, -100)
|
||||
|
||||
local patch = scale(dickbutt, 0.15, 0.15)
|
||||
local iron_patch = resource_module_builder(translate(scale(dickbutt, 0.15, 0.15), 20, 0), "iron-ore")
|
||||
local copper_patch = resource_module_builder(translate(scale(dickbutt, 0.115, 0.115), -125, 50), "copper-ore")
|
||||
local coal_patch = resource_module_builder(translate(scale(dickbutt, 0.1, 0.1), -135, -90), "coal")
|
||||
local stone_patch = resource_module_builder(translate(scale(dickbutt, 0.075, 0.075), 50, 150), "stone")
|
||||
local dickbutt = b.any({body,butt, shaft, ball1, ball2, leg1, leg2, foot1, foot2, eye1 })
|
||||
dickbutt = b.translate(dickbutt, -80, 0)
|
||||
|
||||
local patches = compound_or({ iron_patch, copper_patch, coal_patch, stone_patch })
|
||||
local patch = b.scale(dickbutt, 0.15, 0.15)
|
||||
local iron_patch = b.resource(b.translate(b.scale(dickbutt, 0.15, 0.15), 20, 0), "iron-ore")
|
||||
local copper_patch = b.resource(b.translate(b.scale(dickbutt, 0.115, 0.115), -125, 50), "copper-ore")
|
||||
local coal_patch = b.resource(b.translate(b.scale(dickbutt, 0.1, 0.1), -135, -90), "coal")
|
||||
local stone_patch = b.resource(b.translate(b.scale(dickbutt, 0.075, 0.075), 50, 150), "stone")
|
||||
|
||||
dickbutt = builder_with_resource(dickbutt, patches)
|
||||
local patches = b.any({ iron_patch, copper_patch, coal_patch, stone_patch })
|
||||
|
||||
local dickbutt2 = rotate(dickbutt, degrees(45))
|
||||
local dickbutt3 = rotate(dickbutt, degrees(90))
|
||||
local dickbutt4 = rotate(dickbutt, degrees(135))
|
||||
local dickbutt5 = rotate(dickbutt, degrees(180))
|
||||
dickbutt = b.apply_entity(dickbutt, patches)
|
||||
|
||||
local dickbutt2 = b.rotate(dickbutt, degrees(45))
|
||||
local dickbutt3 = b.rotate(dickbutt, degrees(90))
|
||||
local dickbutt4 = b.rotate(dickbutt, degrees(135))
|
||||
local dickbutt5 = b.rotate(dickbutt, degrees(180))
|
||||
|
||||
local pattern =
|
||||
{
|
||||
@ -50,7 +52,7 @@ local pattern =
|
||||
{ dickbutt5, dickbutt, dickbutt2, dickbutt3, dickbutt4 },
|
||||
}
|
||||
|
||||
local map = grid_pattern_builder(pattern, 5, 5, 650, 650)
|
||||
map = change_tile(map, false, "water")
|
||||
local map = b.grid_pattern(pattern, 5, 5, 650, 650)
|
||||
map = b.change_tile(map, false, "water")
|
||||
|
||||
return map
|
@ -9,9 +9,11 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local ball_r = 16
|
||||
local big_circle = circle_builder(ball_r)
|
||||
local small_circle = circle_builder(0.6 * ball_r)
|
||||
local big_circle = b.circle(ball_r)
|
||||
local small_circle = b.circle(0.6 * ball_r)
|
||||
|
||||
local ribben = {big_circle}
|
||||
local count = 8
|
||||
@ -21,17 +23,17 @@ local offset_y = 96
|
||||
for i= 1, count do
|
||||
local x = offset_x * i
|
||||
local y = offset_y * math.sin(angle * i)
|
||||
local c = translate(big_circle, x, y)
|
||||
local c = b.translate(big_circle, x, y)
|
||||
table.insert(ribben, c)
|
||||
end
|
||||
for i= 0, count - 1 do
|
||||
local j = i + 0.5
|
||||
local x = offset_x * j
|
||||
local y = offset_y * math.sin(angle * j)
|
||||
local c = translate(small_circle, x, y)
|
||||
local c = b.translate(small_circle, x, y)
|
||||
table.insert(ribben, c)
|
||||
end
|
||||
ribben = compound_or(ribben)
|
||||
ribben = b.any(ribben)
|
||||
|
||||
local function value(mult,base)
|
||||
return function(a, b)
|
||||
@ -39,90 +41,90 @@ local function value(mult,base)
|
||||
end
|
||||
end
|
||||
|
||||
local oil_shape = circle_builder(0.16 * ball_r)
|
||||
oil_shape = throttle_world_xy(oil_shape, 1, 4, 1, 4)
|
||||
local oil_shape = b.circle(0.16 * ball_r)
|
||||
oil_shape = b.throttle_world_xy(oil_shape, 1, 4, 1, 4)
|
||||
|
||||
local resources =
|
||||
{
|
||||
resource_module_builder(circle_builder(0.2 * ball_r), "iron-ore", value(0.5, 750)),
|
||||
resource_module_builder(circle_builder(0.2 * ball_r), "copper-ore", value(0.5, 750)),
|
||||
resource_module_builder(circle_builder(0.15 * ball_r), "stone", value(0.2, 400)),
|
||||
resource_module_builder(circle_builder(0.05 * ball_r), "uranium-ore", value(0.2, 600)),
|
||||
resource_module_builder(oil_shape, "crude-oil", value(60, 160000)),
|
||||
resource_module_builder(circle_builder(0.2 * ball_r), "coal", value(0.2, 600)),
|
||||
resource_module_builder(circle_builder(0.2 * ball_r), "iron-ore", value(0.5, 750))
|
||||
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 lines = {}
|
||||
local lines_circle = circle_builder(0.6 * ball_r)
|
||||
local lines_circle = b.circle(0.6 * ball_r)
|
||||
for i = 1, count - 1 do
|
||||
local x = offset_x * i
|
||||
local y = offset_y * math.sin(angle * i)
|
||||
|
||||
local l = rectangle_builder(2, 2 * y + ball_r)
|
||||
l = translate(l, x, 0)
|
||||
local l = b.rectangle(2, 2 * y + ball_r)
|
||||
l = b.translate(l, x, 0)
|
||||
|
||||
local c = lines_circle
|
||||
c = builder_with_resource(c, resources[i])
|
||||
c = change_map_gen_collision_tile(c,"water-tile", "grass-1")
|
||||
local c = translate(c, x, 0)
|
||||
c = b.apply_entity(c, resources[i])
|
||||
c = b.change_map_gen_collision_tile(c,"water-tile", "grass-1")
|
||||
local c = b.translate(c, x, 0)
|
||||
|
||||
table.insert(lines, c)
|
||||
table.insert(lines, l)
|
||||
end
|
||||
lines = compound_or(lines)
|
||||
lines = b.any(lines)
|
||||
|
||||
local dna = compound_or{lines, ribben, flip_y(ribben)}
|
||||
local dna = b.any{lines, ribben, b.flip_y(ribben)}
|
||||
|
||||
local widith = offset_x * count
|
||||
dna = translate(dna, -widith/ 2, 0)
|
||||
local map = single_x_pattern_builder(dna, widith)
|
||||
dna = b.translate(dna, -widith/ 2, 0)
|
||||
local map = b.single_x_pattern(dna, widith)
|
||||
--[[
|
||||
local dna1 = single_pattern_builder(dna, widith, 6 * widith)
|
||||
local dna2 = single_pattern_builder(dna, widith, 8 * widith)
|
||||
dna2 = rotate(dna2, degrees(60))
|
||||
dna2 = translate(dna2, -3 * widith, 0)
|
||||
local dna3 = single_pattern_builder(dna, widith, 8 * widith)
|
||||
local dna3 = rotate(dna3, degrees(120))
|
||||
dna3 = translate(dna3, 3 * widith, 0)
|
||||
local map = compound_or{dna1, dna2, dna3}
|
||||
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 = translate(map, -widith/2, 0)
|
||||
map = b.translate(map, -widith/2, 0)
|
||||
|
||||
local sea = sine_fill_builder(512, 208)
|
||||
sea = compound_or{line_x_builder(2), sea, flip_y(sea)}
|
||||
sea = change_tile(sea, true, "water")
|
||||
sea = spawn_fish(sea, 0.005)
|
||||
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)
|
||||
|
||||
map = compound_or{map, sea}
|
||||
map = b.any{map, sea}
|
||||
|
||||
map = rotate(map, degrees(45))
|
||||
map = b.rotate(map, degrees(45))
|
||||
|
||||
local start_circle = circle_builder(0.3 * ball_r)
|
||||
local start_circle = b.circle(0.3 * ball_r)
|
||||
|
||||
local iron = builder_with_resource(scale(start_circle,0.5,0.5), resource_module_builder(full_builder, "iron-ore", value(0, 700)))
|
||||
local copper = builder_with_resource(scale(start_circle,0.5,0.5), resource_module_builder(full_builder, "copper-ore", value(0, 500)))
|
||||
local stone = builder_with_resource(scale(start_circle,0.5,0.5), resource_module_builder(full_builder, "stone", value(0, 250)))
|
||||
local oil = builder_with_resource(scale(start_circle,0.1,0.1), resource_module_builder(full_builder, "crude-oil", value(0, 40000)))
|
||||
local coal = builder_with_resource(scale(start_circle,0.5,0.5), resource_module_builder(full_builder, "coal", value(0, 800)))
|
||||
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 = compound_or
|
||||
local start = b.any
|
||||
{
|
||||
translate(iron, 0, -9),
|
||||
translate(copper, 0, 9),
|
||||
translate(stone, -9, 0),
|
||||
translate(oil, 9, 9),
|
||||
translate(coal, 9, 0),
|
||||
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),
|
||||
|
||||
}
|
||||
--start = change_map_gen_collision_tile(start,"water-tile", "grass-1")
|
||||
start = compound_or{start, big_circle}
|
||||
--start = b.change_map_gen_collision_tile(start,"water-tile", "grass-1")
|
||||
start = b.any{start, big_circle}
|
||||
|
||||
map = choose(big_circle, start, map)
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
map = b.choose(big_circle, start, map)
|
||||
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
|
||||
map = scale(map, 6, 6)
|
||||
map = b.scale(map, 6, 6)
|
||||
|
||||
return map
|
||||
|
||||
|
@ -12,16 +12,18 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local pic = require "map_gen.data.presets.factorio_logo"
|
||||
local pic = decompress(pic)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
shape = scale(shape, scale_factor, scale_factor)
|
||||
local pic = require "map_gen.data.presets.factorio_logo"
|
||||
local pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
shape = b.scale(shape, scale_factor, scale_factor)
|
||||
|
||||
local pattern_width = scale_factor * pic.width + island_distance_x
|
||||
local pattern_height = scale_factor * pic.height + island_distance_y
|
||||
shape = single_pattern_builder(shape, pattern_width, pattern_height)
|
||||
shape = b.single_pattern(shape, pattern_width, pattern_height)
|
||||
|
||||
shape = change_tile(shape, false, "deepwater")
|
||||
shape = b.change_tile(shape, false, "deepwater")
|
||||
|
||||
return shape
|
@ -12,18 +12,20 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local pic = require "map_gen.data.presets.factorio_logo2"
|
||||
local pic = decompress(pic)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
shape = scale(shape, scale_factor, scale_factor)
|
||||
local pic = require "map_gen.data.presets.factorio_logo2"
|
||||
local pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
shape = b.scale(shape, scale_factor, scale_factor)
|
||||
|
||||
local pattern_width = scale_factor * pic.width + island_distance_x
|
||||
local pattern_height = scale_factor * pic.height + island_distance_y
|
||||
shape = single_pattern_builder(shape, pattern_width, pattern_height)
|
||||
shape = b.single_pattern(shape, pattern_width, pattern_height)
|
||||
|
||||
shape = change_tile(shape, false, "water")
|
||||
shape = b.change_tile(shape, false, "water")
|
||||
|
||||
shape = spawn_fish(shape, 0.008)
|
||||
shape = b.fish(shape, 0.008)
|
||||
|
||||
return shape
|
@ -10,17 +10,19 @@ map_gen_rows_per_tick = 4 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
-- change these to change the pattern.
|
||||
local seed1 = 1234
|
||||
local seed2 = 5678
|
||||
|
||||
local value = manhattan_ore_value
|
||||
local value = b.manhattan_value
|
||||
|
||||
local pic = require "map_gen.data.presets.fish"
|
||||
local pic = decompress(pic)
|
||||
local fish = picture_builder(pic)
|
||||
local pic = b.decompress(pic)
|
||||
local fish = b.picture(pic)
|
||||
|
||||
fish = change_tile(fish, "water", false)
|
||||
fish = b.change_tile(fish, "water", false)
|
||||
|
||||
local ores =
|
||||
{
|
||||
@ -32,21 +34,21 @@ local ores =
|
||||
{resource_type = "crude-oil", value = value(50000, 250)},
|
||||
}
|
||||
|
||||
local cap = translate(rectangle_builder(48, 48), 100, 0)
|
||||
local cap = b.translate(b.rectangle(48, 48), 100, 0)
|
||||
|
||||
local iron = resource_module_builder(cap, ores[1].resource_type, ores[1].value)
|
||||
local copper = resource_module_builder(cap, ores[2].resource_type, ores[2].value)
|
||||
local stone = resource_module_builder(cap, ores[3].resource_type, ores[3].value)
|
||||
local coal = resource_module_builder(cap, ores[4].resource_type, ores[4].value)
|
||||
local uranium = resource_module_builder(cap, ores[5].resource_type, ores[5].value)
|
||||
local oil = resource_module_builder(throttle_world_xy(cap, 1, 8, 1, 8), ores[6].resource_type, ores[6].value)
|
||||
local iron = b.resource(cap, ores[1].resource_type, ores[1].value)
|
||||
local copper = b.resource(cap, ores[2].resource_type, ores[2].value)
|
||||
local stone = b.resource(cap, ores[3].resource_type, ores[3].value)
|
||||
local coal = b.resource(cap, ores[4].resource_type, ores[4].value)
|
||||
local uranium = b.resource(cap, ores[5].resource_type, ores[5].value)
|
||||
local oil = b.resource(b.throttle_world_xy(cap, 1, 8, 1, 8), ores[6].resource_type, ores[6].value)
|
||||
|
||||
local iron_fish = builder_with_resource(fish, iron)
|
||||
local copper_fish = builder_with_resource(fish, copper)
|
||||
local stone_fish = builder_with_resource(fish, stone)
|
||||
local coal_fish = builder_with_resource(fish, coal)
|
||||
local uranium_fish = builder_with_resource(fish, uranium)
|
||||
local oil_fish = builder_with_resource(fish, oil)
|
||||
local iron_fish = b.apply_entity(fish, iron)
|
||||
local copper_fish = b.apply_entity(fish, copper)
|
||||
local stone_fish = b.apply_entity(fish, stone)
|
||||
local coal_fish = b.apply_entity(fish, coal)
|
||||
local uranium_fish = b.apply_entity(fish, uranium)
|
||||
local oil_fish = b.apply_entity(fish, oil)
|
||||
|
||||
local fishes =
|
||||
{
|
||||
@ -77,7 +79,7 @@ for c = 1, p_cols do
|
||||
table.insert(pattern, row)
|
||||
for r = 1, p_rows do
|
||||
if (r <= 1) and (c <= 2 or c > p_cols - 1) then
|
||||
table.insert(row, empty_builder)
|
||||
table.insert(row, b.empty_shape)
|
||||
else
|
||||
local i = random:next_int(1, t)
|
||||
|
||||
@ -92,57 +94,57 @@ for c = 1, p_cols do
|
||||
local y = random:next_int(-48, 48)
|
||||
local r = random:next() * tau
|
||||
|
||||
shape = rotate(shape, r)
|
||||
shape = translate(shape, x, y)
|
||||
shape = b.rotate(shape, r)
|
||||
shape = b.translate(shape, x, y)
|
||||
|
||||
table.insert(row, shape)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local map = grid_pattern_full_overlap_builder(pattern, p_cols, p_rows, 215, 215)
|
||||
local map = b.grid_pattern_full_overlap(pattern, p_cols, p_rows, 215, 215)
|
||||
|
||||
local start = require "map_gen.data.presets.soy_sauce"
|
||||
start = decompress(start)
|
||||
start = picture_builder(start)
|
||||
start = change_tile(start, "water", false)
|
||||
start = b.decompress(start)
|
||||
start = b.picture(start)
|
||||
start = b.change_tile(start, "water", false)
|
||||
|
||||
local pic = require "map_gen.data.presets.fish_black_and_white"
|
||||
local pic = decompress(pic)
|
||||
local fish_bw = picture_builder(pic)
|
||||
fish_bw = scale(fish_bw, 0.25, 0.25)
|
||||
local pic = b.decompress(pic)
|
||||
local fish_bw = b.picture(pic)
|
||||
fish_bw = b.scale(fish_bw, 0.25, 0.25)
|
||||
|
||||
local start_copper = rotate(fish_bw, degrees(180))
|
||||
local start_stone = rotate(fish_bw, degrees(90))
|
||||
local start_coal = rotate(fish_bw, degrees(-90))
|
||||
local start_copper = b.rotate(fish_bw, degrees(180))
|
||||
local start_stone = b.rotate(fish_bw, degrees(90))
|
||||
local start_coal = b.rotate(fish_bw, degrees(-90))
|
||||
|
||||
local start_iron = translate(fish_bw, -32, 0)
|
||||
start_copper = translate(start_copper, 32, 0)
|
||||
start_stone = translate(start_stone, 0, 32)
|
||||
start_coal = translate(start_coal, 0, -32)
|
||||
local start_iron = b.translate(fish_bw, -32, 0)
|
||||
start_copper = b.translate(start_copper, 32, 0)
|
||||
start_stone = b.translate(start_stone, 0, 32)
|
||||
start_coal = b.translate(start_coal, 0, -32)
|
||||
|
||||
start_iron = resource_module_builder(start_iron, ores[1].resource_type, value(1000, 0.5))
|
||||
start_copper = resource_module_builder(start_copper, ores[2].resource_type, value(800, 0.5))
|
||||
start_stone = resource_module_builder(start_stone, ores[3].resource_type, value(600, 0.5))
|
||||
start_coal = resource_module_builder(start_coal, ores[4].resource_type, value(600, 0.5))
|
||||
start_iron = b.resource(start_iron, ores[1].resource_type, value(1000, 0.5))
|
||||
start_copper = b.resource(start_copper, ores[2].resource_type, value(800, 0.5))
|
||||
start_stone = b.resource(start_stone, ores[3].resource_type, value(600, 0.5))
|
||||
start_coal = b.resource(start_coal, ores[4].resource_type, value(600, 0.5))
|
||||
|
||||
local start_oil = translate(rectangle_builder(1, 1), -44, 74)
|
||||
start_oil = resource_module_builder(start_oil, ores[6].resource_type, value(100000, 0))
|
||||
local start_oil = b.translate(b.rectangle(1, 1), -44, 74)
|
||||
start_oil = b.resource(start_oil, ores[6].resource_type, value(100000, 0))
|
||||
|
||||
local worms = rectangle_builder(150, 72)
|
||||
worms = translate(worms, 0, -210)
|
||||
worms = spawn_entity(worms, "big-worm-turret")
|
||||
local worms = b.rectangle(150, 72)
|
||||
worms = b.translate(worms, 0, -210)
|
||||
worms = b.entity(worms, "big-worm-turret")
|
||||
|
||||
local start = builder_with_resource(start, compound_or{start_iron, start_copper, start_stone, start_coal, start_oil, worms})
|
||||
local start = b.apply_entity(start, b.any{start_iron, start_copper, start_stone, start_coal, start_oil, worms})
|
||||
|
||||
map = shape_or_else(start, map)
|
||||
map = b.if_else(start, map)
|
||||
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
|
||||
local sea = tile_builder("water")
|
||||
local sea = spawn_fish(sea, 0.025)
|
||||
local sea = b.tile("water")
|
||||
local sea = b.fish(sea, 0.025)
|
||||
|
||||
map = shape_or_else(map, sea)
|
||||
map = b.if_else(map, sea)
|
||||
|
||||
--map = scale(map, 2, 2)
|
||||
--map = b.scale(map, 2, 2)
|
||||
return map
|
||||
|
@ -2,6 +2,8 @@
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local function value(base, mult)
|
||||
return function(x, y)
|
||||
return mult * (math.abs(x) + math.abs(y)) + base
|
||||
@ -16,103 +18,103 @@ local function no_resources(x, y, world, tile)
|
||||
return tile
|
||||
end
|
||||
|
||||
local arm1 = translate(rectangle_builder(2, 3), 0, -5)
|
||||
local arm2 = translate(rectangle_builder(6, 2), 0, 22)
|
||||
local arm1 = b.translate(b.rectangle(2, 3), 0, -5)
|
||||
local arm2 = b.translate(b.rectangle(6, 2), 0, 22)
|
||||
|
||||
local inner = circle_builder(22)
|
||||
local outer = circle_builder(24)
|
||||
local ring = compound_and{outer, invert(inner)}
|
||||
local inner = b.circle(22)
|
||||
local outer = b.circle(24)
|
||||
local ring = b.all{outer, b.invert(inner)}
|
||||
|
||||
map = compound_or{map, ring}
|
||||
map = b.any{map, ring}
|
||||
|
||||
local arms = compound_or{arm1, arm2}
|
||||
arms = translate(arms, 0, -16)
|
||||
arms = compound_or
|
||||
local arms = b.any{arm1, arm2}
|
||||
arms = b.translate(arms, 0, -16)
|
||||
arms = b.any
|
||||
{
|
||||
arms,
|
||||
rotate(arms, degrees(120)),
|
||||
rotate(arms, degrees(-120))
|
||||
b.rotate(arms, degrees(120)),
|
||||
b.rotate(arms, degrees(-120))
|
||||
}
|
||||
local frame = compound_or{arms, ring}
|
||||
local frame = b.any{arms, ring}
|
||||
|
||||
local ball = circle_builder(8)
|
||||
local ball = b.circle(8)
|
||||
|
||||
local iron = resource_module_builder(circle_builder(6), "iron-ore", value(1000, 1))
|
||||
local copper = resource_module_builder(circle_builder(6), "copper-ore", value(800, 0.8))
|
||||
local stone = resource_module_builder(circle_builder(4), "stone", value(500, .5))
|
||||
local coal = resource_module_builder(circle_builder(6), "coal", value(600, 0.6))
|
||||
local uranium = resource_module_builder(circle_builder(4), "uranium-ore", value(400, 1))
|
||||
local oil = resource_module_builder(throttle_world_xy(circle_builder(6), 1, 4, 1, 4), "crude-oil", value(100000, 50))
|
||||
local iron = b.resource(b.circle(6), "iron-ore", value(1000, 1))
|
||||
local copper = b.resource(b.circle(6), "copper-ore", value(800, 0.8))
|
||||
local stone = b.resource(b.circle(4), "stone", value(500, .5))
|
||||
local coal = b.resource(b.circle(6), "coal", value(600, 0.6))
|
||||
local uranium = b.resource(b.circle(4), "uranium-ore", value(400, 1))
|
||||
local oil = b.resource(b.throttle_world_xy(b.circle(6), 1, 4, 1, 4), "crude-oil", value(100000, 50))
|
||||
|
||||
local iron_ball = change_map_gen_collision_tile(builder_with_resource(ball, iron),"water-tile", "grass-1")
|
||||
local copper_ball = change_map_gen_collision_tile(builder_with_resource(ball, copper),"water-tile", "grass-1")
|
||||
local stone_ball = change_map_gen_collision_tile(builder_with_resource(ball, stone),"water-tile", "grass-1")
|
||||
local coal_ball = change_map_gen_collision_tile(builder_with_resource(ball, coal),"water-tile", "grass-1")
|
||||
local uranium_ball = change_map_gen_collision_tile(builder_with_resource(ball, uranium),"water-tile", "grass-1")
|
||||
local oil_ball = change_map_gen_collision_tile(builder_with_resource(ball, oil),"water-tile", "grass-1")
|
||||
local iron_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, iron),"water-tile", "grass-1")
|
||||
local copper_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, copper),"water-tile", "grass-1")
|
||||
local stone_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, stone),"water-tile", "grass-1")
|
||||
local coal_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, coal),"water-tile", "grass-1")
|
||||
local uranium_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, uranium),"water-tile", "grass-1")
|
||||
local oil_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, oil),"water-tile", "grass-1")
|
||||
|
||||
local balls1 = compound_or
|
||||
local balls1 = b.any
|
||||
{
|
||||
translate(iron_ball, 0, -12),
|
||||
rotate(translate(copper_ball, 0, -12), degrees(120)),
|
||||
rotate(translate(coal_ball, 0, -12), degrees(-120)),
|
||||
b.translate(iron_ball, 0, -12),
|
||||
b.rotate(b.translate(copper_ball, 0, -12), degrees(120)),
|
||||
b.rotate(b.translate(coal_ball, 0, -12), degrees(-120)),
|
||||
frame
|
||||
}
|
||||
--shape = rotate(shape, degrees(rot))
|
||||
balls1 = rotate(balls1, degrees(180))
|
||||
balls1 = choose(outer, balls1, empty_builder)
|
||||
balls1 = translate(balls1, 0, -36)
|
||||
--shape = b.rotate(shape, degrees(rot))
|
||||
balls1 = b.rotate(balls1, degrees(180))
|
||||
balls1 = b.choose(outer, balls1, b.empty_shape)
|
||||
balls1 = b.translate(balls1, 0, -36)
|
||||
|
||||
local balls2 = compound_or
|
||||
local balls2 = b.any
|
||||
{
|
||||
translate(iron_ball, 0, -12),
|
||||
rotate(translate(copper_ball, 0, -12), degrees(120)),
|
||||
rotate(translate(stone_ball, 0, -12), degrees(-120)),
|
||||
b.translate(iron_ball, 0, -12),
|
||||
b.rotate(b.translate(copper_ball, 0, -12), degrees(120)),
|
||||
b.rotate(b.translate(stone_ball, 0, -12), degrees(-120)),
|
||||
frame
|
||||
}
|
||||
balls2 = rotate(balls2, degrees(180))
|
||||
balls2 = choose(outer, balls2, empty_builder)
|
||||
balls2 = translate(balls2, 0, -36)
|
||||
balls2 = rotate(balls2, degrees(120))
|
||||
balls2 = b.rotate(balls2, degrees(180))
|
||||
balls2 = b.choose(outer, balls2, b.empty_shape)
|
||||
balls2 = b.translate(balls2, 0, -36)
|
||||
balls2 = b.rotate(balls2, degrees(120))
|
||||
|
||||
local balls3 = compound_or
|
||||
local balls3 = b.any
|
||||
{
|
||||
translate(iron_ball, 0, -12),
|
||||
rotate(translate(uranium_ball, 0, -12), degrees(120)),
|
||||
rotate(translate(oil_ball, 0, -12), degrees(-120)),
|
||||
b.translate(iron_ball, 0, -12),
|
||||
b.rotate(b.translate(uranium_ball, 0, -12), degrees(120)),
|
||||
b.rotate(b.translate(oil_ball, 0, -12), degrees(-120)),
|
||||
frame
|
||||
}
|
||||
balls3 = rotate(balls3, degrees(180))
|
||||
balls3 = choose(outer, balls3, empty_builder)
|
||||
balls3 = translate(balls3, 0, -36)
|
||||
balls3 = rotate(balls3, degrees(-120))
|
||||
balls3 = b.rotate(balls3, degrees(180))
|
||||
balls3 = b.choose(outer, balls3, b.empty_shape)
|
||||
balls3 = b.translate(balls3, 0, -36)
|
||||
balls3 = b.rotate(balls3, degrees(-120))
|
||||
|
||||
|
||||
local balls4 = compound_or
|
||||
local balls4 = b.any
|
||||
{
|
||||
balls1,
|
||||
balls2,
|
||||
balls3,
|
||||
scale(frame, 3, 3)
|
||||
b.scale(frame, 3, 3)
|
||||
}
|
||||
balls4 = rotate(balls4, degrees(180))
|
||||
balls4 = apply_effect(balls4, no_resources)
|
||||
balls4 = choose(scale(outer, 3, 3), balls4, empty_builder)
|
||||
balls4 = b.rotate(balls4, degrees(180))
|
||||
balls4 = b.apply_effect(balls4, no_resources)
|
||||
balls4 = b.choose(b.scale(outer, 3, 3), balls4, b.empty_shape)
|
||||
|
||||
local function make_ball(shape, sf)
|
||||
local s1 = translate(shape, 0, -12 * sf)
|
||||
local shape = compound_or
|
||||
local s1 = b.translate(shape, 0, -12 * sf)
|
||||
local shape = b.any
|
||||
{
|
||||
s1,
|
||||
rotate(s1, degrees(120)),
|
||||
rotate(s1, degrees(-120)),
|
||||
scale(frame, sf, sf)
|
||||
b.rotate(s1, degrees(120)),
|
||||
b.rotate(s1, degrees(-120)),
|
||||
b.scale(frame, sf, sf)
|
||||
}
|
||||
shape = rotate(shape, degrees(180))
|
||||
shape = b.rotate(shape, degrees(180))
|
||||
|
||||
local bound = scale(outer, sf, sf)
|
||||
local bound = b.scale(outer, sf, sf)
|
||||
|
||||
return choose(bound, shape, empty_builder)
|
||||
return b.choose(bound, shape, b.empty_shape)
|
||||
end
|
||||
|
||||
local ratio = 24 / 8
|
||||
@ -123,7 +125,7 @@ for i = 1, 6 do
|
||||
total_sf = ratio * total_sf
|
||||
end
|
||||
|
||||
map = translate(map, 0, -19680)
|
||||
map = scale(map, 1.5, 1.5)
|
||||
map = b.translate(map, 0, -19680)
|
||||
map = b.scale(map, 1.5, 1.5)
|
||||
|
||||
return map
|
||||
|
@ -10,6 +10,8 @@ map_gen_rows_per_tick = 4 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
-- change these to change the pattern.
|
||||
local seed1 = 9999
|
||||
local seed2 = 6666
|
||||
@ -20,10 +22,10 @@ local function value(base, mult)
|
||||
end
|
||||
end
|
||||
|
||||
local big_circle = circle_builder(48)
|
||||
local small_circle = circle_builder(24)
|
||||
local big_circle = b.circle(48)
|
||||
local small_circle = b.circle(24)
|
||||
|
||||
local ring = compound_and{big_circle, invert(small_circle)}
|
||||
local ring = b.all{big_circle, b.invert(small_circle)}
|
||||
|
||||
local ores =
|
||||
{
|
||||
@ -35,12 +37,12 @@ local ores =
|
||||
{resource_type = "crude-oil", value = value(10000, 50)},
|
||||
}
|
||||
|
||||
local iron = resource_module_builder(full_builder, ores[1].resource_type, ores[1].value)
|
||||
local copper = resource_module_builder(full_builder, ores[2].resource_type, ores[2].value)
|
||||
local stone = resource_module_builder(full_builder, ores[3].resource_type, ores[3].value)
|
||||
local coal = resource_module_builder(full_builder, ores[4].resource_type, ores[4].value)
|
||||
local uranium = resource_module_builder(full_builder, ores[5].resource_type, ores[5].value)
|
||||
local oil = resource_module_builder(throttle_world_xy(full_builder, 1, 4, 1, 4), ores[6].resource_type, ores[6].value)
|
||||
local iron = b.resource(b.full_shape, ores[1].resource_type, ores[1].value)
|
||||
local copper = b.resource(b.full_shape, ores[2].resource_type, ores[2].value)
|
||||
local stone = b.resource(b.full_shape, ores[3].resource_type, ores[3].value)
|
||||
local coal = b.resource(b.full_shape, ores[4].resource_type, ores[4].value)
|
||||
local uranium = b.resource(b.full_shape, ores[5].resource_type, ores[5].value)
|
||||
local oil = b.resource(b.throttle_world_xy(b.full_shape, 1, 4, 1, 4), ores[6].resource_type, ores[6].value)
|
||||
|
||||
local function striped(x, y, world_x, world_y, surface)
|
||||
local t = (world_x + world_y) % 4 + 1
|
||||
@ -65,28 +67,28 @@ local function sprinkle(x, y, world_x, world_y, surface)
|
||||
}
|
||||
end
|
||||
|
||||
local segmented = segment_pattern_builder({iron, copper, stone, coal})
|
||||
local segmented = b.segment_pattern({iron, copper, stone, coal})
|
||||
|
||||
local tree = spawn_entity(throttle_world_xy(full_builder, 1, 3, 1, 3), "tree-01")
|
||||
local tree = b.entity(b.throttle_world_xy(b.full_shape, 1, 3, 1, 3), "tree-01")
|
||||
|
||||
local start_iron = resource_module_builder(ring, ores[1].resource_type, value(500, 0.5))
|
||||
local start_copper = resource_module_builder(ring, ores[2].resource_type, value(400, 0.5))
|
||||
local start_stone = resource_module_builder(ring, ores[3].resource_type, value(300, 0.5))
|
||||
local start_coal = resource_module_builder(ring, ores[4].resource_type, value(300, 0.5))
|
||||
local start_segmented = segment_pattern_builder({start_iron, start_copper, start_stone, start_coal})
|
||||
local start_tree = spawn_entity(throttle_world_xy(small_circle, 1, 3, 1, 3), "tree-01")
|
||||
local start_iron = b.resource(ring, ores[1].resource_type, value(500, 0.5))
|
||||
local start_copper = b.resource(ring, ores[2].resource_type, value(400, 0.5))
|
||||
local start_stone = b.resource(ring, ores[3].resource_type, value(300, 0.5))
|
||||
local start_coal = b.resource(ring, ores[4].resource_type, value(300, 0.5))
|
||||
local start_segmented = b.segment_pattern({start_iron, start_copper, start_stone, start_coal})
|
||||
local start_tree = b.entity(b.throttle_world_xy(small_circle, 1, 3, 1, 3), "tree-01")
|
||||
|
||||
local iron_loop = builder_with_resource(ring, iron)
|
||||
local copper_loop = builder_with_resource(ring, copper)
|
||||
local stone_loop = builder_with_resource(ring, stone)
|
||||
local coal_loop = builder_with_resource(ring, coal)
|
||||
local uranium_loop = builder_with_resource(ring, uranium)
|
||||
local oil_loop = builder_with_resource(ring, oil)
|
||||
local striped_loop = builder_with_resource(ring, striped)
|
||||
local sprinkle_loop = builder_with_resource(ring, sprinkle)
|
||||
local segmented_loop = builder_with_resource(ring, segmented)
|
||||
local tree_loop = builder_with_resource(ring, tree)
|
||||
local start_loop = builder_with_resource(big_circle, compound_or{start_segmented, start_tree})
|
||||
local iron_loop = b.apply_entity(ring, iron)
|
||||
local copper_loop = b.apply_entity(ring, copper)
|
||||
local stone_loop = b.apply_entity(ring, stone)
|
||||
local coal_loop = b.apply_entity(ring, coal)
|
||||
local uranium_loop = b.apply_entity(ring, uranium)
|
||||
local oil_loop = b.apply_entity(ring, oil)
|
||||
local striped_loop = b.apply_entity(ring, striped)
|
||||
local sprinkle_loop = b.apply_entity(ring, sprinkle)
|
||||
local segmented_loop = b.apply_entity(ring, segmented)
|
||||
local tree_loop = b.apply_entity(ring, tree)
|
||||
local start_loop = b.apply_entity(big_circle, b.any{start_segmented, start_tree})
|
||||
|
||||
local loops =
|
||||
{
|
||||
@ -135,22 +137,22 @@ for c = 1, p_cols do
|
||||
local x = random:next_int(-32, 32)
|
||||
local y = random:next_int(-32, 32)
|
||||
|
||||
shape = translate(shape, x, y)
|
||||
shape = b.translate(shape, x, y)
|
||||
|
||||
table.insert(row, shape)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local map = grid_pattern_full_overlap_builder(pattern, p_cols, p_rows, 128, 128)
|
||||
local map = b.grid_pattern_full_overlap(pattern, p_cols, p_rows, 128, 128)
|
||||
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
|
||||
local sea = change_tile(full_builder, true, "water")
|
||||
local sea = spawn_fish(sea, 0.025)
|
||||
local sea = b.change_tile(b.full_shape, true, "water")
|
||||
local sea = b.fish(sea, 0.025)
|
||||
|
||||
map = shape_or_else(map, sea)
|
||||
map = b.if_else(map, sea)
|
||||
|
||||
--map = translate(map, -32, 0)
|
||||
--map = scale(map, 1, 1)
|
||||
--map = b.translate(map, -32, 0)
|
||||
--map = b.scale(map, 1, 1)
|
||||
return map
|
||||
|
@ -9,16 +9,18 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.gears"
|
||||
pic = decompress(pic)
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
local shape = b.picture(pic)
|
||||
|
||||
local map = single_pattern_builder(shape, pic.width, pic.height)
|
||||
map = translate(map, -20, 20)
|
||||
map = scale(map, 4, 4)
|
||||
local map = b.single_pattern(shape, pic.width, pic.height)
|
||||
map = b.translate(map, -20, 20)
|
||||
map = b.scale(map, 4, 4)
|
||||
|
||||
map = change_tile(map, false, "water")
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
map = b.change_tile(map, false, "water")
|
||||
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
|
||||
return map
|
@ -5,14 +5,16 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
require "map_gen.shared.generate_not_threaded"
|
||||
--require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.goat"
|
||||
local pic = decompress(pic)
|
||||
local pic = b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
shape = translate(shape, 10, -96)
|
||||
shape = scale(shape,2,2)
|
||||
--shape = rotate(shape, degrees(0))
|
||||
local shape = b.picture(pic)
|
||||
shape = b.translate(shape, 10, -96)
|
||||
shape = b.scale(shape,2,2)
|
||||
--shape = b.rotate(shape, degrees(0))
|
||||
|
||||
-- shape = change_tile(shape, false, "deepwater")
|
||||
-- shape = b.change_tile(shape, false, "deepwater")
|
||||
|
||||
return shape
|
||||
|
@ -5,15 +5,17 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.goat"
|
||||
local pic = decompress(pic)
|
||||
local pic = b.decompress(pic)
|
||||
|
||||
local goat1 = picture_builder(pic)
|
||||
goat1 = invert(goat1)
|
||||
local crop = rectangle_builder(pic.width, pic.height)
|
||||
goat1 = compound_and{goat1, crop}
|
||||
local goat1 = b.picture(pic)
|
||||
goat1 = b.invert(goat1)
|
||||
local crop = b.rectangle(pic.width, pic.height)
|
||||
goat1 = b.all{goat1, crop}
|
||||
|
||||
local floor = translate(rectangle_builder(pic.width, 32), 0 , (pic.height / 2) + 12)
|
||||
local floor = b.translate(b.rectangle(pic.width, 32), 0 , (pic.height / 2) + 12)
|
||||
|
||||
local goats = { floor, goat1 }
|
||||
|
||||
@ -24,14 +26,14 @@ local t = 0
|
||||
for i = 1, 5 do
|
||||
s = s * sf
|
||||
t = t + (s * tf * pic.height)
|
||||
local goat = translate(scale(goat1, s, s), 0, -t)
|
||||
local goat = b.translate(b.scale(goat1, s, s), 0, -t)
|
||||
table.insert( goats, goat )
|
||||
end
|
||||
|
||||
local ceiling = translate(rectangle_builder(pic.width, 32), 0 , -t - 32)
|
||||
local ceiling = b.translate(b.rectangle(pic.width, 32), 0 , -t - 32)
|
||||
table.insert( goats, ceiling )
|
||||
|
||||
local shape = translate(compound_or(goats), 0, (t / 2) - 60)
|
||||
local shape = b.translate(b.any(goats), 0, (t / 2) - 60)
|
||||
|
||||
-- for custom goat ores
|
||||
--[[
|
||||
@ -45,20 +47,20 @@ local function rot(table)
|
||||
return copy
|
||||
end
|
||||
|
||||
local patch = flip_x(goat1)
|
||||
--patch = throttle_xy(patch, 1, 2, 1 ,2)
|
||||
local iron_patch = resource_module_builder(scale(patch,0.12,0.12), "iron-ore", function(x,y) return 500 end)
|
||||
local copper_patch = resource_module_builder(scale(patch,0.12,0.12), "copper-ore", function(x,y) return 500 end)
|
||||
local coal_patch = resource_module_builder(scale(patch,0.12,0.12), "coal", function(x,y) return 500 end)
|
||||
local stone_patch = resource_module_builder(scale(patch,0.12,0.12), "stone", function(x,y) return 500 end)
|
||||
local uraniumn_patch = resource_module_builder(scale(patch,0.12,0.12), "uraniumn-ore", function(x,y) return 500 end)
|
||||
local oil_patch = resource_module_builder(scale(patch,0.12,0.12), "crude-oil", function(x,y) return 500 end)
|
||||
local patch1 = translate(scale(patch,0.2,0.2),0,170)
|
||||
local patch2 = translate(scale(patch,0.15,0.15),0,25)
|
||||
local patch3 = translate(scale(patch,0.12,0.12),0,-88)
|
||||
local patch4 = translate(scale(patch,0.1,0.1),0,-173)
|
||||
local patch5 = translate(scale(patch,0.08,0.08),0,-238)
|
||||
local patch6 = translate(scale(patch,0.04,0.04),0,-282)
|
||||
local patch = b.flip_x(goat1)
|
||||
--patch = b.throttle_xy(patch, 1, 2, 1 ,2)
|
||||
local iron_patch = b.resource(b.scale(patch,0.12,0.12), "iron-ore", function(x,y) return 500 end)
|
||||
local copper_patch = b.resource(b.scale(patch,0.12,0.12), "copper-ore", function(x,y) return 500 end)
|
||||
local coal_patch = b.resource(b.scale(patch,0.12,0.12), "coal", function(x,y) return 500 end)
|
||||
local stone_patch = b.resource(b.scale(patch,0.12,0.12), "stone", function(x,y) return 500 end)
|
||||
local uraniumn_patch = b.resource(b.scale(patch,0.12,0.12), "uraniumn-ore", function(x,y) return 500 end)
|
||||
local oil_patch = b.resource(b.scale(patch,0.12,0.12), "crude-oil", function(x,y) return 500 end)
|
||||
local patch1 = b.translate(b.scale(patch,0.2,0.2),0,170)
|
||||
local patch2 = b.translate(b.scale(patch,0.15,0.15),0,25)
|
||||
local patch3 = b.translate(b.scale(patch,0.12,0.12),0,-88)
|
||||
local patch4 = b.translate(b.scale(patch,0.1,0.1),0,-173)
|
||||
local patch5 = b.translate(b.scale(patch,0.08,0.08),0,-238)
|
||||
local patch6 = b.translate(b.scale(patch,0.04,0.04),0,-282)
|
||||
local patch_table = { patch1, patch2, patch3, patch4, patch5, patch6 }
|
||||
local function do_nothing(builder, x, y) return builder(x, y) end
|
||||
local function throttle(builder, x, y)
|
||||
@ -101,16 +103,16 @@ local function res_builder(x, y, world_x, world_y)
|
||||
end
|
||||
end
|
||||
end
|
||||
--local patches = compound_or(patch_table)
|
||||
--local iron = resource_module_builder(patches,"iron-ore", function(x,y) return 400 end)
|
||||
--local iron_goat = builder_with_resource(shape, iron)
|
||||
local res_goat = builder_with_resource(shape, res_builder)
|
||||
--local patches = b.any(patch_table)
|
||||
--local iron = b.resource(patches,"iron-ore", function(x,y) return 400 end)
|
||||
--local iron_goat = b.apply_entity(shape, iron)
|
||||
local res_goat = b.apply_entity(shape, res_builder)
|
||||
shape = res_goat
|
||||
--]]
|
||||
|
||||
local shape2 = flip_x(shape)
|
||||
local shape3 = flip_y(shape)
|
||||
local shape4 = flip_y(shape2)
|
||||
local shape2 = b.flip_x(shape)
|
||||
local shape3 = b.flip_y(shape)
|
||||
local shape4 = b.flip_y(shape2)
|
||||
|
||||
local pattern =
|
||||
{
|
||||
@ -118,7 +120,7 @@ local pattern =
|
||||
{shape3, shape4},
|
||||
}
|
||||
|
||||
local map = grid_pattern_builder(pattern, 2, 2, pic.width, pic.height + t - 105)
|
||||
map = change_map_gen_collision_tile(map,"water-tile", "water-green")
|
||||
local map = b.grid_pattern(pattern, 2, 2, pic.width, pic.height + t - 105)
|
||||
map = b.change_map_gen_collision_tile(map,"water-tile", "water-green")
|
||||
|
||||
return map
|
@ -9,46 +9,48 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local square = rectangle_builder(160,160)
|
||||
local circle = circle_builder(60)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local leg = rectangle_builder(32,480)
|
||||
local head = translate (oval_builder(32, 64), 0, -64)
|
||||
local body = translate (circle_builder(64), 0, 64)
|
||||
local square = b.rectangle(160,160)
|
||||
local circle = b.circle(60)
|
||||
|
||||
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)
|
||||
|
||||
local count = 10
|
||||
local angle = 360 / count
|
||||
local list = { head, body }
|
||||
for i = 1, (count / 2) - 1 do
|
||||
local shape = rotate(leg, degrees(i * angle))
|
||||
local shape = b.rotate(leg, degrees(i * angle))
|
||||
table.insert( list, shape )
|
||||
end
|
||||
|
||||
local spider = compound_or(list)
|
||||
local spider = b.any(list)
|
||||
|
||||
local patch = scale(spider, 0.125, 0.125)
|
||||
local iron_patch = resource_module_builder(patch, "iron-ore", function(x,y) return 500 + (math.abs(x) + math.abs(y)) end)
|
||||
local copper_patch = resource_module_builder(patch, "copper-ore",function(x,y) return 400 + (math.abs(x) + math.abs(y)) * 0.8 end)
|
||||
local coal_patch = resource_module_builder(patch, "coal",function(x,y) return 300 + (math.abs(x) + math.abs(y)) * 0.7 end)
|
||||
local stone_patch = resource_module_builder(patch, "stone",function(x,y) return 100 + (math.abs(x) + math.abs(y)) * 0.5 end)
|
||||
local uraniumn_patch = resource_module_builder(scale(patch, 0.5,0.5), "uranium-ore",function(x,y) return 100 + (math.abs(x) + math.abs(y)) * 0.2 end)
|
||||
local oil_patch = resource_module_builder(patch, "crude-oil",function(x,y) return 75000 + (math.abs(x) + math.abs(y)) * 500 end)
|
||||
local patch = b.scale(spider, 0.125, 0.125)
|
||||
local iron_patch = b.resource(patch, "iron-ore", function(x,y) return 500 + (math.abs(x) + math.abs(y)) end)
|
||||
local copper_patch = b.resource(patch, "copper-ore",function(x,y) return 400 + (math.abs(x) + math.abs(y)) * 0.8 end)
|
||||
local coal_patch = b.resource(patch, "coal",function(x,y) return 300 + (math.abs(x) + math.abs(y)) * 0.7 end)
|
||||
local stone_patch = b.resource(patch, "stone",function(x,y) return 100 + (math.abs(x) + math.abs(y)) * 0.5 end)
|
||||
local uraniumn_patch = b.resource(b.scale(patch, 0.5,0.5), "uranium-ore",function(x,y) return 100 + (math.abs(x) + math.abs(y)) * 0.2 end)
|
||||
local oil_patch = b.resource(patch, "crude-oil",function(x,y) return 75000 + (math.abs(x) + math.abs(y)) * 500 end)
|
||||
|
||||
local iron_circle = builder_with_resource(circle, iron_patch)
|
||||
local copper_circle = builder_with_resource(circle, copper_patch)
|
||||
local coal_circle = builder_with_resource(circle, coal_patch)
|
||||
local stone_circle = builder_with_resource(circle, stone_patch)
|
||||
local uraniumn_circle = builder_with_resource(circle, uraniumn_patch)
|
||||
local oil_circle = builder_with_resource(circle, oil_patch)
|
||||
local iron_circle = b.apply_entity(circle, iron_patch)
|
||||
local copper_circle = b.apply_entity(circle, copper_patch)
|
||||
local coal_circle = b.apply_entity(circle, coal_patch)
|
||||
local stone_circle = b.apply_entity(circle, stone_patch)
|
||||
local uraniumn_circle = b.apply_entity(circle, uraniumn_patch)
|
||||
local oil_circle = b.apply_entity(circle, oil_patch)
|
||||
|
||||
local start_patch = scale(spider, 0.0625, 0.0625)
|
||||
local start_iron_patch = resource_module_builder(translate(start_patch, 48, 0), "iron-ore", function(x,y) return 500 end)
|
||||
local start_copper_patch = resource_module_builder(translate(start_patch, 0, -48), "copper-ore", function(x,y) return 400 end)
|
||||
local start_stone_patch = resource_module_builder(translate(start_patch, -48, 0), "stone", function(x,y) return 200 end)
|
||||
local start_coal_patch = resource_module_builder(translate(start_patch, 0, 48), "coal", function(x,y) return 300 end)
|
||||
local start_patch = b.scale(spider, 0.0625, 0.0625)
|
||||
local start_iron_patch = b.resource(b.translate(start_patch, 48, 0), "iron-ore", function(x,y) return 500 end)
|
||||
local start_copper_patch = b.resource(b.translate(start_patch, 0, -48), "copper-ore", function(x,y) return 400 end)
|
||||
local start_stone_patch = b.resource(b.translate(start_patch, -48, 0), "stone", function(x,y) return 200 end)
|
||||
local start_coal_patch = b.resource(b.translate(start_patch, 0, 48), "coal", function(x,y) return 300 end)
|
||||
|
||||
local start_resources = compound_or({ start_iron_patch, start_copper_patch, start_stone_patch, start_coal_patch })
|
||||
local start = builder_with_resource(square_diamond_builder(224), start_resources)
|
||||
local start_resources = b.any({ start_iron_patch, start_copper_patch, start_stone_patch, start_coal_patch })
|
||||
local start = b.apply_entity(b.square_diamond(224), start_resources)
|
||||
|
||||
pattern =
|
||||
{
|
||||
@ -60,12 +62,12 @@ pattern =
|
||||
{ copper_circle, square, iron_circle, square, coal_circle, square },
|
||||
}
|
||||
|
||||
local map = grid_pattern_builder(pattern, 6, 6, 288, 288)
|
||||
map = choose(rectangle_builder(288,288), start, map)
|
||||
local map = b.grid_pattern(pattern, 6, 6, 288, 288)
|
||||
map = b.choose(b.rectangle(288,288), start, map)
|
||||
|
||||
local path = path_builder(16)
|
||||
local paths = single_pattern_builder(path, 288, 288)
|
||||
local path = b.path(16)
|
||||
local paths = b.single_pattern(path, 288, 288)
|
||||
|
||||
map = compound_or{map, paths}
|
||||
map = b.any{map, paths}
|
||||
|
||||
return map
|
@ -2,21 +2,23 @@
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local circle = circle_builder(16)
|
||||
local square = rectangle_builder(30)
|
||||
square = rotate(square, degrees(45))
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local heart = compound_or{translate(circle, -14, 0), translate(circle, 14, 0), translate(square, 0, 14)}
|
||||
--local hollow_heart = compound_and{invert(heart), scale(heart, 2, 2)}
|
||||
local circle = b.circle(16)
|
||||
local square = b.rectangle(30)
|
||||
square = b.rotate(square, degrees(45))
|
||||
|
||||
heart = translate(heart, 0, -10)
|
||||
heart = scale(heart, 51/60, 1)
|
||||
local hearts = grow(heart, heart, 52, 0.5)
|
||||
local heart = b.any{b.translate(circle, -14, 0), b.translate(circle, 14, 0), b.translate(square, 0, 14)}
|
||||
--local hollow_heart = b.all{b.invert(heart), b.scale(heart, 2, 2)}
|
||||
|
||||
local line = line_y_builder(2)
|
||||
heart = b.translate(heart, 0, -10)
|
||||
heart = b.scale(heart, 51/60, 1)
|
||||
local hearts = b.grow(heart, heart, 52, 0.5)
|
||||
|
||||
local map = compound_or{line, hearts}
|
||||
map = translate(map, 0, 16)
|
||||
map = scale(map, 12,12)
|
||||
local line = b.line_y(2)
|
||||
|
||||
local map = b.any{line, hearts}
|
||||
map = b.translate(map, 0, 16)
|
||||
map = b.scale(map, 12,12)
|
||||
|
||||
return map
|
@ -5,20 +5,22 @@ map_gen_rows_per_tick = 4 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.honeycomb"
|
||||
local pic = decompress(pic)
|
||||
local map = picture_builder(pic)
|
||||
local pic = b.decompress(pic)
|
||||
local map = b.picture(pic)
|
||||
|
||||
-- this builds the map by duplicating the pic in every direction
|
||||
map = single_pattern_builder(map, pic.width-1, pic.height-1)
|
||||
map = b.single_pattern(map, pic.width-1, pic.height-1)
|
||||
|
||||
-- this changes the size of the map
|
||||
--map = scale(map, 2, 2)
|
||||
--map = b.scale(map, 2, 2)
|
||||
|
||||
-- this moves the map, effectively changing the spawn point.
|
||||
--map = translate(map, 0, -200)
|
||||
--map = b.translate(map, 0, -200)
|
||||
|
||||
-- this sets the tile outside the bounds of the map to deepwater, remove this and it will be void.
|
||||
--map = change_tile(map, false, "deepwater")
|
||||
--map = b.change_tile(map, false, "deepwater")
|
||||
|
||||
return map
|
@ -5,14 +5,16 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.lines"
|
||||
pic= decompress(pic)
|
||||
pic= b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
local shape = b.picture(pic)
|
||||
|
||||
local map = single_pattern_builder(shape, pic.width, pic.height)
|
||||
local map = b.single_pattern(shape, pic.width, pic.height)
|
||||
|
||||
--map = translate(map, 10, -96)
|
||||
map = scale(map,10,10)
|
||||
--map = b.translate(map, 10, -96)
|
||||
map = b.scale(map,10,10)
|
||||
|
||||
return map
|
@ -5,44 +5,46 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local big_circle = circle_builder(150)
|
||||
local small_circle = circle_builder(140)
|
||||
local crop = rectangle_builder(300,150)
|
||||
crop = translate(crop,0,-75)
|
||||
local arc = compound_and{big_circle, invert(small_circle), invert(crop)}
|
||||
arc = scale(arc,12,4)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local circle = circle_builder(200)
|
||||
local ball1 = translate(circle, 0,820)
|
||||
local ball2 = translate(circle, -920,740)
|
||||
local ball3 = translate(circle, 920,740)
|
||||
local rectangle = rectangle_builder(25,40)
|
||||
local arm1 = translate(rectangle, 0, 610)
|
||||
local arm2 = translate(rectangle, -920, 530)
|
||||
local arm3 = translate(rectangle, 920, 530)
|
||||
local big_circle = b.circle(150)
|
||||
local small_circle = b.circle(140)
|
||||
local crop = b.rectangle(300,150)
|
||||
crop = b.translate(crop,0,-75)
|
||||
local arc = b.all{big_circle, b.invert(small_circle), b.invert(crop)}
|
||||
arc = b.scale(arc,12,4)
|
||||
|
||||
local arc1 = compound_or{arc, ball1,ball2,ball3,arm1,arm2,arm3}
|
||||
arc1 = single_pattern_builder(arc1, 2760,2760)
|
||||
local circle = b.circle(200)
|
||||
local ball1 = b.translate(circle, 0,820)
|
||||
local ball2 = b.translate(circle, -920,740)
|
||||
local ball3 = b.translate(circle, 920,740)
|
||||
local rectangle = b.rectangle(25,40)
|
||||
local arm1 = b.translate(rectangle, 0, 610)
|
||||
local arm2 = b.translate(rectangle, -920, 530)
|
||||
local arm3 = b.translate(rectangle, 920, 530)
|
||||
|
||||
local arc1 = b.any{arc, ball1,ball2,ball3,arm1,arm2,arm3}
|
||||
arc1 = b.single_pattern(arc1, 2760,2760)
|
||||
|
||||
local root2 = math.sqrt(2)
|
||||
circle = circle_builder(200 / root2)
|
||||
ball1 = translate(circle, -0,770)
|
||||
ball2 = translate(circle, -920,690)
|
||||
ball3 = translate(circle, 920,690)
|
||||
rectangle = rectangle_builder(25,40)
|
||||
arm1 = translate(rectangle, 0, 610)
|
||||
arm2 = translate(rectangle, -920, 530)
|
||||
arm3 = translate(rectangle, 920, 530)
|
||||
circle = b.circle(200 / root2)
|
||||
ball1 = b.translate(circle, -0,770)
|
||||
ball2 = b.translate(circle, -920,690)
|
||||
ball3 = b.translate(circle, 920,690)
|
||||
rectangle = b.rectangle(25,40)
|
||||
arm1 = b.translate(rectangle, 0, 610)
|
||||
arm2 = b.translate(rectangle, -920, 530)
|
||||
arm3 = b.translate(rectangle, 920, 530)
|
||||
|
||||
local arc2 = compound_or{arc, ball1,ball2,ball3,arm1,arm2,arm3}
|
||||
arc2 = single_pattern_builder(arc2, 2760,2760)
|
||||
local arc2 = b.any{arc, ball1,ball2,ball3,arm1,arm2,arm3}
|
||||
arc2 = b.single_pattern(arc2, 2760,2760)
|
||||
|
||||
local arc2 = rotate(arc2,degrees(45))
|
||||
arc2 = scale(arc2, root2,root2)
|
||||
arc2 = translate(arc2, -330,-1375)
|
||||
local arc2 = b.rotate(arc2,degrees(45))
|
||||
arc2 = b.scale(arc2, root2,root2)
|
||||
arc2 = b.translate(arc2, -330,-1375)
|
||||
|
||||
local map = compound_or{arc1,arc2}
|
||||
map = translate(map,0,-700)
|
||||
--map = scale(map, .2, .2)
|
||||
local map = b.any{arc1,arc2}
|
||||
map = b.translate(map,0,-700)
|
||||
--map = b.scale(map, .2, .2)
|
||||
|
||||
return map
|
@ -5,14 +5,16 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.manhattan"
|
||||
pic = decompress(pic)
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
shape = translate(shape, 10, -96)
|
||||
shape = scale(shape,2,2)
|
||||
shape = rotate(shape, degrees(-22.5))
|
||||
local shape = b.picture(pic)
|
||||
shape = b.translate(shape, 10, -96)
|
||||
shape = b.scale(shape,2,2)
|
||||
shape = b.rotate(shape, degrees(-22.5))
|
||||
|
||||
shape = change_tile(shape, false, "deepwater")
|
||||
shape = b.change_tile(shape, false, "deepwater")
|
||||
|
||||
return shape
|
@ -5,17 +5,19 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.maori"
|
||||
pic= decompress(pic)
|
||||
pic= b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
shape = invert(shape)
|
||||
local crop = rectangle_builder(pic.width, pic.height)
|
||||
shape = compound_and{shape, crop}
|
||||
local shape = b.picture(pic)
|
||||
shape = b.invert(shape)
|
||||
local crop = b.rectangle(pic.width, pic.height)
|
||||
shape = b.all{shape, crop}
|
||||
|
||||
local map = single_pattern_builder(shape, pic.width, pic.height)
|
||||
local map = b.single_pattern(shape, pic.width, pic.height)
|
||||
|
||||
map = translate(map, 10, -96)
|
||||
map = scale(map,12,12)
|
||||
map = b.translate(map, 10, -96)
|
||||
map = b.scale(map,12,12)
|
||||
|
||||
return map
|
@ -9,15 +9,17 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.misc_stuff"
|
||||
pic = decompress(pic)
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
local map = single_pattern_builder(shape, pic.width, pic.height)
|
||||
local shape = b.picture(pic)
|
||||
local map = b.single_pattern(shape, pic.width, pic.height)
|
||||
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
map = change_tile(map, false, "water")
|
||||
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
map = b.change_tile(map, false, "water")
|
||||
|
||||
map = scale(map, 5, 5)
|
||||
map = b.scale(map, 5, 5)
|
||||
|
||||
return map
|
@ -7,29 +7,31 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local inner_circle = invert(circle_builder(48))
|
||||
local outer_circle = circle_builder(64)
|
||||
local square = invert(rectangle_builder(1000, 1000))
|
||||
square = rotate(square, degrees(45))
|
||||
square = translate(square, math.sqrt(2) * 500, 0)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local circle = compound_and({inner_circle, outer_circle, square})
|
||||
local inner_circle = b.invert(b.circle(48))
|
||||
local outer_circle = b.circle(64)
|
||||
local square = b.invert(b.rectangle(1000, 1000))
|
||||
square = b.rotate(square, degrees(45))
|
||||
square = b.translate(square, math.sqrt(2) * 500, 0)
|
||||
|
||||
local line1 = rectangle_builder(77, 16)
|
||||
line1 = rotate(line1, degrees(45))
|
||||
line1 = translate(line1, 66.5, 12.6875)
|
||||
local circle = b.all({inner_circle, outer_circle, square})
|
||||
|
||||
local line2 = rectangle_builder(45, 16)
|
||||
local line2 = rotate(line2, degrees(-45))
|
||||
line2 = translate(line2, 55.5, -23.6875)
|
||||
local line1 = b.rectangle(77, 16)
|
||||
line1 = b.rotate(line1, degrees(45))
|
||||
line1 = b.translate(line1, 66.5, 12.6875)
|
||||
|
||||
--line2 =change_tile(line2, true, "water")
|
||||
local half = compound_or({line2, line1, circle})
|
||||
local line2 = b.rectangle(45, 16)
|
||||
local line2 = b.rotate(line2, degrees(-45))
|
||||
line2 = b.translate(line2, 55.5, -23.6875)
|
||||
|
||||
half = translate(half, -79.1875, 0)
|
||||
local map = compound_or({half, flip_xy(half)})
|
||||
--line2 =b.change_tile(line2, true, "water")
|
||||
local half = b.any({line2, line1, circle})
|
||||
|
||||
map = scale(map, 11, 11)
|
||||
half = b.translate(half, -79.1875, 0)
|
||||
local map = b.any({half, b.flip_xy(half)})
|
||||
|
||||
map = b.scale(map, 11, 11)
|
||||
|
||||
|
||||
local function research_finished(event)
|
||||
@ -110,7 +112,7 @@ local function effect(x, y, world, tile)
|
||||
return tile
|
||||
end
|
||||
|
||||
map = apply_effect(map, effect)
|
||||
map = b.apply_effect(map, effect)
|
||||
|
||||
require "spawn_control"
|
||||
add_spawn("left", -88, -88)
|
||||
|
@ -5,14 +5,16 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.mona_lisa"
|
||||
pic = decompress(pic)
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
shape = translate(shape, 10, -96)
|
||||
shape = scale(shape,2,2)
|
||||
--shape = rotate(shape, degrees(0))
|
||||
local shape = b.picture(pic)
|
||||
shape = b.translate(shape, 10, -96)
|
||||
shape = b.scale(shape,2,2)
|
||||
--shape = b.rotate(shape, degrees(0))
|
||||
|
||||
-- shape = change_tile(shape, false, "deepwater")
|
||||
-- shape = b.change_tile(shape, false, "deepwater")
|
||||
|
||||
return shape
|
||||
|
@ -5,17 +5,19 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.north_america"
|
||||
local pic = decompress(pic)
|
||||
local map = picture_builder(pic)
|
||||
local pic = b.decompress(pic)
|
||||
local map = b.picture(pic)
|
||||
|
||||
-- this changes the size of the map
|
||||
map = scale(map, 2, 2)
|
||||
map = b.scale(map, 2, 2)
|
||||
|
||||
-- this moves the map, effectively changing the spawn point.
|
||||
map = translate(map, 0, -200)
|
||||
map = b.translate(map, 0, -200)
|
||||
|
||||
-- this sets the tile outside the bounds of the map to deepwater, remove this and it will be void.
|
||||
map = change_tile(map, false, "deepwater")
|
||||
map = b.change_tile(map, false, "deepwater")
|
||||
|
||||
return map
|
||||
|
@ -2,15 +2,17 @@
|
||||
require "map_gen.shared.generate_not_threaded"
|
||||
--require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.plus" --or whatever you called it in data->presets
|
||||
local pic = decompress(pic)
|
||||
local map = picture_builder(pic)
|
||||
local pic = b.decompress(pic)
|
||||
local map = b.picture(pic)
|
||||
|
||||
map = single_pattern_builder(map, pic.width-1, pic.height-1)
|
||||
map = b.single_pattern(map, pic.width-1, pic.height-1)
|
||||
|
||||
map = translate(map, 86, 0)
|
||||
map = b.translate(map, 86, 0)
|
||||
|
||||
-- uncomment the line below to change the size of the map scale(x, y)
|
||||
map = scale(map, 1.5, 1.5)
|
||||
-- uncomment the line below to change the size of the map b.scale(x, y)
|
||||
map = b.scale(map, 1.5, 1.5)
|
||||
|
||||
return map
|
@ -5,72 +5,74 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local ball = circle_builder(16)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local arm = rectangle_builder(2, 13)
|
||||
local arm1 = translate(arm, 0, -19.5)
|
||||
local arm2 = translate(arm, 0, 22)
|
||||
local arm3 = rectangle_builder(2, 19)
|
||||
arm3 = rotate(arm3, degrees(-30))
|
||||
arm3 = translate(arm3, -12, 22)
|
||||
local ball = b.circle(16)
|
||||
|
||||
ball = compound_or{ball, arm1, arm2, arm3}
|
||||
ball = translate(ball, 0, -28)
|
||||
local arm = b.rectangle(2, 13)
|
||||
local arm1 = b.translate(arm, 0, -19.5)
|
||||
local arm2 = b.translate(arm, 0, 22)
|
||||
local arm3 = b.rectangle(2, 19)
|
||||
arm3 = b.rotate(arm3, degrees(-30))
|
||||
arm3 = b.translate(arm3, -12, 22)
|
||||
|
||||
local balls = compound_or{ball, rotate(ball, degrees(120)), rotate(ball, degrees(240))}
|
||||
ball = b.any{ball, arm1, arm2, arm3}
|
||||
ball = b.translate(ball, 0, -28)
|
||||
|
||||
local small_circle = circle_builder(48)
|
||||
local big_circle = circle_builder(54)
|
||||
local ring = compound_and{big_circle, invert(small_circle)}
|
||||
local balls = b.any{ball, b.rotate(ball, degrees(120)), b.rotate(ball, degrees(240))}
|
||||
|
||||
local big_ball = compound_or{balls, ring}
|
||||
local small_circle = b.circle(48)
|
||||
local big_circle = b.circle(54)
|
||||
local ring = b.all{big_circle, b.invert(small_circle)}
|
||||
|
||||
local big_arm1 = rectangle_builder(6.75, 42.5)
|
||||
big_arm1 = translate(big_arm1, 0, -74.25)
|
||||
--local big_arm2 = rectangle_builder(24, 242)
|
||||
--big_arm2 = translate(big_arm2, 0, 174)
|
||||
local big_ball = b.any{balls, ring}
|
||||
|
||||
big_ball = compound_or{big_ball, big_arm1, big_arm2}
|
||||
local big_arm1 = b.rectangle(6.75, 42.5)
|
||||
big_arm1 = b.translate(big_arm1, 0, -74.25)
|
||||
--local big_arm2 = b.rectangle(24, 242)
|
||||
--big_arm2 = b.translate(big_arm2, 0, 174)
|
||||
|
||||
big_ball = rotate(big_ball, degrees(-90))
|
||||
big_ball = rotate(big_ball, math.atan2(54,210))
|
||||
big_ball = translate(big_ball, 210, -54)
|
||||
big_ball = b.any{big_ball, big_arm1, big_arm2}
|
||||
|
||||
big_ball = b.rotate(big_ball, degrees(-90))
|
||||
big_ball = b.rotate(big_ball, math.atan2(54,210))
|
||||
big_ball = b.translate(big_ball, 210, -54)
|
||||
|
||||
local big_balls = {}
|
||||
local count = 12
|
||||
local angle = 360 / count
|
||||
local offset = (180 / count) + 90
|
||||
for i = 0, count - 1 do
|
||||
local s =rotate(big_ball, degrees(i * angle ))
|
||||
local s =b.rotate(big_ball, degrees(i * angle ))
|
||||
table.insert(big_balls, s)
|
||||
end
|
||||
|
||||
local big_balls = segment_pattern_builder(big_balls)
|
||||
local big_balls = b.segment_pattern(big_balls)
|
||||
|
||||
|
||||
local small_circle = circle_builder(304.5)
|
||||
local big_circle = circle_builder(316.5) --342.5625
|
||||
local ring = compound_and{big_circle, invert(small_circle)}
|
||||
local small_circle = b.circle(304.5)
|
||||
local big_circle = b.circle(316.5) --342.5625
|
||||
local ring = b.all{big_circle, b.invert(small_circle)}
|
||||
|
||||
local map = compound_or{big_balls, ring}
|
||||
local map = b.any{big_balls, ring}
|
||||
|
||||
local leg = rectangle_builder(32,480)
|
||||
local head = translate (oval_builder(32, 64), 0, -64)
|
||||
local body = translate (circle_builder(64), 0, 64)
|
||||
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)
|
||||
|
||||
local count = 10
|
||||
local angle = 360 / count
|
||||
local list = { head, body }
|
||||
for i = 1, (count / 2) - 1 do
|
||||
local shape = rotate(leg, degrees(i * angle))
|
||||
local shape = b.rotate(leg, degrees(i * angle))
|
||||
table.insert( list, shape )
|
||||
end
|
||||
|
||||
local spider = compound_or(list)
|
||||
spider = scale(spider,.75,.75)
|
||||
local spider = b.any(list)
|
||||
spider = b.scale(spider,.75,.75)
|
||||
|
||||
--map = compound_or{map, spider}
|
||||
map = translate(map, -30, 201)
|
||||
map = scale(map, 12, 12)
|
||||
--map = b.any{map, spider}
|
||||
map = b.translate(map, -30, 201)
|
||||
map = b.scale(map, 12, 12)
|
||||
|
||||
return map
|
@ -5,35 +5,37 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local small_circle = circle_builder(16)
|
||||
local big_circle = circle_builder(18)
|
||||
local ring = compound_and{big_circle, invert(small_circle)}
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local box = rectangle_builder(10,10)
|
||||
box = translate(box, 16, -16)
|
||||
local line = rectangle_builder(36,1)
|
||||
line = translate(line, 0, -20.5)
|
||||
box = compound_or{box, line}
|
||||
local small_circle = b.circle(16)
|
||||
local big_circle = b.circle(18)
|
||||
local ring = b.all{big_circle, b.invert(small_circle)}
|
||||
|
||||
local box = b.rectangle(10,10)
|
||||
box = b.translate(box, 16, -16)
|
||||
local line = b.rectangle(36,1)
|
||||
line = b.translate(line, 0, -20.5)
|
||||
box = b.any{box, line}
|
||||
|
||||
local boxes = {}
|
||||
for i = 0, 3 do
|
||||
local b = rotate(box, degrees(i*90))
|
||||
local b = b.rotate(box, degrees(i*90))
|
||||
table.insert(boxes, b)
|
||||
end
|
||||
|
||||
boxes = compound_or(boxes)
|
||||
boxes = b.any(boxes)
|
||||
|
||||
local shape = compound_or{ring, boxes}
|
||||
local shape = b.any{ring, boxes}
|
||||
|
||||
local shapes ={}
|
||||
local sf = 1.8
|
||||
local sf_total = 1
|
||||
for i = 1, 10 do
|
||||
sf_total = sf_total * sf
|
||||
local s = scale(shape, sf_total, sf_total)
|
||||
local s = b.scale(shape, sf_total, sf_total)
|
||||
table.insert(shapes, s)
|
||||
end
|
||||
|
||||
local map = compound_or(shapes)
|
||||
local map = b.any(shapes)
|
||||
|
||||
return map
|
@ -5,20 +5,22 @@ map_gen_rows_per_tick = 4 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.template"
|
||||
local pic = decompress(pic)
|
||||
local map = picture_builder(pic)
|
||||
local pic = b.decompress(pic)
|
||||
local map = b.picture(pic)
|
||||
|
||||
-- this builds the map by duplicating the pic in every direction
|
||||
-- map = single_pattern_builder(map, pic.width-1, pic.height-1)
|
||||
-- map = b.single_pattern(map, pic.width-1, pic.height-1)
|
||||
|
||||
-- this changes the size of the map
|
||||
--map = scale(map, 2, 2)
|
||||
--map = b.scale(map, 2, 2)
|
||||
|
||||
-- this moves the map, effectively changing the spawn point.
|
||||
--map = translate(map, 0, -200)
|
||||
--map = b.translate(map, 0, -200)
|
||||
|
||||
-- this sets the tile outside the bounds of the map to deepwater, remove this and it will be void.
|
||||
--map = change_tile(map, false, "deepwater")
|
||||
--map = b.change_tile(map, false, "deepwater")
|
||||
|
||||
return map
|
@ -1,13 +1,18 @@
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local land = rectangle_builder(32,16)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local land = b.rectangle(32,16)
|
||||
|
||||
|
||||
local circle = circle_builder(4)
|
||||
local patch = resource_module_builder(circle, "iron-ore")
|
||||
local circle = b.circle(4)
|
||||
local patch = b.resource(b.circle(8), "iron-ore")
|
||||
|
||||
local tree = spawn_entity(circle, "tree-01")
|
||||
local tree = b.entity(circle, "tree-01")
|
||||
|
||||
local shape = builder_with_resource(land, patch)
|
||||
--[[ local shape = b.apply_entity(land, patch)
|
||||
shape = b.apply_entity(shape, tree) ]]
|
||||
|
||||
local shape = apply_entities(land, {patch, tree})
|
||||
|
||||
return shape
|
@ -5,11 +5,13 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local pic = require "map_gen.data.presets.turkey"
|
||||
local pic = decompress(pic)
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
local shape = scale(shape, 4, 4)
|
||||
local shape = translate(shape, -300, 500)
|
||||
local pic = require "map_gen.data.presets.turkey"
|
||||
local pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
local shape = b.scale(shape, 4, 4)
|
||||
local shape = b.translate(shape, -300, 500)
|
||||
|
||||
return shape
|
||||
|
@ -5,14 +5,16 @@ map_gen_rows_per_tick = 4 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.venice"
|
||||
local pic = decompress(pic)
|
||||
local map = picture_builder(pic)
|
||||
local pic = b.decompress(pic)
|
||||
local map = b.picture(pic)
|
||||
|
||||
map = translate(map, 90, 190)
|
||||
map = b.translate(map, 90, 190)
|
||||
|
||||
map = scale(map, 2, 2)
|
||||
map = b.scale(map, 2, 2)
|
||||
|
||||
map = change_tile(map, false, "deepwater")
|
||||
map = b.change_tile(map, false, "deepwater")
|
||||
|
||||
return map
|
@ -5,14 +5,16 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.void_gears"
|
||||
pic = decompress(pic)
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = picture_builder(pic)
|
||||
shape = invert(shape)
|
||||
local shape = b.picture(pic)
|
||||
shape = b.invert(shape)
|
||||
|
||||
local map = single_pattern_builder(shape, pic.width, pic.height)
|
||||
map = translate(map, -100, 120)
|
||||
map = scale(map, 2, 2)
|
||||
local map = b.single_pattern(shape, pic.width, pic.height)
|
||||
map = b.translate(map, -100, 120)
|
||||
map = b.scale(map, 2, 2)
|
||||
|
||||
return map
|
@ -5,49 +5,51 @@ map_gen_rows_per_tick = 8 -- Inclusive integer between 1 and 32. Used for map_ge
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local stripe_thickness = 24
|
||||
local stripe_distance = 384
|
||||
|
||||
local stripes = throttle_y(full_builder,stripe_thickness,stripe_distance)
|
||||
local joint = rectangle_builder(64)
|
||||
joint = rotate(joint,degrees(45))
|
||||
joint = translate(joint, 0, stripe_thickness / 2)
|
||||
local joints = single_y_pattern_builder(joint, stripe_distance)
|
||||
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)
|
||||
|
||||
stripes = compound_or{stripes, joints}
|
||||
stripes = b.any{stripes, joints}
|
||||
|
||||
local lines = {}
|
||||
local count = 8
|
||||
local angle = 360 / count
|
||||
local offset = (180 / count) + 90
|
||||
for i = 0, count - 1 do
|
||||
local line =rotate(stripes, degrees(i * angle + offset))
|
||||
local line =b.rotate(stripes, degrees(i * angle + offset))
|
||||
table.insert(lines, line)
|
||||
end
|
||||
|
||||
local web = segment_pattern_builder(lines)
|
||||
web = rotate(web, degrees(180 / count))
|
||||
local web = b.segment_pattern(lines)
|
||||
web = b.rotate(web, degrees(180 / count))
|
||||
|
||||
local path = path_builder(stripe_thickness)
|
||||
local path = b.path(stripe_thickness)
|
||||
|
||||
local leg = rectangle_builder(32,480)
|
||||
local head = translate (oval_builder(32, 64), 0, -64)
|
||||
local body = translate (circle_builder(64), 0, 64)
|
||||
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)
|
||||
|
||||
local count = 10
|
||||
local angle = 360 / count
|
||||
local list = { head, body }
|
||||
for i = 1, (count / 2) - 1 do
|
||||
local shape = rotate(leg, degrees(i * angle))
|
||||
local shape = b.rotate(leg, degrees(i * angle))
|
||||
table.insert( list, shape )
|
||||
end
|
||||
|
||||
local spider = compound_or(list)
|
||||
spider = scale(spider,2,2)
|
||||
local spider = b.any(list)
|
||||
spider = b.scale(spider,2,2)
|
||||
|
||||
local e = empty_builder
|
||||
local e = b.empty_shape
|
||||
local function s(r)
|
||||
return rotate(spider, degrees(r))
|
||||
return b.rotate(spider, degrees(r))
|
||||
end
|
||||
|
||||
local pattern =
|
||||
@ -60,12 +62,12 @@ local pattern =
|
||||
{s(180), e , e , e , e , e },
|
||||
}
|
||||
|
||||
local spiders = grid_pattern_builder(pattern, 6, 6, 820, 820)
|
||||
local spiders = b.grid_pattern(pattern, 6, 6, 820, 820)
|
||||
|
||||
local map = compound_or{ web, path, rotate(path, degrees(45)), spiders }
|
||||
local map = b.any{ web, path, b.rotate(path, degrees(45)), spiders }
|
||||
|
||||
local start = circle_builder(150)
|
||||
map = choose(start, full_builder, map)
|
||||
local start = b.circle(150)
|
||||
map = b.choose(start, b.full_shape, map)
|
||||
|
||||
--map = scale(map, 0.5, 0.5)
|
||||
--map = b.scale(map, 0.5, 0.5)
|
||||
return map
|
@ -2,15 +2,17 @@
|
||||
--require "map_gen.shared.generate_not_threaded"
|
||||
require "map_gen.shared.generate"
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.woman"
|
||||
local pic = decompress(pic)
|
||||
local shape = picture_builder(pic)
|
||||
local pic = b.decompress(pic)
|
||||
local shape = b.picture(pic)
|
||||
|
||||
local map = single_pattern_overlap_builder(shape, pic.width - 50, pic.height - 120)
|
||||
local map = b.single_pattern_overlap(shape, pic.width - 50, pic.height - 120)
|
||||
|
||||
map = translate(map, 135, -65)
|
||||
--map = change_tile(map, false, "deepwater")
|
||||
map = b.translate(map, 135, -65)
|
||||
--map = b.change_tile(map, false, "deepwater")
|
||||
|
||||
--map = scale(map, 2, 2)
|
||||
--map = b.scale(map, 2, 2)
|
||||
|
||||
return map
|
@ -5,38 +5,41 @@ function degrees(angle)
|
||||
return angle * deg_to_rad
|
||||
end
|
||||
|
||||
function get_tile(tile)
|
||||
local function add_entity(tile, entity)
|
||||
if type(tile) == "table" then
|
||||
return tile.tile
|
||||
else
|
||||
return tile
|
||||
end
|
||||
end
|
||||
|
||||
function add_entity(tile, entity)
|
||||
if tile.entities then
|
||||
table.insert(tile.entities, entity)
|
||||
else
|
||||
tile.entities = {entity}
|
||||
end
|
||||
elseif tile then
|
||||
tile = {
|
||||
tile = tile,
|
||||
entities = {entity}
|
||||
}
|
||||
end
|
||||
|
||||
return tile
|
||||
end
|
||||
|
||||
local Builders = {}
|
||||
|
||||
-- shape builders
|
||||
function empty_builder()
|
||||
function Builders.empty_shape()
|
||||
return nil
|
||||
end
|
||||
|
||||
function full_builder()
|
||||
function Builders.full_shape()
|
||||
return true
|
||||
end
|
||||
|
||||
function tile_builder(tile)
|
||||
function Builders.tile(tile)
|
||||
return function()
|
||||
return tile
|
||||
end
|
||||
end
|
||||
|
||||
function path_builder(thickness, optional_thickness_height)
|
||||
function Builders.path(thickness, optional_thickness_height)
|
||||
local width = thickness / 2
|
||||
local thickness2 = optional_thickness_height or thickness
|
||||
local height = thickness2 / 2
|
||||
@ -45,7 +48,7 @@ function path_builder(thickness, optional_thickness_height)
|
||||
end
|
||||
end
|
||||
|
||||
function rectangle_builder(width, height)
|
||||
function Builders.rectangle(width, height)
|
||||
width = width / 2
|
||||
if height then
|
||||
height = height / 2
|
||||
@ -57,21 +60,21 @@ function rectangle_builder(width, height)
|
||||
end
|
||||
end
|
||||
|
||||
function line_x_builder(thickness)
|
||||
function Builders.line_x(thickness)
|
||||
thickness = thickness / 2
|
||||
return function(x, y)
|
||||
return y > -thickness and y <= thickness
|
||||
end
|
||||
end
|
||||
|
||||
function line_y_builder(thickness)
|
||||
function Builders.line_y(thickness)
|
||||
thickness = thickness / 2
|
||||
return function(x, y)
|
||||
return x > -thickness and x <= thickness
|
||||
end
|
||||
end
|
||||
|
||||
function square_diamond_builder(size)
|
||||
function Builders.square_diamond(size)
|
||||
size = size / 2
|
||||
return function(x, y)
|
||||
return math.abs(x) + math.abs(y) <= size
|
||||
@ -79,7 +82,7 @@ function square_diamond_builder(size)
|
||||
end
|
||||
|
||||
local rot = math.sqrt(2) / 2 -- 45 degree rotation.
|
||||
function rectangle_diamond_builder(width, height)
|
||||
function Builders.rectangle_diamond(width, height)
|
||||
width = width / 2
|
||||
height = height / 2
|
||||
return function(x, y)
|
||||
@ -89,14 +92,14 @@ function rectangle_diamond_builder(width, height)
|
||||
end
|
||||
end
|
||||
|
||||
function circle_builder(radius)
|
||||
function Builders.circle(radius)
|
||||
local rr = radius * radius
|
||||
return function(x, y)
|
||||
return x * x + y * y < rr
|
||||
end
|
||||
end
|
||||
|
||||
function oval_builder(x_radius, y_radius)
|
||||
function Builders.oval(x_radius, y_radius)
|
||||
local x_rr = x_radius * x_radius
|
||||
local y_rr = y_radius * y_radius
|
||||
return function(x, y)
|
||||
@ -104,7 +107,7 @@ function oval_builder(x_radius, y_radius)
|
||||
end
|
||||
end
|
||||
|
||||
function sine_fill_builder(width, height)
|
||||
function Builders.sine_fill(width, height)
|
||||
width_inv = tau / width
|
||||
height_inv = -2 / height
|
||||
return function(x, y)
|
||||
@ -154,7 +157,7 @@ local tile_map = {
|
||||
[33] = "water"
|
||||
}
|
||||
|
||||
function decompress(pic)
|
||||
function Builders.decompress(pic)
|
||||
local data = pic.data
|
||||
local width = pic.width
|
||||
local height = pic.height
|
||||
@ -180,7 +183,7 @@ function decompress(pic)
|
||||
return {width = width, height = height, data = uncompressed}
|
||||
end
|
||||
|
||||
function picture_builder(pic)
|
||||
function Builders.picture(pic)
|
||||
local data = pic.data
|
||||
local width = pic.width
|
||||
local height = pic.height
|
||||
@ -203,53 +206,52 @@ function picture_builder(pic)
|
||||
end
|
||||
|
||||
-- transforms and shape helpers
|
||||
function translate(builder, x_offset, y_offset)
|
||||
function Builders.translate(shape, x_offset, y_offset)
|
||||
return function(x, y, world)
|
||||
return builder(x - x_offset, y - y_offset, world)
|
||||
return shape(x - x_offset, y - y_offset, world)
|
||||
end
|
||||
end
|
||||
|
||||
function scale(builder, x_scale, y_scale)
|
||||
function Builders.scale(shape, x_scale, y_scale)
|
||||
x_scale = 1 / x_scale
|
||||
y_scale = 1 / y_scale
|
||||
return function(x, y, world)
|
||||
return builder(x * x_scale, y * y_scale, world)
|
||||
return shape(x * x_scale, y * y_scale, world)
|
||||
end
|
||||
end
|
||||
|
||||
function rotate(builder, angle)
|
||||
function Builders.rotate(shape, angle)
|
||||
local qx = math.cos(angle)
|
||||
local qy = math.sin(angle)
|
||||
return function(x, y, world)
|
||||
local rot_x = qx * x - qy * y
|
||||
local rot_y = qy * x + qx * y
|
||||
return builder(rot_x, rot_y, world)
|
||||
return shape(rot_x, rot_y, world)
|
||||
end
|
||||
end
|
||||
|
||||
function flip_x(builder)
|
||||
function Builders.flip_x(shape)
|
||||
return function(x, y, world)
|
||||
return builder(-x, y, world)
|
||||
return shape(-x, y, world)
|
||||
end
|
||||
end
|
||||
|
||||
function flip_y(builder)
|
||||
function Builders.flip_y(shape)
|
||||
return function(x, y, world)
|
||||
return builder(x, -y, world)
|
||||
return shape(x, -y, world)
|
||||
end
|
||||
end
|
||||
|
||||
function flip_xy(builder)
|
||||
function Builders.flip_xy(shape)
|
||||
return function(x, y, world)
|
||||
return builder(-x, -y, world)
|
||||
return shape(-x, -y, world)
|
||||
end
|
||||
end
|
||||
|
||||
-- For resource_module_builder it will return the first success.
|
||||
function compound_or(builders)
|
||||
function Builders.any(shapes)
|
||||
return function(x, y, world)
|
||||
for _, v in ipairs(builders) do
|
||||
local tile = v(x, y, world)
|
||||
for _, s in ipairs(shapes) do
|
||||
local tile = s(x, y, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
@ -258,12 +260,11 @@ function compound_or(builders)
|
||||
end
|
||||
end
|
||||
|
||||
-- Wont work correctly with resource_module_builder becasues I don't know which one to return.
|
||||
function compound_and(builders)
|
||||
function Builders.all(shapes)
|
||||
return function(x, y, world)
|
||||
local tile
|
||||
for _, v in ipairs(builders) do
|
||||
tile = v(x, y, world)
|
||||
for _, s in ipairs(shapes) do
|
||||
tile = s(x, y, world)
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
@ -272,64 +273,54 @@ function compound_and(builders)
|
||||
end
|
||||
end
|
||||
|
||||
function invert(builder)
|
||||
function Builders.invert(shape)
|
||||
return function(x, y, world)
|
||||
local tile = builder(x, y, world)
|
||||
local tile = shape(x, y, world)
|
||||
return not tile
|
||||
end
|
||||
end
|
||||
|
||||
function throttle_x(builder, x_in, x_size)
|
||||
function Builders.throttle_x(shape, x_in, x_size)
|
||||
return function(x, y, world)
|
||||
if x % x_size < x_in then
|
||||
return builder(x, y, world)
|
||||
return shape(x, y, world)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function throttle_y(builder, y_in, y_size)
|
||||
function Builders.throttle_y(shape, y_in, y_size)
|
||||
return function(x, y, world)
|
||||
if y % y_size < y_in then
|
||||
return builder(x, y, world)
|
||||
return shape(x, y, world)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function throttle_xy(builder, x_in, x_size, y_in, y_size)
|
||||
function Builders.throttle_xy(shape, x_in, x_size, y_in, y_size)
|
||||
return function(x, y, world)
|
||||
if x % x_size < x_in and y % y_size < y_in then
|
||||
return builder(x, y, world)
|
||||
return shape(x, y, world)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function throttle_xy(builder, x_in, x_size, y_in, y_size)
|
||||
return function(x, y, world)
|
||||
if x % x_size < x_in and y % y_size < y_in then
|
||||
return builder(x, y, world)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function throttle_world_xy(builder, x_in, x_size, y_in, y_size)
|
||||
function Builders.throttle_world_xy(shape, x_in, x_size, y_in, y_size)
|
||||
return function(x, y, world)
|
||||
if world.x % x_size < x_in and world.y % y_size < y_in then
|
||||
return builder(x, y, world)
|
||||
return shape(x, y, world)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function choose(condition, true_shape, false_shape)
|
||||
function Builders.choose(condition, true_shape, false_shape)
|
||||
return function(x, y, world)
|
||||
if condition(x, y, world) then
|
||||
return true_shape(x, y, world)
|
||||
@ -339,13 +330,13 @@ function choose(condition, true_shape, false_shape)
|
||||
end
|
||||
end
|
||||
|
||||
function shape_or_else(shape, else_shape)
|
||||
function Builders.if_else(shape, else_shape)
|
||||
return function(x, y, world)
|
||||
return shape(x, y, world) or else_shape(x, y, world)
|
||||
end
|
||||
end
|
||||
|
||||
function linear_grow(shape, size)
|
||||
function Builders.linear_grow(shape, size)
|
||||
local half_size = size / 2
|
||||
return function(x, y, world)
|
||||
local t = math.ceil((y / size) + 0.5)
|
||||
@ -360,7 +351,7 @@ function linear_grow(shape, size)
|
||||
end
|
||||
end
|
||||
|
||||
function grow(in_shape, out_shape, size, offset)
|
||||
function Builders.grow(in_shape, out_shape, size, offset)
|
||||
local half_size = size / 2
|
||||
return function(x, y, world)
|
||||
local tx = math.ceil(math.abs(x) / half_size)
|
||||
@ -385,7 +376,7 @@ function grow(in_shape, out_shape, size, offset)
|
||||
end
|
||||
end
|
||||
|
||||
function project(shape, size, r)
|
||||
function Builders.project(shape, size, r)
|
||||
local ln_r = math.log(r)
|
||||
local r2 = 1 / (r - 1)
|
||||
local a = 1 / size
|
||||
@ -407,7 +398,7 @@ function project(shape, size, r)
|
||||
end
|
||||
end
|
||||
|
||||
function project_overlap(shape, size, r)
|
||||
function Builders.project_overlap(shape, size, r)
|
||||
local ln_r = math.log(r)
|
||||
local r2 = 1 / (r - 1)
|
||||
local a = 1 / size
|
||||
@ -461,12 +452,12 @@ end
|
||||
|
||||
-- ore generation.
|
||||
-- builder is the shape of the ore patch.
|
||||
function resource_module_builder(builder, resource_type, amount_function)
|
||||
function Builders.resource(shape, resource_type, amount_function)
|
||||
amount_function = amount_function or function(a, b)
|
||||
return 404
|
||||
end
|
||||
return function(x, y, world)
|
||||
if builder(x, y, world) then
|
||||
if shape(x, y, world) then
|
||||
return {
|
||||
name = resource_type,
|
||||
position = {world.x, world.y},
|
||||
@ -476,20 +467,35 @@ function resource_module_builder(builder, resource_type, amount_function)
|
||||
end
|
||||
end
|
||||
|
||||
function builder_with_resource(land_builder, resource_module)
|
||||
function Builders.apply_entity(shape, entity_shape)
|
||||
return function(x, y, world)
|
||||
local tile = land_builder(x, y, world)
|
||||
if tile then
|
||||
local entity = resource_module(x, y, world)
|
||||
if entity then
|
||||
if type(tile) == "table" then
|
||||
add_entity(tile, entity)
|
||||
else
|
||||
tile = {
|
||||
tile = tile,
|
||||
entities = {entity}
|
||||
}
|
||||
local tile = shape(x, y, world)
|
||||
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
local e = entity_shape(x, y, world)
|
||||
if e then
|
||||
tile = add_entity(tile, e)
|
||||
end
|
||||
|
||||
return tile
|
||||
end
|
||||
end
|
||||
|
||||
function Builders.apply_entities(shape, entity_shapes)
|
||||
return function(x, y, world)
|
||||
local tile = shape(x, y, world)
|
||||
|
||||
if not tile then
|
||||
return false
|
||||
end
|
||||
|
||||
for _, es in ipairs(entity_shapes) do
|
||||
local e = es(x, y, world)
|
||||
if e then
|
||||
tile = add_entity(tile, e)
|
||||
end
|
||||
end
|
||||
|
||||
@ -498,8 +504,8 @@ function builder_with_resource(land_builder, resource_module)
|
||||
end
|
||||
|
||||
-- pattern builders.
|
||||
function single_pattern_builder(shape, width, height)
|
||||
shape = shape or empty_builder
|
||||
function Builders.single_pattern(shape, width, height)
|
||||
shape = shape or Builder.empty_shape
|
||||
local half_width = width / 2
|
||||
local half_height
|
||||
if height then
|
||||
@ -516,8 +522,8 @@ function single_pattern_builder(shape, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
function single_pattern_overlap_builder(shape, width, height)
|
||||
shape = shape or empty_builder
|
||||
function Builders.single_pattern_overlap(shape, width, height)
|
||||
shape = shape or Builder.empty_shape
|
||||
local half_width = width / 2
|
||||
local half_height
|
||||
if height then
|
||||
@ -536,8 +542,8 @@ function single_pattern_overlap_builder(shape, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
function single_x_pattern_builder(shape, width)
|
||||
shape = shape or empty_builder
|
||||
function Builders.single_x_pattern(shape, width)
|
||||
shape = shape or Builder.empty_shape
|
||||
local half_width = width / 2
|
||||
|
||||
return function(x, y, world)
|
||||
@ -547,8 +553,8 @@ function single_x_pattern_builder(shape, width)
|
||||
end
|
||||
end
|
||||
|
||||
function single_y_pattern_builder(shape, height)
|
||||
shape = shape or empty_builder
|
||||
function Builders.single_y_pattern(shape, height)
|
||||
shape = shape or Builder.empty_shape
|
||||
local half_height = height / 2
|
||||
|
||||
return function(x, y, world)
|
||||
@ -558,7 +564,7 @@ function single_y_pattern_builder(shape, height)
|
||||
end
|
||||
end
|
||||
|
||||
function grid_pattern_builder(pattern, columns, rows, width, height)
|
||||
function Builders.grid_pattern(pattern, columns, rows, width, height)
|
||||
local half_width = width / 2
|
||||
local half_height = height / 2
|
||||
|
||||
@ -572,12 +578,12 @@ function grid_pattern_builder(pattern, columns, rows, width, height)
|
||||
local col_pos = math.floor(x / width + 0.5)
|
||||
local col_i = col_pos % columns + 1
|
||||
|
||||
local shape = row[col_i] or empty_builder
|
||||
local shape = row[col_i] or Builder.empty_shape
|
||||
return shape(x2, y2, world)
|
||||
end
|
||||
end
|
||||
|
||||
function grid_pattern_overlap_builder(pattern, columns, rows, width, height)
|
||||
function Builders.grid_pattern_overlap(pattern, columns, rows, width, height)
|
||||
local half_width = width / 2
|
||||
local half_height = height / 2
|
||||
|
||||
@ -591,7 +597,7 @@ function grid_pattern_overlap_builder(pattern, columns, rows, width, height)
|
||||
local col_pos = math.floor(x / width + 0.5)
|
||||
local col_i = col_pos % columns + 1
|
||||
|
||||
local shape = row[col_i] or empty_builder
|
||||
local shape = row[col_i] or Builder.empty_shape
|
||||
|
||||
local tile = shape(x2, y2, world)
|
||||
if tile then
|
||||
@ -600,14 +606,14 @@ function grid_pattern_overlap_builder(pattern, columns, rows, width, height)
|
||||
|
||||
-- edges
|
||||
local col_i_left = (col_pos - 1) % columns + 1
|
||||
shape = row[col_i_left] or empty_builder
|
||||
shape = row[col_i_left] or Builder.empty_shape
|
||||
tile = shape(x2 + width, y2, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
local col_i_right = (col_pos + 1) % columns + 1
|
||||
shape = row[col_i_right] or empty_builder
|
||||
shape = row[col_i_right] or Builder.empty_shape
|
||||
tile = shape(x2 - width, y2, world)
|
||||
if tile then
|
||||
return tile
|
||||
@ -615,7 +621,7 @@ function grid_pattern_overlap_builder(pattern, columns, rows, width, height)
|
||||
|
||||
local row_i_up = (row_pos - 1) % rows + 1
|
||||
local row_up = pattern[row_i_up] or {}
|
||||
shape = row_up[col_i] or empty_builder
|
||||
shape = row_up[col_i] or Builder.empty_shape
|
||||
tile = shape(x2, y2 + height, world)
|
||||
if tile then
|
||||
return tile
|
||||
@ -623,12 +629,12 @@ function grid_pattern_overlap_builder(pattern, columns, rows, width, height)
|
||||
|
||||
local row_i_down = (row_pos + 1) % rows + 1
|
||||
local row_down = pattern[row_i_down] or {}
|
||||
shape = row_down[col_i] or empty_builder
|
||||
shape = row_down[col_i] or Builder.empty_shape
|
||||
return shape(x2, y2 - height, world)
|
||||
end
|
||||
end
|
||||
|
||||
function grid_pattern_full_overlap_builder(pattern, columns, rows, width, height)
|
||||
function Builders.grid_pattern_full_overlap(pattern, columns, rows, width, height)
|
||||
local half_width = width / 2
|
||||
local half_height = height / 2
|
||||
|
||||
@ -651,71 +657,71 @@ function grid_pattern_full_overlap_builder(pattern, columns, rows, width, height
|
||||
local col_i_right = (col_pos + 1) % columns + 1
|
||||
|
||||
-- start from top left, move left to right then down
|
||||
local shape = row_up[col_i_left] or empty_builder
|
||||
local shape = row_up[col_i_left] or Builder.empty_shape
|
||||
local tile = shape(x2 + width, y2 + height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_up[col_i] or empty_builder
|
||||
shape = row_up[col_i] or Builder.empty_shape
|
||||
tile = shape(x2, y2 + height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_up[col_i_right] or empty_builder
|
||||
shape = row_up[col_i_right] or Builder.empty_shape
|
||||
tile = shape(x2 - width, y2 + height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row[col_i_left] or empty_builder
|
||||
shape = row[col_i_left] or Builder.empty_shape
|
||||
tile = shape(x2 + width, y2, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
local shape = row[col_i] or empty_builder
|
||||
local shape = row[col_i] or Builder.empty_shape
|
||||
tile = shape(x2, y2, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row[col_i_right] or empty_builder
|
||||
shape = row[col_i_right] or Builder.empty_shape
|
||||
tile = shape(x2 - width, y2, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_down[col_i_left] or empty_builder
|
||||
shape = row_down[col_i_left] or Builder.empty_shape
|
||||
tile = shape(x2 + width, y2 - height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_down[col_i] or empty_builder
|
||||
shape = row_down[col_i] or Builder.empty_shape
|
||||
tile = shape(x2, y2 - height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_down[col_i_right] or empty_builder
|
||||
shape = row_down[col_i_right] or Builder.empty_shape
|
||||
return shape(x2 - width, y2 - height, world)
|
||||
end
|
||||
end
|
||||
|
||||
function segment_pattern_builder(pattern)
|
||||
function Builders.segment_pattern(pattern)
|
||||
local count = #pattern
|
||||
|
||||
return function(x, y, world)
|
||||
local angle = math.atan2(-y, x)
|
||||
local index = math.floor(angle / tau * count) % count + 1
|
||||
local shape = pattern[index] or empty_builder
|
||||
local shape = pattern[index] or Builder.empty_shape
|
||||
return shape(x, y, world)
|
||||
end
|
||||
end
|
||||
|
||||
function pyramid_builder(pattern, columns, rows, width, height)
|
||||
function Builders.pyramid_pattern(pattern, columns, rows, width, height)
|
||||
local half_width = width / 2
|
||||
local half_height = height / 2
|
||||
|
||||
@ -737,12 +743,12 @@ function pyramid_builder(pattern, columns, rows, width, height)
|
||||
return false
|
||||
end
|
||||
|
||||
local shape = row[col_i] or empty_builder
|
||||
local shape = row[col_i] or Builder.empty_shape
|
||||
return shape(x2, y2, world)
|
||||
end
|
||||
end
|
||||
|
||||
function pyramid_inner_overlap_builder(pattern, columns, rows, width, height)
|
||||
function Builders.pyramid_pattern_inner_overlap(pattern, columns, rows, width, height)
|
||||
local half_width = width / 2
|
||||
local half_height = height / 2
|
||||
|
||||
@ -794,60 +800,60 @@ function pyramid_inner_overlap_builder(pattern, columns, rows, width, height)
|
||||
local col_i_right2 = (col_pos + 0) % columns + 1
|
||||
|
||||
-- start from top left, move left to right then down
|
||||
local shape = row_up[col_i_left] or empty_builder
|
||||
local shape = row_up[col_i_left] or Builder.empty_shape
|
||||
local tile = shape(x_even + width, y2 + height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_up[col_i_odd] or empty_builder
|
||||
shape = row_up[col_i_odd] or Builder.empty_shape
|
||||
tile = shape(x_odd, y2 + height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_up[col_i_right] or empty_builder
|
||||
shape = row_up[col_i_right] or Builder.empty_shape
|
||||
tile = shape(x_even - width, y2 + height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row[col_i_left] or empty_builder
|
||||
shape = row[col_i_left] or Builder.empty_shape
|
||||
tile = shape(x_even + width, y2, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
local shape = row[col_i] or empty_builder
|
||||
local shape = row[col_i] or Builder.empty_shape
|
||||
tile = shape(x_even, y2, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row[col_i_right] or empty_builder
|
||||
shape = row[col_i_right] or Builder.empty_shape
|
||||
tile = shape(x_even - width, y2, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_down[col_i_left] or empty_builder
|
||||
shape = row_down[col_i_left] or Builder.empty_shape
|
||||
tile = shape(x_even + width, y2 - height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_down[col_i_odd] or empty_builder
|
||||
shape = row_down[col_i_odd] or Builder.empty_shape
|
||||
tile = shape(x_odd, y2 - height, world)
|
||||
if tile then
|
||||
return tile
|
||||
end
|
||||
|
||||
shape = row_down[col_i_right] or empty_builder
|
||||
shape = row_down[col_i_right] or Builder.empty_shape
|
||||
return shape(x_even - width, y2 - height, world)
|
||||
end
|
||||
end
|
||||
|
||||
function grid_pattern_offset_builder(pattern, columns, rows, width, height)
|
||||
function Builders.grid_pattern_offset(pattern, columns, rows, width, height)
|
||||
local half_width = width / 2
|
||||
local half_height = height / 2
|
||||
|
||||
@ -864,15 +870,15 @@ function grid_pattern_offset_builder(pattern, columns, rows, width, height)
|
||||
local y2 = y2 + height * math.floor((row_pos + 1) / rows)
|
||||
local x2 = x2 + width * math.floor((col_pos + 1) / columns)
|
||||
|
||||
local shape = row[col_i] or empty_builder
|
||||
local shape = row[col_i] or Builder.empty_shape
|
||||
return shape(x2, y2, world)
|
||||
end
|
||||
end
|
||||
|
||||
-- tile converters
|
||||
function change_tile(builder, old_tile, new_tile)
|
||||
function Builders.change_tile(shape, old_tile, new_tile)
|
||||
return function(x, y, world)
|
||||
local tile = builder(x, y, world)
|
||||
local tile = shape(x, y, world)
|
||||
|
||||
if type(tile) == "table" then
|
||||
if tile.tile == old_tile then
|
||||
@ -888,9 +894,9 @@ function change_tile(builder, old_tile, new_tile)
|
||||
end
|
||||
end
|
||||
|
||||
function change_collision_tile(builder, collides, new_tile)
|
||||
function Builders.change_collision_tile(shape, collides, new_tile)
|
||||
return function(x, y, world)
|
||||
local tile = builder(x, y, world)
|
||||
local tile = shape(x, y, world)
|
||||
|
||||
if type(tile) == "table" then
|
||||
if tile.tile.collides_with(collides) then
|
||||
@ -908,7 +914,7 @@ function change_collision_tile(builder, collides, new_tile)
|
||||
end
|
||||
|
||||
-- only changes tiles made by the factorio map generator.
|
||||
function change_map_gen_tile(builder, old_tile, new_tile)
|
||||
function Builders.change_map_gen_tile(shape, old_tile, new_tile)
|
||||
return function(x, y, world)
|
||||
local function handle_tile(tile)
|
||||
if type(tile) == "boolean" and tile then
|
||||
@ -920,7 +926,7 @@ function change_map_gen_tile(builder, old_tile, new_tile)
|
||||
return tile
|
||||
end
|
||||
|
||||
local tile = builder(x, y, world)
|
||||
local tile = shape(x, y, world)
|
||||
|
||||
if type(tile) == "table" then
|
||||
tile.tile = handle_tile(tile.tile)
|
||||
@ -933,7 +939,7 @@ function change_map_gen_tile(builder, old_tile, new_tile)
|
||||
end
|
||||
|
||||
-- only changes tiles made by the factorio map generator.
|
||||
function change_map_gen_collision_tile(builder, collides, new_tile)
|
||||
function Builders.change_map_gen_collision_tile(shape, collides, new_tile)
|
||||
return function(x, y, world)
|
||||
local function handle_tile(tile)
|
||||
if type(tile) == "boolean" and tile then
|
||||
@ -945,7 +951,7 @@ function change_map_gen_collision_tile(builder, collides, new_tile)
|
||||
return tile
|
||||
end
|
||||
|
||||
local tile = builder(x, y, world)
|
||||
local tile = shape(x, y, world)
|
||||
|
||||
if type(tile) == "table" then
|
||||
tile.tile = handle_tile(tile.tile)
|
||||
@ -964,7 +970,7 @@ local water_tiles = {
|
||||
["deepwater-green"] = true
|
||||
}
|
||||
|
||||
function spawn_fish(builder, spawn_rate)
|
||||
function Builders.fish(shape, spawn_rate)
|
||||
return function(x, y, world)
|
||||
local function handle_tile(tile)
|
||||
if type(tile) == "string" then
|
||||
@ -978,7 +984,7 @@ function spawn_fish(builder, spawn_rate)
|
||||
end
|
||||
end
|
||||
|
||||
local tile = builder(x, y, world)
|
||||
local tile = shape(x, y, world)
|
||||
|
||||
if type(tile) == "table" then
|
||||
local entity = handle_tile(tile.tile)
|
||||
@ -999,30 +1005,31 @@ function spawn_fish(builder, spawn_rate)
|
||||
end
|
||||
end
|
||||
|
||||
--todo change to entiy_module_builder
|
||||
function spawn_entity(builder, name)
|
||||
function Builders.entity(shape, name)
|
||||
return function(x, y, world)
|
||||
if builder(x, y, world) then
|
||||
if shape(x, y, world) then
|
||||
return {name = name, position = {world.x, world.y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function apply_effect(builder, func)
|
||||
function Builders.apply_effect(shape, func)
|
||||
return function(x, y, world)
|
||||
local tile = builder(x, y, world)
|
||||
local tile = shape(x, y, world)
|
||||
return func(x, y, world, tile)
|
||||
end
|
||||
end
|
||||
|
||||
function manhattan_ore_value(base, mult)
|
||||
function Builders.manhattan_value(base, mult)
|
||||
return function(x, y)
|
||||
return mult * (math.abs(x) + math.abs(y)) + base
|
||||
end
|
||||
end
|
||||
|
||||
function euclidean_ore_value(base, mult)
|
||||
function Builders.euclidean_value(base, mult)
|
||||
return function(x, y)
|
||||
return mult * math.sqrt(x * x + y * y) + base
|
||||
end
|
||||
end
|
||||
|
||||
return Builders
|
||||
|
Loading…
Reference in New Issue
Block a user