diff --git a/modules/ores_are_mixed.lua b/modules/ores_are_mixed.lua index dd4c9a18e..8945516d1 100644 --- a/modules/ores_are_mixed.lua +++ b/modules/ores_are_mixed.lua @@ -1,5 +1,6 @@ local Event = require 'utils.event' local simplex_noise = require 'utils.math.simplex_noise'.d2 +local Public = {} local ore_raffle = { 'iron-ore', 'iron-ore', @@ -10,9 +11,16 @@ local ore_raffle = { 'stone' } +Public.settings = { + mixed_ores_on_nauvis_only = false +} + local function on_chunk_generated(event) local surface = event.surface - local ores = surface.find_entities_filtered({area = event.area, name = {'iron-ore', 'copper-ore', 'coal', 'stone'}}) + if Public.settings.mixed_ores_on_nauvis_only and surface.name ~= 'nauvis' then + return + end + local ores = surface.find_entities_filtered({ area = event.area, name = { 'iron-ore', 'copper-ore', 'coal', 'stone' } }) if #ores == 0 then return end @@ -24,9 +32,11 @@ local function on_chunk_generated(event) simplex_noise(pos.x * 0.005, pos.y * 0.005, seed) + simplex_noise(pos.x * 0.01, pos.y * 0.01, seed) * 0.3 + simplex_noise(pos.x * 0.05, pos.y * 0.05, seed) * 0.2 local i = (math.floor(noise * 100) % 7) + 1 - surface.create_entity({name = ore_raffle[i], position = ore.position, amount = ore.amount}) + surface.create_entity({ name = ore_raffle[i], position = ore.position, amount = ore.amount }) ore.destroy() end end Event.add(defines.events.on_chunk_generated, on_chunk_generated) + +return Public diff --git a/utils/start.lua b/utils/start.lua index fb4e8e6f6..39a34c221 100644 --- a/utils/start.lua +++ b/utils/start.lua @@ -6,7 +6,7 @@ local bp = '0eNqlm91O20AUhN9lrx2UM7b3J69SocrAUiwlTuQYKEV59yYEF1RXqWe4QiE7Xud82fXq08mru1k/5l3fdoNbvbr2dtvt3erbq9u3P7pmffrf8LLLbuXaIW9c4bpmc3q1bze7dV7kbmiHl8VzOzwsts9d7t2hcG13l3+6lR2uC/c2oM3na55Hf+8eNzfHkSv7/9UKt9vujxfYdqc7OV4UV3XhXo5/y6v6ONVd2+fb89u+cE9N3zbnV3YoJvNBmS99Y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= 0, y = 0 } + local position = { x = 0, y = 5 } if not surface or not surface.valid then return end diff --git a/utils/templates/VanillaMixedOresMarathonSA/map_loader.lua b/utils/templates/VanillaMixedOresMarathonSA/map_loader.lua new file mode 100644 index 000000000..9254ea374 --- /dev/null +++ b/utils/templates/VanillaMixedOresMarathonSA/map_loader.lua @@ -0,0 +1,534 @@ +require 'utils.start' +local Freeplay = require 'utils.freeplay' +local Autostash = require 'modules.autostash' +local Misc = require 'utils.commands.misc' +local Gui = require 'utils.gui' +local Event = require 'utils.event' +local MixedOres = require 'modules.ores_are_mixed' +MixedOres.settings.mixed_ores_on_nauvis_only = true + +Gui.mod_gui_button_enabled = true +Gui.button_style = 'mod_gui_button' +Gui.set_toggle_button(true) +Gui.set_mod_gui_top_frame(true) + +local map_gen = { + autoplace_controls = { + aquilo_crude_oil = { + frequency = 1, + richness = 1, + size = 1 + }, + calcite = { + frequency = 1, + richness = 1, + size = 1 + }, + coal = { + frequency = 1, + richness = 1, + size = 1 + }, + ["copper-ore"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["crude-oil"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["enemy-base"] = { + frequency = 1, + richness = 1, + size = 1 + }, + fluorine_vent = { + frequency = 1, + richness = 1, + size = 1 + }, + fulgora_cliff = { + frequency = 1, + richness = 1, + size = 1 + }, + fulgora_islands = { + frequency = 1, + richness = 1, + size = 1 + }, + gleba_cliff = { + frequency = 1, + richness = 1, + size = 1 + }, + gleba_enemy_base = { + frequency = 1, + richness = 1, + size = 1 + }, + gleba_plants = { + frequency = 1, + richness = 1, + size = 1 + }, + gleba_stone = { + frequency = 1, + richness = 1, + size = 1 + }, + gleba_water = { + frequency = 1, + richness = 1, + size = 1 + }, + ["iron-ore"] = { + frequency = 1, + richness = 1, + size = 1 + }, + lithium_brine = { + frequency = 1, + richness = 1, + size = 1 + }, + nauvis_cliff = { + frequency = 1, + richness = 1, + size = 1 + }, + rocks = { + frequency = 1, + richness = 1, + size = 1 + }, + scrap = { + frequency = 1, + richness = 1, + size = 1 + }, + starting_area_moisture = { + frequency = 1, + richness = 1, + size = 1 + }, + stone = { + frequency = 1, + richness = 1, + size = 1 + }, + sulfuric_acid_geyser = { + frequency = 1, + richness = 1, + size = 1 + }, + trees = { + frequency = 1, + richness = 1, + size = 1 + }, + tungsten_ore = { + frequency = 1, + richness = 1, + size = 1 + }, + ["uranium-ore"] = { + frequency = 1, + richness = 1, + size = 1 + }, + vulcanus_coal = { + frequency = 1, + richness = 1, + size = 1 + }, + vulcanus_volcanism = { + frequency = 1, + richness = 1, + size = 1 + }, + water = { + frequency = 1, + richness = 1, + size = 1 + } + }, + autoplace_settings = { + decorative = { + settings = { + ["brown-asterisk"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["brown-asterisk-mini"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["brown-carpet-grass"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["brown-fluff"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["brown-fluff-dry"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["brown-hairy-grass"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["cracked-mud-decal"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["dark-mud-decal"] = { + frequency = 1, + richness = 1, + size = 1 + }, + garballo = { + frequency = 1, + richness = 1, + size = 1 + }, + ["garballo-mini-dry"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-asterisk"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-asterisk-mini"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-bush-mini"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-carpet-grass"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-croton"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-desert-bush"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-hairy-grass"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-pita"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-pita-mini"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["green-small-grass"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["light-mud-decal"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["medium-rock"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["medium-sand-rock"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["red-asterisk"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["red-croton"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["red-desert-bush"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["red-desert-decal"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["red-pita"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["sand-decal"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["sand-dune-decal"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["small-rock"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["small-sand-rock"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["tiny-rock"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["white-desert-bush"] = { + frequency = 1, + richness = 1, + size = 1 + } + }, + treat_missing_as_default = true + }, + entity = { + settings = { + ["big-rock"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["big-sand-rock"] = { + frequency = 1, + richness = 1, + size = 1 + }, + coal = { + frequency = 1, + richness = 1, + size = 1 + }, + ["copper-ore"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["crude-oil"] = { + frequency = 1, + richness = 1, + size = 1 + }, + fish = { + frequency = 1, + richness = 1, + size = 1 + }, + ["huge-rock"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["iron-ore"] = { + frequency = 1, + richness = 1, + size = 1 + }, + stone = { + frequency = 1, + richness = 1, + size = 1 + }, + ["uranium-ore"] = { + frequency = 1, + richness = 1, + size = 1 + } + }, + treat_missing_as_default = true + }, + tile = { + settings = { + deepwater = { + frequency = 1, + richness = 1, + size = 1 + }, + ["dirt-1"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["dirt-2"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["dirt-3"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["dirt-4"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["dirt-5"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["dirt-6"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["dirt-7"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["dry-dirt"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["grass-1"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["grass-2"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["grass-3"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["grass-4"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["red-desert-0"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["red-desert-1"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["red-desert-2"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["red-desert-3"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["sand-1"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["sand-2"] = { + frequency = 1, + richness = 1, + size = 1 + }, + ["sand-3"] = { + frequency = 1, + richness = 1, + size = 1 + }, + water = { + frequency = 1, + richness = 1, + size = 1 + } + }, + treat_missing_as_default = true + } + }, + cliff_settings = { + cliff_elevation_0 = 10, + cliff_elevation_interval = 40, + cliff_smoothing = 0, + control = "nauvis_cliff", + name = "", + richness = 1 + }, + default_enable_all_autoplace_controls = true, + no_enemies_mode = false, + peaceful_mode = false, + property_expression_names = {}, + starting_area = 2, + starting_points = { + { + x = 0, + y = 5 + } + }, +} + +Event.on_init(function () + Freeplay.set_enabled(false) + Autostash.set_enabled(false) + Misc.set_enabled(false) + map_gen.seed = game.surfaces.nauvis.map_gen_settings.seed + game.surfaces.nauvis.map_gen_settings = map_gen +end) + +Event.add(defines.events.on_research_finished, + function (event) + if event.research.name == 'uranium-processing' then + game.forces.player.technologies['recycling'].researched = true + end + end)