From aaeb7ca9ba38cc40ef070a75cb6a94c606738be7 Mon Sep 17 00:00:00 2001 From: RedRafe Date: Sun, 31 May 2026 23:41:16 +0200 Subject: [PATCH 1/2] Fix terrain gen --- map_gen/maps/frontier/modules/restart.lua | 9 +-- map_gen/maps/frontier/modules/terrain.lua | 73 +++++++++++++++-------- map_gen/maps/frontier/scenario.lua | 1 + 3 files changed, 52 insertions(+), 31 deletions(-) diff --git a/map_gen/maps/frontier/modules/restart.lua b/map_gen/maps/frontier/modules/restart.lua index cf79ea1c8..e8a03e875 100644 --- a/map_gen/maps/frontier/modules/restart.lua +++ b/map_gen/maps/frontier/modules/restart.lua @@ -551,15 +551,11 @@ function Restart.print_endgame_statistics() end local total_ore = 0 - local ore_totals_message = '(' + local surface_stats = game.forces.player.get_item_production_statistics(Public.surface()) for ore_name in pairs(ore_products) do - local count = game.forces.player.get_item_production_statistics(Public.surface().name).get_input_count(ore_name) - total_ore = total_ore + count - ore_totals_message = ore_totals_message..ore_name:gsub( '-ore', '')..': '..format_number(count, true)..', ' + total_ore = total_ore + (surface_stats.get_input_count(ore_name) or 0) end - ore_totals_message = ore_totals_message:sub(1, -3)..')' -- remove the last ', ' and add a bracket statistics.ore_totals_value = format_number(total_ore, true) - statistics.ore_totals_breakdown = ore_totals_message end local statistics_message = { @@ -569,7 +565,6 @@ function Restart.print_endgame_statistics() 'Map time: '..statistics.time_string, 'Total entities built: '..statistics.entities_built, 'Total ore mined: '..statistics.ore_totals_value, - statistics.ore_totals_breakdown, 'Total ore resources exhausted: '..statistics.resources_exhausted, 'Players: '..statistics.total_players, 'Rockets launched: '..statistics.rockets_launched, diff --git a/map_gen/maps/frontier/modules/terrain.lua b/map_gen/maps/frontier/modules/terrain.lua index c42eab2b1..29d55f402 100644 --- a/map_gen/maps/frontier/modules/terrain.lua +++ b/map_gen/maps/frontier/modules/terrain.lua @@ -3,7 +3,6 @@ local math = require 'utils.math' local MGSP = require 'resources.map_gen_settings' local Noise = require 'map_gen.shared.simplex_noise' local Queue = require 'utils.queue' -local RS = require 'map_gen.shared.redmew_surface' local Public = require 'map_gen.maps.frontier.shared.core' local math_abs = math.abs local math_ceil = math.ceil @@ -18,14 +17,14 @@ local q_pop = Queue.pop local simplex = Noise.d2 local autoplace_controls = { - ['coal'] = { frequency = 1.3, richness = 0.7, size = 0.80 }, - ['copper-ore'] = { frequency = 1.4, richness = 0.7, size = 0.85 }, - ['crude-oil'] = { frequency = 1, richness = 0.9, size = 0.95 }, - ['enemy-base'] = { frequency = 6, richness = 0.6, size = 4 }, - ['iron-ore'] = { frequency = 1.6, richness = 0.8, size = 1.15 }, - ['stone'] = { frequency = 1, richness = 0.6, size = 0.65 }, - ['trees'] = { frequency = 1, richness = 0.6, size = 1.2 }, - ['uranium-ore'] = { frequency = 0.5, richness = 0.6, size = 0.6 }, + ['coal'] = { frequency = 1.3, richness = 0.7, size = 0.80 }, + ['copper-ore'] = { frequency = 1.4, richness = 0.7, size = 0.85 }, + ['crude-oil'] = { frequency = 1.7, richness = 2.4, size = 1.25 }, + ['enemy-base'] = { frequency = 6, richness = 0.6, size = 4 }, + ['iron-ore'] = { frequency = 1.6, richness = 0.8, size = 1.15 }, + ['stone'] = { frequency = 1, richness = 0.6, size = 0.65 }, + ['trees'] = { frequency = 1, richness = 0.6, size = 1.2 }, + ['uranium-ore'] = { frequency = 0.5, richness = 0.6, size = 0.6 }, } local blacklisted_resources = { ['uranium-ore'] = true, @@ -69,23 +68,49 @@ if script.active_mods['zombiesextended-core'] then blacklisted_resources['vibranium-ore'] = true end -RS.set_map_gen_settings({ - { - autoplace_controls = autoplace_controls, - cliff_settings = { name = 'cliff', cliff_elevation_0 = 20, cliff_elevation_interval = 40, richness = 0.8 }, - height = Public.get().height * 32, - property_expression_names = { - ['control-setting:aux:frequency:multiplier'] = '1.333333', - ['control-setting:moisture:bias'] = '-0.250000', - ['control-setting:moisture:frequency:multiplier'] = '3.000000', - }, - starting_area = 3, - }, - MGSP.water_none, -}) - local Terrain = {} +function Terrain.set_map_gen_settings() + local surface = Public.surface() + local mgs = table.deepcopy(surface.map_gen_settings) + + mgs.starting_area = 3 + mgs.height = Public.get().height * 32 + mgs.cliff_settings = { + name = 'cliff', + control = 'nauvis_cliff', + cliff_elevation_0 = 20, + cliff_elevation_interval = 40, + richness = 0.8, + cliff_smoothing = 0, + } + -- Biome + for k, v in pairs({ + ['control:aux:frequency'] = '1.333333', + ['control:moisture:bias'] = '-0.250000', + ['control:moisture:frequency'] = '3.000000', + }) do + mgs.property_expression_names[k] = v + end + + -- Water none + mgs.autoplace_settings = mgs.autoplace_settings or {} + mgs.autoplace_settings.tile = mgs.autoplace_settings.tile or {} + mgs.autoplace_settings.tile.settings = mgs.autoplace_settings.tile.settings or {} + for k, v in pairs(MGSP.water_none.autoplace_settings.tile.settings) do + mgs.autoplace_settings.tile.settings[k] = v + end + + -- Ores + mgs.autoplace_controls = mgs.autoplace_controls or {} + for k, v in pairs(autoplace_controls) do + mgs.autoplace_controls[k] = v + end + + surface.map_gen_settings = mgs + log(serpent.block{mgs = mgs}) +end + function Terrain.get_map() local map local this = Public.get() diff --git a/map_gen/maps/frontier/scenario.lua b/map_gen/maps/frontier/scenario.lua index 1fd2b6072..01318963e 100644 --- a/map_gen/maps/frontier/scenario.lua +++ b/map_gen/maps/frontier/scenario.lua @@ -125,6 +125,7 @@ local function on_game_started() Public.reset() Restart.announce_new_map() Restart.apply_modifiers() + Terrain.set_map_gen_settings() Terrain.reveal_spawn_area() Terrain.queue_reveal_map() RocketSilo.init_silo() From 7d4ed6523970df5a03ede2edaa19834fa5bcc3d5 Mon Sep 17 00:00:00 2001 From: RedRafe Date: Sun, 31 May 2026 23:42:07 +0200 Subject: [PATCH 2/2] Cleanup logs --- map_gen/maps/frontier/modules/terrain.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/map_gen/maps/frontier/modules/terrain.lua b/map_gen/maps/frontier/modules/terrain.lua index 29d55f402..1d26a6579 100644 --- a/map_gen/maps/frontier/modules/terrain.lua +++ b/map_gen/maps/frontier/modules/terrain.lua @@ -108,7 +108,6 @@ function Terrain.set_map_gen_settings() end surface.map_gen_settings = mgs - log(serpent.block{mgs = mgs}) end function Terrain.get_map()