diff --git a/map_gen/maps/danger_ores/configuration.lua b/map_gen/maps/danger_ores/configuration.lua index bdc378c6..82c94b07 100644 --- a/map_gen/maps/danger_ores/configuration.lua +++ b/map_gen/maps/danger_ores/configuration.lua @@ -64,6 +64,13 @@ return { max_pollution = 15000, pollution_increment = 4, }, + technologies = { + enabled = true, + unlocks = { + ['uranium-mining'] = { 'uranium-processing' }, + ['oil-gathering'] = { 'oil-processing', 'coal-liquefaction' }, + }, + }, game = { draw_resource_selection = false, technology_price_multiplier = 25, diff --git a/map_gen/maps/danger_ores/modules/technologies.lua b/map_gen/maps/danger_ores/modules/technologies.lua new file mode 100644 index 00000000..1b5306bb --- /dev/null +++ b/map_gen/maps/danger_ores/modules/technologies.lua @@ -0,0 +1,20 @@ +local Event = require 'utils.event' + +return function(config) + local unlocks = config.unlocks or {} + if table_size(unlocks) == 0 then + return + end + + Event.add(defines.events.on_research_finished, function(event) + local research = event.research + local techs = research.force.technologies + + for _, name in pairs(unlocks[research.name] or {}) do + local tech = techs[name] + if tech then + tech.researched = true + end + end + end) +end diff --git a/map_gen/maps/danger_ores/scenario.lua b/map_gen/maps/danger_ores/scenario.lua index de8e6ab6..37ea447e 100644 --- a/map_gen/maps/danger_ores/scenario.lua +++ b/map_gen/maps/danger_ores/scenario.lua @@ -47,6 +47,7 @@ local map_builder = require 'map_gen.maps.danger_ores.modules.map' local mining_productivity = require 'map_gen.maps.danger_ores.modules.mining_productivity' local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_simple' +local technologies = require 'map_gen.maps.danger_ores.modules.technologies' local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' local Public = {} @@ -101,6 +102,9 @@ Public.register = function(danger_ores_config) if _C.terraforming.enabled then terraforming(_C.terraforming) end + if _C.technologies.enabled then + technologies(_C.technologies) + end Event.on_init(function() game.draw_resource_selection = _C.game.draw_resource_selection or false