mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-30 04:30:58 +02:00
Merge pull request #1193 from grilledham/fix_gradient
Fix no oil/uranium on danger ores gradient.
This commit is contained in:
commit
adbace1797
@ -4,32 +4,32 @@ local value = b.euclidean_value
|
|||||||
return {
|
return {
|
||||||
['iron-ore'] = {
|
['iron-ore'] = {
|
||||||
tiles = {'grass-1', 'grass-2', 'grass-3', 'grass-4'},
|
tiles = {'grass-1', 'grass-2', 'grass-3', 'grass-4'},
|
||||||
start = value(40, 0),
|
start = value(50, 0),
|
||||||
shape = b.resource(b.full_shape, 'iron-ore', value(0, 0.6)),
|
shape = b.resource(b.full_shape, 'iron-ore', value(0, 0.75)),
|
||||||
weight = function(v)
|
weight = function(v)
|
||||||
return 4 * (v ^ 4) + 0.25
|
return 4 * (v ^ 4) + 0.25
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
['copper-ore'] = {
|
['copper-ore'] = {
|
||||||
tiles = {'red-desert-0', 'red-desert-1', 'red-desert-2', 'red-desert-3'},
|
tiles = {'red-desert-0', 'red-desert-1', 'red-desert-2', 'red-desert-3'},
|
||||||
start = value(40, 0),
|
start = value(50, 0),
|
||||||
shape = b.resource(b.full_shape, 'copper-ore', value(0, 0.6)),
|
shape = b.resource(b.full_shape, 'copper-ore', value(0, 0.75)),
|
||||||
weight = function(v)
|
weight = function(v)
|
||||||
return 3 * (v ^ 4) + 0.2
|
return 3 * (v ^ 4) + 0.2
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
['coal'] = {
|
['coal'] = {
|
||||||
tiles = {'dirt-1', 'dirt-2', 'dirt-3', 'dirt-4', 'dirt-5', 'dirt-6', 'dirt-7'},
|
tiles = {'dirt-1', 'dirt-2', 'dirt-3', 'dirt-4', 'dirt-5', 'dirt-6', 'dirt-7'},
|
||||||
start = value(40, 0),
|
start = value(50, 0),
|
||||||
shape = b.resource(b.full_shape, 'coal', value(0, 0.6)),
|
shape = b.resource(b.full_shape, 'coal', value(0, 0.75)),
|
||||||
weight = function(v)
|
weight = function(v)
|
||||||
return 2.5 * (v ^ 6) + 0.2
|
return 2.5 * (v ^ 6) + 0.2
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
['stone'] = {
|
['stone'] = {
|
||||||
tiles = {'sand-1', 'sand-2', 'sand-3'},
|
tiles = {'sand-1', 'sand-2', 'sand-3'},
|
||||||
start = value(40, 0),
|
start = value(50, 0),
|
||||||
shape = b.resource(b.full_shape, 'stone', value(0, 0.6)),
|
shape = b.resource(b.full_shape, 'stone', value(0, 0.75)),
|
||||||
weight = function(v)
|
weight = function(v)
|
||||||
return 1 * (v ^ 6) + 0.15
|
return 1 * (v ^ 6) + 0.15
|
||||||
end
|
end
|
||||||
|
@ -1,13 +1,30 @@
|
|||||||
local b = require 'map_gen.shared.builders'
|
local b = require 'map_gen.shared.builders'
|
||||||
local table = require 'utils.table'
|
local table = require 'utils.table'
|
||||||
|
|
||||||
|
local function no_op()
|
||||||
|
end
|
||||||
|
|
||||||
return function(config)
|
return function(config)
|
||||||
local main_ores = config.main_ores
|
local main_ores = config.main_ores
|
||||||
local shuffle_order = config.main_ores_shuffle_order
|
local shuffle_order = config.main_ores_shuffle_order
|
||||||
local main_ores_rotate = config.main_ores_rotate or 0
|
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 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)
|
return function(tile_builder, _, spawn_shape, water_shape, random_gen)
|
||||||
local pattern = {}
|
local pattern = {}
|
||||||
for ore_name, data in pairs(main_ores) do
|
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)
|
local start_ores = b.segment_pattern(start_ore_shapes)
|
||||||
start_ores = b.rotate(start_ores, math.rad(45))
|
start_ores = b.rotate(start_ores, math.rad(45))
|
||||||
local main_ores_shape = b.gradient_pattern(ore_pattern)
|
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 ores = b.choose(start_ore_shape, start_ores, main_ores_shape)
|
||||||
|
|
||||||
local map = b.apply_entity(land, ores)
|
local map = b.apply_entity(land, ores)
|
||||||
|
@ -4,7 +4,7 @@ local Event = require 'utils.event'
|
|||||||
local b = require 'map_gen.shared.builders'
|
local b = require 'map_gen.shared.builders'
|
||||||
|
|
||||||
local ScenarioInfo = require 'features.gui.info'
|
local ScenarioInfo = require 'features.gui.info'
|
||||||
ScenarioInfo.set_map_name('Terraforming Danger Ore')
|
ScenarioInfo.set_map_name('Gradient Danger Ore')
|
||||||
ScenarioInfo.set_map_description([[
|
ScenarioInfo.set_map_description([[
|
||||||
Clear the ore to expand the base,
|
Clear the ore to expand the base,
|
||||||
focus mining efforts on specific quadrants to ensure
|
focus mining efforts on specific quadrants to ensure
|
||||||
|
Loading…
x
Reference in New Issue
Block a user