Skip to content

Commit

Permalink
Add startup techs to DO (#1452)
Browse files Browse the repository at this point in the history
  • Loading branch information
RedRafe authored Nov 23, 2024
1 parent f04b99e commit a2a61db
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions map_gen/maps/danger_ores/configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 20 additions & 0 deletions map_gen/maps/danger_ores/modules/technologies.lua
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions map_gen/maps/danger_ores/scenario.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a2a61db

Please sign in to comment.