mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-03 14:53:01 +02:00
Fix duplicate outpost IDs. (#1385)
This commit is contained in:
parent
112739c3a2
commit
c9b64afafd
@ -24,8 +24,8 @@ bounds = b.translate(bounds, x_offset * scale, y_offset * scale)
|
||||
local config = {
|
||||
scenario_name = 'crashsite-UK',
|
||||
map_gen_settings = {MGSP.starting_area_very_low, MGSP.ore_oil_none, MGSP.enemy_none, MGSP.cliff_none},
|
||||
grid_number_of_blocks = 15,
|
||||
mini_grid_number_of_blocks = 29,
|
||||
grid_number_of_blocks = 17,
|
||||
mini_grid_number_of_blocks = 33,
|
||||
bounds_shape = bounds
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local ScenarioInfo = require 'features.gui.info'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
local degrees = require'utils.math'.degrees
|
||||
|
||||
local type = type
|
||||
local water_tiles = b.water_tiles
|
||||
@ -8,20 +9,18 @@ local path_tiles = b.path_tiles
|
||||
|
||||
local pic = require 'map_gen.data.presets.manhattan'
|
||||
local world_map = b.picture(pic)
|
||||
local degrees = require "utils.math".degrees
|
||||
world_map = b.choose(b.rectangle(pic.width, pic.height - 4), world_map, b.empty_shape)
|
||||
|
||||
local x_offset, y_offset = 200, 1337
|
||||
world_map = b.translate(world_map, x_offset, y_offset)
|
||||
world_map = b.rotate(world_map, degrees(-270))
|
||||
|
||||
local scale = 2
|
||||
local height = 8000 * scale
|
||||
local width = 8000 * scale
|
||||
|
||||
world_map = b.scale(world_map, scale)
|
||||
|
||||
local bounds = b.rectangle(width, height)
|
||||
bounds = b.translate(bounds, x_offset * scale, y_offset * scale)
|
||||
local bounds = b.rectangle(pic.height * scale, pic.width * scale)
|
||||
bounds = b.translate(bounds, y_offset * scale, -x_offset * scale)
|
||||
|
||||
local config = {
|
||||
scenario_name = 'crashsite-manhattan',
|
||||
@ -31,8 +30,8 @@ local config = {
|
||||
MGSP.enemy_none,
|
||||
MGSP.cliff_none
|
||||
},
|
||||
grid_number_of_blocks = 15,
|
||||
mini_grid_number_of_blocks = 29,
|
||||
grid_number_of_blocks = 65,
|
||||
mini_grid_number_of_blocks = 123,
|
||||
bounds_shape = bounds
|
||||
}
|
||||
|
||||
|
@ -634,7 +634,7 @@ local function init(config)
|
||||
end
|
||||
|
||||
local outposts =
|
||||
b.grid_pattern(pattern, grid_number_of_blocks, grid_number_of_blocks, grid_block_size, grid_block_size)
|
||||
b.grid_pattern_no_repeat(pattern, --[[grid_number_of_blocks, grid_number_of_blocks,]] grid_block_size, grid_block_size)
|
||||
local mini_outposts =
|
||||
b.grid_pattern(
|
||||
mini_pattern,
|
||||
|
@ -1227,6 +1227,25 @@ function Builders.grid_pattern(pattern, columns, rows, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
function Builders.grid_pattern_no_repeat(pattern, width, height)
|
||||
local half_width = width / 2
|
||||
local half_height = height / 2
|
||||
|
||||
return function(x, y, world)
|
||||
local y2 = ((y + half_height) % height) - half_height
|
||||
local row_pos = floor(y / height + 0.5)
|
||||
local row_i = row_pos + 1
|
||||
local row = pattern[row_i] or {}
|
||||
|
||||
local x2 = ((x + half_width) % width) - half_width
|
||||
local col_pos = floor(x / width + 0.5)
|
||||
local col_i = col_pos + 1
|
||||
|
||||
local shape = row[col_i] or Builders.empty_shape
|
||||
return shape(x2, y2, world)
|
||||
end
|
||||
end
|
||||
|
||||
function Builders.grid_pattern_no_offset(pattern, columns, rows, width, height)
|
||||
return function(x, y, world)
|
||||
local row_pos = floor(y / height + 0.5)
|
||||
|
Loading…
x
Reference in New Issue
Block a user