1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-02-15 13:53:13 +02:00

Add DO:X Cross map (#1460)

This commit is contained in:
RedRafe 2024-11-29 21:44:18 +01:00 committed by GitHub
parent 8d6d54a5d3
commit 8d7a3d6790
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 160 additions and 0 deletions

View File

@ -0,0 +1,76 @@
local b = require 'map_gen.shared.builders'
local start_value = b.exponential_value(0, 0.15, 1.3)
local value = b.exponential_value(0, 0.15, 1.3)
return {
{
name = 'copper-ore',
['tiles'] = {
[1] = 'red-desert-0',
[2] = 'red-desert-1',
[3] = 'red-desert-2',
[4] = 'red-desert-3'
},
['start'] = start_value,
['weight'] = 1,
['ratios'] = {
{resource = b.resource(b.full_shape, 'iron-ore', value), weight = 15},
{resource = b.resource(b.full_shape, 'copper-ore', value), weight = 70},
{resource = b.resource(b.full_shape, 'stone', value), weight = 10},
{resource = b.resource(b.full_shape, 'coal', value), weight = 5}
}
},
{
name = 'coal',
['tiles'] = {
[1] = 'dirt-1',
[2] = 'dirt-2',
[3] = 'dirt-3',
[4] = 'dirt-4',
[5] = 'dirt-5',
[6] = 'dirt-6',
[7] = 'dirt-7'
},
['start'] = start_value,
['weight'] = 1,
['ratios'] = {
{resource = b.resource(b.full_shape, 'iron-ore', value), weight = 14},
{resource = b.resource(b.full_shape, 'copper-ore', value), weight = 6},
{resource = b.resource(b.full_shape, 'stone', value), weight = 10},
{resource = b.resource(b.full_shape, 'coal', value), weight = 70}
}
},
{
name = 'iron-ore',
['tiles'] = {
[1] = 'grass-1',
[2] = 'grass-2',
[3] = 'grass-3',
[4] = 'grass-4'
},
['start'] = start_value,
['weight'] = 1,
['ratios'] = {
{resource = b.resource(b.full_shape, 'iron-ore', value), weight = 75},
{resource = b.resource(b.full_shape, 'copper-ore', value), weight = 13},
{resource = b.resource(b.full_shape, 'stone', value), weight = 7},
{resource = b.resource(b.full_shape, 'coal', value), weight = 5}
}
},
{
name = 'stone',
['tiles'] = {
[1] = 'sand-1',
[2] = 'sand-2',
[3] = 'sand-3'
},
['start'] = start_value,
['weight'] = 1,
['ratios'] = {
{resource = b.resource(b.full_shape, 'iron-ore', value), weight = 25},
{resource = b.resource(b.full_shape, 'copper-ore', value), weight = 10},
{resource = b.resource(b.full_shape, 'stone', value), weight = 60},
{resource = b.resource(b.full_shape, 'coal', value), weight = 5}
}
}
}

View File

@ -0,0 +1,58 @@
local Helper = require 'map_gen.maps.danger_ores.modules.helper'
local b = require 'map_gen.shared.builders'
local table = require 'utils.table'
return function(config)
local main_ores = config.main_ores
local shuffle_order = config.main_ores_shuffle_order
local main_ores_rotate = config.main_ores_rotate or 0
local main_ores_split_count = config.main_ores_split_count or 1
main_ores = Helper.split_ore(main_ores, main_ores_split_count)
return function(tile_builder, ore_builder, spawn_shape, water_shape, random_gen)
local shapes = {}
for _, ore_data in pairs(main_ores) do
local ore_name = ore_data.name
local tiles = ore_data.tiles
local land = tile_builder(tiles)
local ratios = ore_data.ratios
local weighted = b.prepare_weighted_array(ratios)
local amount = ore_data.start
local ore = ore_builder(ore_name, amount, ratios, weighted)
local shape = b.apply_entity(land, ore)
shapes[#shapes + 1] = {shape = shape, weight = ore_data.weight}
end
if shuffle_order then
table.shuffle_table(shapes, random_gen)
end
local ores = b.segment_weighted_pattern(shapes)
ores = b.rotate(ores, math.rad(135))
local main_ores_shape = b.any {spawn_shape, water_shape, ores}
local h_bound = b.line_x(124)
local v_bound = b.line_y(124)
local cross = b.any {h_bound, v_bound}
local water_h_bound = b.line_x(128)
local water_v_bound = b.line_y(128)
local water_cross = b.any {water_h_bound, water_v_bound}
local water_tiles = b.tile('water')
local water_border = b.choose(water_cross, water_tiles, b.empty_shape)
local main_shape = b.choose(cross, main_ores_shape, water_border)
if main_ores_rotate ~= 0 then
main_shape = b.rotate(main_shape, math.rad(main_ores_rotate))
end
return main_shape
end
end

View File

@ -60,6 +60,7 @@ local maps = {
{ name = 'danger-ore-split', display_name = 'Split (4x sectors)', mod_pack = mod_packs.normal },
{ name = 'danger-ore-square', display_name = 'Square (corner start)', mod_pack = mod_packs.normal },
{ name = 'danger-ore-terraforming', display_name = 'Terraforming (default)', mod_pack = mod_packs.normal },
{ name = 'danger-ore-x-cross', display_name = 'X Cross (45 degrees)', mod_pack = mod_packs.normal },
--{ name = 'danger-ore-xmas-tree', display_name = 'Christmas Tree (triangle)', mod_pack = mod_packs.normal },
}

View File

@ -0,0 +1,24 @@
local B = require 'map_gen.shared.builders'
local DOC = require 'map_gen.maps.danger_ores.configuration'
local Scenario = require 'map_gen.maps.danger_ores.scenario'
local ScenarioInfo = require 'features.gui.info'
ScenarioInfo.set_map_name('Danger Ores - X Cross')
ScenarioInfo.add_map_extra_info([[
This map is split in four sectors [item=iron-ore] [item=copper-ore] [item=coal] [item=stone].
Each sector has a main resource and the other resources at a lower ratio.
]])
local h_bound, v_bound = B.line_x(182), B.line_y(182)
local cross = B.rotate(B.any{ h_bound, v_bound }, math.rad(135))
DOC.scenario_name = 'danger-ore-x-cross'
DOC.map_config.main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_x_cross'
DOC.map_config.main_ores = require 'map_gen.maps.danger_ores.config.x_cross_ores'
DOC.map_config.main_ores_rotate = 135
DOC.map_config.spawn_shape = B.rectangle(100)
DOC.map_config.start_ore_shape = B.rotate(B.rectangle(116), math.rad(135))
DOC.map_config.water = nil
DOC.terraforming.bounds = cross
return Scenario.register(DOC)

View File

@ -0,0 +1 @@
return require 'map_gen.maps.danger_ores.presets.danger_ore_x_cross'