1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00
RedMew/map_gen/presets/crash_site.lua

51 lines
1.7 KiB
Lua
Raw Normal View History

2018-07-14 11:33:06 +02:00
require('map_gen.presets.crash_site.blueprint_extractor')
2018-07-13 12:47:38 +02:00
local b = require 'map_gen.shared.builders'
local Random = require 'map_gen.shared.random'
local OutpostBuilder = require 'map_gen.presets.crash_site.outpost_builder'
2018-07-14 11:33:06 +02:00
local outpost_seed = 1000
2018-07-13 12:47:38 +02:00
local outpost_blocks = 9
local outpost_variance = 3
local outpost_min_step = 2
local outpost_max_level = 4
2018-07-14 11:33:06 +02:00
local striaght_wall = OutpostBuilder.make_4_way(require('map_gen.presets.crash_site.outpost_data.gun_turrent_straight'))
local outer_corner_wall =
OutpostBuilder.make_4_way(require('map_gen.presets.crash_site.outpost_data.gun_turrent_outer_corner'))
local inner_corner_wall =
OutpostBuilder.make_4_way(require('map_gen.presets.crash_site.outpost_data.gun_turret_inner_corner'))
local templates = {
{striaght_wall, outer_corner_wall, inner_corner_wall},
{[22] = {entity = {name = 'stone-furnace'}}},
{[22] = {entity = {name = 'assembling-machine-2'}}},
{[22] = {entity = {name = 'oil-refinery'}}}
}
2018-07-13 12:47:38 +02:00
local outpost_builder = OutpostBuilder.new(outpost_seed)
2018-07-14 11:33:06 +02:00
local shape =
outpost_builder:do_outpost(outpost_blocks, outpost_variance, outpost_min_step, outpost_max_level, templates)
2018-07-13 12:47:38 +02:00
local pattern = {}
2018-07-14 11:33:06 +02:00
local grid_size = (outpost_blocks + 2) * 6
local half_grid_size = grid_size * 0.5
2018-07-13 12:47:38 +02:00
for r = 1, 100 do
local row = {}
pattern[r] = row
for c = 1, 100 do
2018-07-14 11:33:06 +02:00
local s =
outpost_builder:do_outpost(outpost_blocks, outpost_variance, outpost_min_step, outpost_max_level, templates)
s = b.translate(s, -half_grid_size, -half_grid_size)
row[c] = s
2018-07-13 12:47:38 +02:00
end
end
2018-07-14 11:33:06 +02:00
local outposts = b.grid_pattern(pattern, 100, 100, grid_size, grid_size)
local map = b.if_else(outposts, b.full_shape)
map = b.change_tile(map, true, 'grass-1')
2018-07-13 12:47:38 +02:00
return map