mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-18 03:21:47 +02:00
danger_ore_hub_spiral
This commit is contained in:
parent
68c359be61
commit
1487c55791
37
map_gen/maps/danger_ores/modules/main_ores.lua
Normal file
37
map_gen/maps/danger_ores/modules/main_ores.lua
Normal file
@ -0,0 +1,37 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
|
||||
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
|
||||
|
||||
return function(tile_builder, ore_builder, spawn_shape, water_shape, random_gen)
|
||||
local shapes = {}
|
||||
|
||||
for ore_name, ore_data in pairs(main_ores) do
|
||||
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)
|
||||
|
||||
if main_ores_rotate ~= 0 then
|
||||
ores = b.rotate(ores, math.rad(main_ores_rotate))
|
||||
end
|
||||
|
||||
return b.any {spawn_shape, water_shape, ores}
|
||||
end
|
||||
end
|
37
map_gen/maps/danger_ores/modules/main_ores_hub_spiral.lua
Normal file
37
map_gen/maps/danger_ores/modules/main_ores_hub_spiral.lua
Normal file
@ -0,0 +1,37 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
|
||||
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
|
||||
|
||||
return function(tile_builder, ore_builder, spawn_shape, water_shape, random_gen)
|
||||
local shapes = {}
|
||||
|
||||
for ore_name, ore_data in pairs(main_ores) do
|
||||
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
|
||||
end
|
||||
|
||||
if shuffle_order then
|
||||
table.shuffle_table(shapes, random_gen)
|
||||
end
|
||||
|
||||
local ores = b.circular_spiral_grow_pattern(24, 32, 384, shapes)
|
||||
|
||||
if main_ores_rotate ~= 0 then
|
||||
ores = b.rotate(ores, math.rad(main_ores_rotate))
|
||||
end
|
||||
|
||||
return b.any {spawn_shape, ores, water_shape}
|
||||
end
|
||||
end
|
@ -6,6 +6,8 @@ local math = require 'utils.math'
|
||||
local seed_provider = require 'map_gen.maps.danger_ores.modules.seed_provider'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
|
||||
local deafult_main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores'
|
||||
|
||||
local binary_search = table.binary_search
|
||||
local perlin_noise = Perlin.noise
|
||||
local floor = math.floor
|
||||
@ -96,42 +98,15 @@ return function(config)
|
||||
local trees_shape = (config.trees or no_op)(config)
|
||||
local enemy_shape = (config.enemy or no_op)(config)
|
||||
local fish_spawn_rate = config.fish_spawn_rate
|
||||
local main_ores = config.main_ores
|
||||
local main_ores_rotate = config.main_ores_rotate or 0
|
||||
local main_ores_builder = (config.main_ores_builder or deafult_main_ores_builder)(config)
|
||||
|
||||
start_ore_shape = config.start_ore_shape or b.circle(68)
|
||||
resource_patches = (config.resource_patches or no_op)(config) or b.empty_shape
|
||||
dense_patches = (config.dense_patches or no_op)(config) or no_op
|
||||
|
||||
local shapes = {}
|
||||
|
||||
for ore_name, ore_data in pairs(main_ores) do
|
||||
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 config.main_ores_shuffle_order then
|
||||
local random_gen = tbl.random
|
||||
random_gen.re_seed(tbl.seed)
|
||||
table.shuffle_table(shapes, random_gen)
|
||||
end
|
||||
|
||||
local ores = b.segment_weighted_pattern(shapes)
|
||||
|
||||
if main_ores_rotate ~= 0 then
|
||||
ores = b.rotate(ores, math.rad(main_ores_rotate))
|
||||
end
|
||||
|
||||
map = b.any {spawn_shape, water_shape, ores}
|
||||
local random_gen = tbl.random
|
||||
random_gen.re_seed(tbl.seed)
|
||||
map = main_ores_builder(tile_builder, ore_builder, spawn_shape, water_shape, random_gen)
|
||||
|
||||
if enemy_shape then
|
||||
map = b.apply_entity(map, enemy_shape)
|
||||
|
@ -227,7 +227,14 @@ return function(config)
|
||||
end
|
||||
end
|
||||
|
||||
local bad_tiles = {'deepwater-green', 'deepwater', 'out-of-map', 'water-green', 'water'}
|
||||
|
||||
local function chunk_unlocked(chunk)
|
||||
local count = chunk.surface.count_tiles_filtered({area = chunk.area, name = bad_tiles, limit = 1})
|
||||
if count > 0 then
|
||||
return
|
||||
end
|
||||
|
||||
Queue.push(recent_chunks, chunk)
|
||||
|
||||
while Queue.size(recent_chunks) > recent_chunks_max do
|
||||
|
@ -8,15 +8,27 @@ return function(config)
|
||||
local scale = config.water_scale or 1 / 96
|
||||
local water_threshold = config.water_threshold or 0.5
|
||||
local deepwater_threshold = config.deepwater_threshold or 0.55
|
||||
|
||||
local scale_function
|
||||
if type(scale) == 'function' then
|
||||
scale_function = scale
|
||||
else
|
||||
scale_function = function()
|
||||
return scale
|
||||
end
|
||||
end
|
||||
|
||||
local no_water_shape = config.no_water_shape or b.circle(96)
|
||||
local seed = config.water_seed or seed_provider()
|
||||
|
||||
return function(x, y)
|
||||
if no_water_shape(x, y) then
|
||||
return function(x, y, world)
|
||||
if no_water_shape(x, y, world) then
|
||||
return false
|
||||
end
|
||||
|
||||
local water_noise = perlin_noise(x * scale, y * scale, seed)
|
||||
local s = scale_function(x, y, world)
|
||||
|
||||
local water_noise = perlin_noise(x * s, y * s, seed)
|
||||
if water_noise >= deepwater_threshold then
|
||||
return 'deepwater'
|
||||
elseif water_noise >= water_threshold then
|
||||
|
@ -113,7 +113,7 @@ terraforming(
|
||||
{
|
||||
start_size = 8 * 32,
|
||||
min_pollution = 400,
|
||||
max_pollution = 4000,
|
||||
max_pollution = 6000,
|
||||
pollution_increment = 2.5
|
||||
}
|
||||
)
|
||||
@ -124,7 +124,7 @@ rocket_launched(
|
||||
recent_chunks_max = 10,
|
||||
ticks_between_waves = 60 * 30,
|
||||
enemy_factor = 3,
|
||||
max_enemies_per_wave_per_chunk = 80,
|
||||
max_enemies_per_wave_per_chunk = 60,
|
||||
extra_rockets = 150
|
||||
}
|
||||
)
|
||||
|
167
map_gen/maps/danger_ores/presets/danger_ore_hub_spiral.lua
Normal file
167
map_gen/maps/danger_ores/presets/danger_ore_hub_spiral.lua
Normal file
@ -0,0 +1,167 @@
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
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_description(
|
||||
[[
|
||||
Clear the ore to expand the base,
|
||||
focus mining efforts on specific quadrants to ensure
|
||||
proper material ratios, expand the map with pollution!
|
||||
]]
|
||||
)
|
||||
ScenarioInfo.add_map_extra_info(
|
||||
[[
|
||||
This map is split in four quadrants. Each quadrant has a main resource.
|
||||
[item=iron-ore] north, [item=copper-ore] south, [item=coal] east, [item=stone] west
|
||||
|
||||
You may not build the factory on ore patches. Exceptions:
|
||||
[item=burner-mining-drill] [item=electric-mining-drill] [item=pumpjack] [item=small-electric-pole] [item=medium-electric-pole] [item=big-electric-pole] [item=substation] [item=car] [item=tank] [item=spidertron]
|
||||
[item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] [item=rail]
|
||||
|
||||
The map size is restricted to the pollution generated. A significant amount of
|
||||
pollution must affect a section of the map before it is revealed. Pollution
|
||||
does not affect biter evolution.]]
|
||||
)
|
||||
|
||||
ScenarioInfo.set_map_description(
|
||||
[[
|
||||
Clear the ore to expand the base,
|
||||
focus mining efforts on specific quadrants to ensure
|
||||
proper material ratios, expand the map with pollution!
|
||||
]]
|
||||
)
|
||||
ScenarioInfo.set_new_info(
|
||||
[[
|
||||
2019-04-24:
|
||||
- Stone ore density reduced by 1/2
|
||||
- Ore quadrants randomized
|
||||
- Increased time factor of biter evolution from 5 to 7
|
||||
- Added win conditions (+5% evolution every 5 rockets until 100%, +100 rockets until biters are wiped)
|
||||
|
||||
2019-03-30:
|
||||
- Uranium ore patch threshold increased slightly
|
||||
- Bug fix: Cars and tanks can now be placed onto ore!
|
||||
- Starting minimum pollution to expand map set to 650
|
||||
View current pollution via Debug Settings [F4] show-pollution-values,
|
||||
then open map and turn on pollution via the red box.
|
||||
- Starting water at spawn increased from radius 8 to radius 16 circle.
|
||||
|
||||
2019-03-27:
|
||||
- Ore arranged into quadrants to allow for more controlled resource gathering.
|
||||
|
||||
2020-09-02
|
||||
- Destroyed chests dump their content as coal ore.
|
||||
]]
|
||||
)
|
||||
|
||||
local map = require 'map_gen.maps.danger_ores.modules.map'
|
||||
local main_ores_config = require 'map_gen.maps.danger_ores.config.vanilla_ores'
|
||||
local resource_patches = require 'map_gen.maps.danger_ores.modules.resource_patches'
|
||||
local resource_patches_config = require 'map_gen.maps.danger_ores.config.vanilla_resource_patches'
|
||||
local water = require 'map_gen.maps.danger_ores.modules.water'
|
||||
local trees = require 'map_gen.maps.danger_ores.modules.trees'
|
||||
local enemy = require 'map_gen.maps.danger_ores.modules.enemy'
|
||||
local dense_patches = require 'map_gen.maps.danger_ores.modules.dense_patches'
|
||||
|
||||
local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities'
|
||||
local allowed_entities = require 'map_gen.maps.danger_ores.config.vanilla_allowed_entities'
|
||||
banned_entities(allowed_entities)
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.grass_only,
|
||||
MGSP.enable_water,
|
||||
{
|
||||
terrain_segmentation = 'normal',
|
||||
water = 'normal'
|
||||
},
|
||||
MGSP.starting_area_very_low,
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.enemy_none,
|
||||
MGSP.cliff_none,
|
||||
MGSP.tree_none
|
||||
}
|
||||
)
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
game.draw_resource_selection = false
|
||||
game.forces.player.technologies['mining-productivity-1'].enabled = false
|
||||
game.forces.player.technologies['mining-productivity-2'].enabled = false
|
||||
game.forces.player.technologies['mining-productivity-3'].enabled = false
|
||||
game.forces.player.technologies['mining-productivity-4'].enabled = false
|
||||
|
||||
game.difficulty_settings.technology_price_multiplier = 20
|
||||
game.forces.player.technologies.logistics.researched = true
|
||||
game.forces.player.technologies.automation.researched = true
|
||||
|
||||
game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004
|
||||
game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002
|
||||
game.map_settings.enemy_evolution.pollution_factor = 0.000000 -- Pollution has no affect on evolution default 0.0000009
|
||||
|
||||
RS.get_surface().always_day = true
|
||||
end
|
||||
)
|
||||
|
||||
local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming'
|
||||
terraforming(
|
||||
{
|
||||
start_size = 8 * 32,
|
||||
min_pollution = 400,
|
||||
max_pollution = 5000,
|
||||
pollution_increment = 2.5
|
||||
}
|
||||
)
|
||||
local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched'
|
||||
rocket_launched(
|
||||
{
|
||||
recent_chunks_max = 10,
|
||||
ticks_between_waves = 60 * 30,
|
||||
enemy_factor = 3,
|
||||
max_enemies_per_wave_per_chunk = 60,
|
||||
extra_rockets = 100
|
||||
}
|
||||
)
|
||||
|
||||
local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump'
|
||||
container_dump({entity_name = 'coal'})
|
||||
|
||||
local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_hub_spiral'
|
||||
|
||||
local sqrt = math.sqrt
|
||||
|
||||
local config = {
|
||||
spawn_shape = b.circle(64),
|
||||
start_ore_shape = b.circle(68),
|
||||
main_ores_builder = main_ores_builder,
|
||||
main_ores = main_ores_config,
|
||||
--main_ores_shuffle_order = true,
|
||||
--main_ores_rotate = 45,
|
||||
resource_patches = resource_patches,
|
||||
resource_patches_config = resource_patches_config,
|
||||
water = water,
|
||||
water_scale = function(x, y)
|
||||
local d = sqrt(x * x + y * y)
|
||||
return 1 / (24 + (0.1 * d))
|
||||
end,
|
||||
water_threshold = 0.35,
|
||||
deepwater_threshold = 0.4,
|
||||
trees = trees,
|
||||
trees_scale = 1 / 64,
|
||||
trees_threshold = 0.35,
|
||||
trees_chance = 0.875,
|
||||
enemy = enemy,
|
||||
enemy_factor = 10 / (768 * 32),
|
||||
enemy_max_chance = 1 / 6,
|
||||
enemy_scale_factor = 32,
|
||||
fish_spawn_rate = 0.025,
|
||||
dense_patches = dense_patches,
|
||||
dense_patches_scale = 1 / 48,
|
||||
dense_patches_threshold = 0.55,
|
||||
dense_patches_multiplier = 50
|
||||
}
|
||||
|
||||
return map(config)
|
@ -110,8 +110,8 @@ local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming'
|
||||
terraforming(
|
||||
{
|
||||
start_size = 8 * 32,
|
||||
min_pollution = 400,
|
||||
max_pollution = 4000,
|
||||
min_pollution = 300,
|
||||
max_pollution = 5000,
|
||||
pollution_increment = 2.5
|
||||
}
|
||||
)
|
||||
@ -122,7 +122,7 @@ rocket_launched(
|
||||
recent_chunks_max = 10,
|
||||
ticks_between_waves = 60 * 30,
|
||||
enemy_factor = 3,
|
||||
max_enemies_per_wave_per_chunk = 80,
|
||||
max_enemies_per_wave_per_chunk = 60,
|
||||
extra_rockets = 100
|
||||
}
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user