diff --git a/map_gen/maps/danger_ores/modules/concrete_on_landfill.lua b/map_gen/maps/danger_ores/modules/concrete_on_landfill.lua new file mode 100644 index 00000000..825337ad --- /dev/null +++ b/map_gen/maps/danger_ores/modules/concrete_on_landfill.lua @@ -0,0 +1,100 @@ +local Event = require 'utils.event' + +return function(config) + local replace_tile = config.tile or 'blue-refined-concrete' + + local replace_tiles = {['landfill'] = true, [replace_tile] = true} + local brush_tools = {['refined-concrete'] = true} -- , ['refined-hazard-concrete'] = true} + + local character_main = defines.inventory.character_main + local robot_cargo = defines.inventory.robot_cargo + + local function refund_tiles(surface, inventory, tiles) + local refund_count = 0 + for i = 1, #tiles do + local tile = tiles[i] + local old_name = tile.old_tile.name + + if replace_tiles[old_name] then + surface.set_hidden_tile(tile.position, 'landfill') + end + + if old_name == replace_tile then + refund_count = refund_count + 1 + end + end + + if inventory and inventory.valid and refund_count > 0 then + inventory.insert {name = 'refined-concrete', count = refund_count} + end + end + + local function change_tiles(surface, inventory, tiles) + local new_tiles = {} + local refund_count = 0 + for i = 1, #tiles do + local tile = tiles[i] + local position = tile.position + local old_name = tile.old_tile.name + + if replace_tiles[old_name] or replace_tiles[surface.get_hidden_tile(position)] then + new_tiles[#new_tiles + 1] = {name = replace_tile, position = position} + surface.set_hidden_tile(position, 'landfill') + end + + if old_name == replace_tile then + refund_count = refund_count + 1 + end + end + + surface.set_tiles(new_tiles) + if inventory and inventory.valid and refund_count > 0 then + inventory.insert {name = 'refined-concrete', count = refund_count} + end + end + + local function on_tile_built(event, inventory) + local item = event.item + if not item then + return + end + + local surface = game.get_surface(event.surface_index) + if not surface or not surface.valid then + return + end + + local item_name = item.name + local tiles = event.tiles + + if not brush_tools[item_name] then + refund_tiles(surface, inventory, tiles) + return + end + + change_tiles(surface, inventory, tiles) + end + + local function player_built_tile(event) + local player = game.get_player(event.player_index) + if not player or not player.valid then + return + end + + local inventory = player.get_inventory(character_main) + on_tile_built(event, inventory) + end + + local function robot_built_tile(event) + local robot = event.robot + if not robot or not robot.valid then + return + end + + local inventory = robot.get_inventory(robot_cargo) + on_tile_built(event, inventory) + end + + Event.add(defines.events.on_player_built_tile, player_built_tile) + Event.add(defines.events.on_robot_built_tile, robot_built_tile) +end diff --git a/map_gen/maps/danger_ores/presets/danger_bobangels_ores.lua b/map_gen/maps/danger_ores/presets/danger_bobangels_ores.lua index 7bc33d8d..724049f4 100644 --- a/map_gen/maps/danger_ores/presets/danger_bobangels_ores.lua +++ b/map_gen/maps/danger_ores/presets/danger_bobangels_ores.lua @@ -108,6 +108,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30, -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init( function() @@ -154,6 +155,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local config = { spawn_shape = b.circle(80), start_ore_shape = b.circle(86), diff --git a/map_gen/maps/danger_ores/presets/danger_bobs_ores.lua b/map_gen/maps/danger_ores/presets/danger_bobs_ores.lua index 46c8a25b..ed96e687 100644 --- a/map_gen/maps/danger_ores/presets/danger_bobs_ores.lua +++ b/map_gen/maps/danger_ores/presets/danger_bobs_ores.lua @@ -118,6 +118,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30, -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init( function() @@ -164,6 +165,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local config = { spawn_shape = b.circle(80), start_ore_shape = b.circle(86), diff --git a/map_gen/maps/danger_ores/presets/danger_ore.lua b/map_gen/maps/danger_ores/presets/danger_ore.lua index 149a2e41..5d9333d3 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore.lua @@ -71,6 +71,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30, -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init( function() @@ -96,6 +97,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local config = { spawn_shape = b.circle(64), start_ore_shape = b.circle(68), diff --git a/map_gen/maps/danger_ores/presets/danger_ore_chessboard.lua b/map_gen/maps/danger_ores/presets/danger_ore_chessboard.lua index 931a700f..278c8a0d 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore_chessboard.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore_chessboard.lua @@ -82,6 +82,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init(function() game.draw_resource_selection = false @@ -113,6 +114,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_chessboard' local config = { diff --git a/map_gen/maps/danger_ores/presets/danger_ore_chessboard_uniform.lua b/map_gen/maps/danger_ores/presets/danger_ore_chessboard_uniform.lua new file mode 100644 index 00000000..48022a80 --- /dev/null +++ b/map_gen/maps/danger_ores/presets/danger_ore_chessboard_uniform.lua @@ -0,0 +1,149 @@ +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 Config = require 'config' + +local ScenarioInfo = require 'features.gui.info' +ScenarioInfo.set_map_name('Danger Ore Chessboard Uniform') +ScenarioInfo.set_map_description([[ +Clear the ore to expand the base, +focus mining efforts on specific sectors to ensure +proper material ratios, expand the map with pollution! +]]) +ScenarioInfo.add_map_extra_info([[ +This map is split in three sectors [item=iron-ore] [item=copper-ore] [item=coal]. +Each sector has a main resource and the other resources at a lower ratio. + +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=locomotive] [item=cargo-wagon] [item=fluid-wagon] [item=artillery-wagon] + [item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] [item=rail] [item=rail-signal] [item=rail-chain-signal] [item=train-stop] + +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_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. + +2020-12-28: + - Changed win condition. First satellite kills all biters, launch 500 to win the map. + +2021-04-06: + - Rail signals and train stations now allowed on 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 +}) + +Config.market.enabled = false +Config.player_rewards.enabled = false +Config.player_create.starting_items = {} +Config.dump_offline_inventories = { + enabled = true, + offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team +} +Config.paint.enabled = false + +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 = 25 + 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 = 16000, pollution_increment = 4}) + +local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_simple' +rocket_launched({win_satellite_count = 500}) + +local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' +restart_command({scenario_name = 'danger-ore-next'}) + +local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' +container_dump({entity_name = 'coal'}) + +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + +local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_chessboard' + +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 = false, + resource_patches = resource_patches, + resource_patches_config = resource_patches_config, + water = water, + water_scale = 1 / 96, + water_threshold = 0.4, + deepwater_threshold = 0.45, + trees = trees, + trees_scale = 1 / 64, + trees_threshold = 0.4, + 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 = 25 +} + +return map(config) diff --git a/map_gen/maps/danger_ores/presets/danger_ore_deadlock_beltboxes.lua b/map_gen/maps/danger_ores/presets/danger_ore_deadlock_beltboxes.lua index 03fb2976..06abe7d6 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore_deadlock_beltboxes.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore_deadlock_beltboxes.lua @@ -89,6 +89,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30, -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init( function() @@ -139,6 +140,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local config = { spawn_shape = b.circle(64), start_ore_shape = b.circle(68), diff --git a/map_gen/maps/danger_ores/presets/danger_ore_gradient.lua b/map_gen/maps/danger_ores/presets/danger_ore_gradient.lua index 7e8fc13f..0cd37444 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore_gradient.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore_gradient.lua @@ -82,6 +82,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30, -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init(function() game.draw_resource_selection = false @@ -113,6 +114,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_gradient' local config = { diff --git a/map_gen/maps/danger_ores/presets/danger_ore_hub_spiral.lua b/map_gen/maps/danger_ores/presets/danger_ore_hub_spiral.lua index cf4581dd..bc0b106b 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore_hub_spiral.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore_hub_spiral.lua @@ -87,6 +87,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30, -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init( function() @@ -120,6 +121,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_hub_spiral' local sqrt = math.sqrt diff --git a/map_gen/maps/danger_ores/presets/danger_ore_landfill.lua b/map_gen/maps/danger_ores/presets/danger_ore_landfill.lua index e6bfd798..50376b41 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore_landfill.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore_landfill.lua @@ -81,6 +81,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30, -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init(function() game.draw_resource_selection = false @@ -112,6 +113,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local config = { spawn_shape = b.circle(64), start_ore_shape = b.circle(68), diff --git a/map_gen/maps/danger_ores/presets/danger_ore_normal_science.lua b/map_gen/maps/danger_ores/presets/danger_ore_normal_science.lua index 6169c100..c5920e7c 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore_normal_science.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore_normal_science.lua @@ -82,6 +82,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30, -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false local hail_hydra = Config.hail_hydra hail_hydra.enabled = true @@ -144,6 +145,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local config = { spawn_shape = b.circle(64), start_ore_shape = b.circle(68), diff --git a/map_gen/maps/danger_ores/presets/danger_ore_spiral.lua b/map_gen/maps/danger_ores/presets/danger_ore_spiral.lua index b67ae0ea..ad71a049 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore_spiral.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore_spiral.lua @@ -86,6 +86,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30, -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init( function() @@ -119,6 +120,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_spiral' local config = { diff --git a/map_gen/maps/danger_ores/presets/danger_ore_split.lua b/map_gen/maps/danger_ores/presets/danger_ore_split.lua index 0c8389af..b2ffb5ce 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore_split.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore_split.lua @@ -82,6 +82,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init(function() game.draw_resource_selection = false @@ -113,6 +114,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local config = { spawn_shape = b.circle(64), start_ore_shape = b.circle(68), diff --git a/map_gen/maps/danger_ores/presets/terraforming_danger_ore.lua b/map_gen/maps/danger_ores/presets/terraforming_danger_ore.lua index 394043d7..f378d66b 100644 --- a/map_gen/maps/danger_ores/presets/terraforming_danger_ore.lua +++ b/map_gen/maps/danger_ores/presets/terraforming_danger_ore.lua @@ -82,6 +82,7 @@ Config.dump_offline_inventories = { enabled = true, offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team } +Config.paint.enabled = false Event.on_init(function() game.draw_resource_selection = false @@ -113,6 +114,9 @@ restart_command({scenario_name = 'danger-ore-next'}) local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' container_dump({entity_name = 'coal'}) +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + local config = { spawn_shape = b.circle(64), start_ore_shape = b.circle(68), diff --git a/scenario_templates/danger-ore-chessboard-uniform/map_selection.lua b/scenario_templates/danger-ore-chessboard-uniform/map_selection.lua new file mode 100644 index 00000000..db6a50bb --- /dev/null +++ b/scenario_templates/danger-ore-chessboard-uniform/map_selection.lua @@ -0,0 +1 @@ +return require 'map_gen.maps.danger_ores.presets.danger_ore_chessboard_uniform' \ No newline at end of file diff --git a/scenario_templates/danger-ore-next/map_selection.lua b/scenario_templates/danger-ore-next/map_selection.lua index 6ab0559d..db6a50bb 100644 --- a/scenario_templates/danger-ore-next/map_selection.lua +++ b/scenario_templates/danger-ore-next/map_selection.lua @@ -1 +1 @@ -return require 'map_gen.maps.danger_ores.presets.danger_ore_chessboard' \ No newline at end of file +return require 'map_gen.maps.danger_ores.presets.danger_ore_chessboard_uniform' \ No newline at end of file