1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Merge pull request #1193 from grilledham/fix_gradient

Fix no oil/uranium on danger ores gradient.
This commit is contained in:
grilledham 2021-03-11 19:34:22 +00:00 committed by GitHub
commit adbace1797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 9 deletions

View File

@ -4,32 +4,32 @@ local value = b.euclidean_value
return {
['iron-ore'] = {
tiles = {'grass-1', 'grass-2', 'grass-3', 'grass-4'},
start = value(40, 0),
shape = b.resource(b.full_shape, 'iron-ore', value(0, 0.6)),
start = value(50, 0),
shape = b.resource(b.full_shape, 'iron-ore', value(0, 0.75)),
weight = function(v)
return 4 * (v ^ 4) + 0.25
end
},
['copper-ore'] = {
tiles = {'red-desert-0', 'red-desert-1', 'red-desert-2', 'red-desert-3'},
start = value(40, 0),
shape = b.resource(b.full_shape, 'copper-ore', value(0, 0.6)),
start = value(50, 0),
shape = b.resource(b.full_shape, 'copper-ore', value(0, 0.75)),
weight = function(v)
return 3 * (v ^ 4) + 0.2
end
},
['coal'] = {
tiles = {'dirt-1', 'dirt-2', 'dirt-3', 'dirt-4', 'dirt-5', 'dirt-6', 'dirt-7'},
start = value(40, 0),
shape = b.resource(b.full_shape, 'coal', value(0, 0.6)),
start = value(50, 0),
shape = b.resource(b.full_shape, 'coal', value(0, 0.75)),
weight = function(v)
return 2.5 * (v ^ 6) + 0.2
end
},
['stone'] = {
tiles = {'sand-1', 'sand-2', 'sand-3'},
start = value(40, 0),
shape = b.resource(b.full_shape, 'stone', value(0, 0.6)),
start = value(50, 0),
shape = b.resource(b.full_shape, 'stone', value(0, 0.75)),
weight = function(v)
return 1 * (v ^ 6) + 0.15
end

View File

@ -1,13 +1,30 @@
local b = require 'map_gen.shared.builders'
local table = require 'utils.table'
local function no_op()
end
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 resource_patches = (config.resource_patches or no_op)(config) or b.empty_shape
local dense_patches = (config.dense_patches or no_op)(config) or no_op
local start_ore_shape = config.start_ore_shape or b.circle(68)
local function apply_resource_patches(x,y, world, entity)
local resource_patches_entity = resource_patches(x, y, world)
if resource_patches_entity ~= false then
return resource_patches_entity
end
dense_patches(x, y, entity)
entity.enable_tree_removal = false
return entity
end
return function(tile_builder, _, spawn_shape, water_shape, random_gen)
local pattern = {}
for ore_name, data in pairs(main_ores) do
@ -32,6 +49,7 @@ return function(config)
local start_ores = b.segment_pattern(start_ore_shapes)
start_ores = b.rotate(start_ores, math.rad(45))
local main_ores_shape = b.gradient_pattern(ore_pattern)
main_ores_shape = b.apply_effect(main_ores_shape, apply_resource_patches)
local ores = b.choose(start_ore_shape, start_ores, main_ores_shape)
local map = b.apply_entity(land, ores)

View File

@ -4,7 +4,7 @@ local Event = require 'utils.event'
local b = require 'map_gen.shared.builders'
local ScenarioInfo = require 'features.gui.info'
ScenarioInfo.set_map_name('Terraforming Danger Ore')
ScenarioInfo.set_map_name('Gradient Danger Ore')
ScenarioInfo.set_map_description([[
Clear the ore to expand the base,
focus mining efforts on specific quadrants to ensure