From d58e2a76061f64f2faae7194734dc65c4fd6abe3 Mon Sep 17 00:00:00 2001 From: plague006 Date: Tue, 19 Feb 2019 01:43:55 -0500 Subject: [PATCH 1/2] Add solid_rock --- map_gen/maps/solid_rock.lua | 88 +++++++++++++++++++++++++++++++++++++ utils/recipe_locker.lua | 4 +- 2 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 map_gen/maps/solid_rock.lua diff --git a/map_gen/maps/solid_rock.lua b/map_gen/maps/solid_rock.lua new file mode 100644 index 00000000..6bd5e247 --- /dev/null +++ b/map_gen/maps/solid_rock.lua @@ -0,0 +1,88 @@ +--[[ + The theme of the map is no underground belts or pipes. + For balance, logistics systems research is disabled. +]] +local b = require 'map_gen.shared.builders' +local RecipeLocker = require 'utils.recipe_locker' +local table = require 'utils.table' +local Event = require 'utils.event' +local RS = require 'map_gen.shared.redmew_surface' +local ScenarioInfo = require 'features.gui.info' +local MGSP = require 'resources.map_gen_settings' +local market_items = require 'resources.market_items' + +local insert = table.insert +local config = global.config + +ScenarioInfo.set_map_name('Solid Rock') +ScenarioInfo.set_map_description("The entire planet is so solid that we can't seem to dig into it.") +ScenarioInfo.add_map_extra_info([[ +- This planet's ground is completely impenetrable. +- This planet has a magnetic field that will make logistics systems impossible. +- We brought wood and rail on our journey and it is available in the market. +- The beasts on this planet are savage and unrelenting. +]]) + +RS.set_map_gen_settings({MGSP.enemy_very_high, MGSP.tree_none, MGSP.cliff_very_high}) + +config.hail_hydra.enabled = true + +-- Setup market inventory +config.market.enabled = true +local items_to_modify = { + {name = 'rail', price = 0.25}, + {name = 'rail-signal', price = 1}, + {name = 'rail-chain-signal', price = 1}, + {name = 'train-stop', price = 7.5}, + {name = 'locomotive', price = 35}, + {name = 'cargo-wagon', price = 15}, + {name = 'raw-wood', price = 0.25} +} + +-- Modify market items +for i = 1, #items_to_modify do + insert(market_items, items_to_modify[i]) +end + +RecipeLocker.lock_recipes( + { + 'underground-belt', + 'fast-underground-belt', + 'express-underground-belt', + 'pipe-to-ground', + 'logistic-chest-requester', + 'logistic-chest-buffer', + 'logistic-chest-active-provider' + } +) + +Event.on_init( + function() + game.forces.player.technologies['logistic-system'].enabled = false + end +) + +-- Map + +local function on_chunk_generated(event) + local bd_box = event.area + local surface = event.surface + if surface ~= RS.get_surface() then + return + end + + -- remove rocks + local ents = surface.find_entities_filtered {area = bd_box, type = 'simple-entity'} + for i = 1, #ents do + ents[i].destroy() + end +end + +Event.add(defines.events.on_chunk_generated, on_chunk_generated) + +local start = b.full_shape +start = b.change_map_gen_collision_tile(start, 'ground-tile', 'refined-concrete') +start = b.change_map_gen_collision_hidden_tile(start, 'ground-tile', 'lab-dark-2') +local map = b.if_else(start, b.full_shape) + +return map diff --git a/utils/recipe_locker.lua b/utils/recipe_locker.lua index ce754b5b..bf5f69e3 100644 --- a/utils/recipe_locker.lua +++ b/utils/recipe_locker.lua @@ -38,7 +38,7 @@ Event.on_init( ) --- Locks recipes, preventing them from being enabled by research. --- Does not check if they should be enabled/disabled by existing research. +-- Does not check if they should be enabled/disabled by research already completed. -- @param tbl an array of recipe strings function Public.lock_recipes(tbl) for i = 1, #tbl do @@ -47,7 +47,7 @@ function Public.lock_recipes(tbl) end --- Unlocks recipes, allowing them to be enabled by research. --- Does not check if they should be enabled/disabled by existing research. +-- Does not check if they should be enabled/disabled by research already completed. -- @param tbl
an array of recipe strings function Public.unlock_recipes(tbl) for i = 1, #tbl do From 096f72a849f88df512078daeca7585e2e0caa3f1 Mon Sep 17 00:00:00 2001 From: Matthew Heguy Date: Thu, 21 Feb 2019 17:24:20 -0500 Subject: [PATCH 2/2] Switch to builder function, turn cliffs down. --- map_gen/maps/solid_rock.lua | 20 ++++++++------------ resources/map_gen_settings.lua | 8 ++++++++ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/map_gen/maps/solid_rock.lua b/map_gen/maps/solid_rock.lua index 6bd5e247..a55ec17a 100644 --- a/map_gen/maps/solid_rock.lua +++ b/map_gen/maps/solid_rock.lua @@ -23,7 +23,7 @@ ScenarioInfo.add_map_extra_info([[ - The beasts on this planet are savage and unrelenting. ]]) -RS.set_map_gen_settings({MGSP.enemy_very_high, MGSP.tree_none, MGSP.cliff_very_high}) +RS.set_map_gen_settings({MGSP.enemy_very_high, MGSP.tree_none, MGSP.cliff_high}) config.hail_hydra.enabled = true @@ -64,25 +64,21 @@ Event.on_init( -- Map -local function on_chunk_generated(event) - local bd_box = event.area - local surface = event.surface - if surface ~= RS.get_surface() then - return - end - - -- remove rocks - local ents = surface.find_entities_filtered {area = bd_box, type = 'simple-entity'} +local function no_rocks(_, _, world, tile) + local x, y = world.x, world.y + local ents = world.surface.find_entities_filtered {area = {{x, y}, {x + 1, y + 1}}, type = 'simple-entity'} for i = 1, #ents do ents[i].destroy() end -end -Event.add(defines.events.on_chunk_generated, on_chunk_generated) + return tile +end local start = b.full_shape start = b.change_map_gen_collision_tile(start, 'ground-tile', 'refined-concrete') start = b.change_map_gen_collision_hidden_tile(start, 'ground-tile', 'lab-dark-2') local map = b.if_else(start, b.full_shape) +map = b.apply_effect(map, no_rocks) + return map diff --git a/resources/map_gen_settings.lua b/resources/map_gen_settings.lua index 873f7bda..7fa7337d 100644 --- a/resources/map_gen_settings.lua +++ b/resources/map_gen_settings.lua @@ -215,6 +215,14 @@ return { cliff_elevation_0 = 10, cliff_elevation_interval = 10 }, + -- cliffs to high frequency, big size + cliff_high = { + cliff_settings = { + cliff_elevation_0 = 5, + cliff_elevation_interval = 5, + name = 'cliff' + } + }, -- cliffs to very high frequency, very big size cliff_very_high = { cliff_settings = {