diff --git a/features/player_create.lua b/features/player_create.lua index 64460c99..0a17ec5d 100644 --- a/features/player_create.lua +++ b/features/player_create.lua @@ -2,6 +2,7 @@ local table = require 'utils.table' local Event = require 'utils.event' local Global = require 'utils.global' local Info = require 'features.gui.info' +local pairs = pairs local get_random_weighted = table.get_random_weighted diff --git a/map_gen/maps/diggy/config.lua b/map_gen/maps/diggy/config.lua index 2f5dbaab..f60c2b54 100644 --- a/map_gen/maps/diggy/config.lua +++ b/map_gen/maps/diggy/config.lua @@ -26,8 +26,11 @@ local Config = { {name = 'iron-gear-wheel', count = 8}, {name = 'iron-plate', count = 16} }, - -- applied when _CHEATS is set to true and _DEBUG is NOT true. It's recommended to tweak this to your needs - -- when playing with cheats on (recommended for single player or LAN with limited players) + + -- 0.01 bonus equals 1% in game. This value is recommended to be tweaked for single player + initial_mining_speed_bonus = 1, + + -- applied when _CHEATS is set to true and _DEBUG is NOT true. -- see config.lua -> config.player_create.cheats for available options cheats = { enabled = true, @@ -52,7 +55,10 @@ local Config = { -- initial damage per tick it damages a rock to mine, can be enhanced by robot_damage_per_mining_prod_level robot_initial_mining_damage = 4, -- damage added per level of mining productivity level research - robot_damage_per_mining_prod_level = 1 + robot_damage_per_mining_prod_level = 1, + + -- turn this setting on if you want to bring back landfill research, default is off due to griefing + allow_landfill_research = false, }, -- adds the ability to collapse caves diggy_cave_collapse = { diff --git a/map_gen/maps/diggy/feature/diggy_cave_collapse.lua b/map_gen/maps/diggy/feature/diggy_cave_collapse.lua index be94c3bf..b6856b05 100644 --- a/map_gen/maps/diggy/feature/diggy_cave_collapse.lua +++ b/map_gen/maps/diggy/feature/diggy_cave_collapse.lua @@ -31,7 +31,7 @@ local collapse_rocks_size = #collapse_rocks -- this local DiggyCaveCollapse = {} -local config = {} +local config local n = 9 local radius = 0 diff --git a/map_gen/maps/diggy/feature/diggy_hole.lua b/map_gen/maps/diggy/feature/diggy_hole.lua index 8d2affa7..5f9f5719 100644 --- a/map_gen/maps/diggy/feature/diggy_hole.lua +++ b/map_gen/maps/diggy/feature/diggy_hole.lua @@ -11,7 +11,6 @@ local ScoreTable = require 'map_gen.maps.diggy.score_table' local Command = require 'utils.command' local CreateParticles = require 'features.create_particles' local Ranks = require 'resources.ranks' - local random = math.random local tonumber = tonumber local pairs = pairs @@ -23,6 +22,7 @@ local raise_event = script.raise_event -- this local DiggyHole = {} +local config -- keeps track of the amount of times per player when they mined with a full inventory in a row local full_inventory_mining_cache = {} @@ -151,8 +151,9 @@ end) --[[-- Registers all event handlers. ]] -function DiggyHole.register(config) - robot_mining.damage = config.robot_initial_mining_damage +function DiggyHole.register(cfg) + config = cfg + robot_mining.damage = cfg.robot_initial_mining_damage ScoreTable.set('Robot mining damage', robot_mining.damage) ScoreTable.reset('Mine size') @@ -241,7 +242,7 @@ function DiggyHole.register(config) increment_score('Mine size') end) - local robot_damage_per_mining_prod_level = config.robot_damage_per_mining_prod_level + local robot_damage_per_mining_prod_level = cfg.robot_damage_per_mining_prod_level Event.add(defines.events.on_research_finished, function (event) local new_modifier = event.research.force.mining_drill_productivity_bonus * 50 * robot_damage_per_mining_prod_level @@ -256,7 +257,7 @@ function DiggyHole.register(config) end function DiggyHole.on_init() - game.forces.player.technologies['landfill'].enabled = false + game.forces.player.technologies['landfill'].enabled = config.allow_landfill_research game.forces.player.technologies['atomic-bomb'].enabled = false end diff --git a/map_gen/maps/diggy/feature/experience.lua b/map_gen/maps/diggy/feature/experience.lua index 5e6947a6..4e9bd571 100644 --- a/map_gen/maps/diggy/feature/experience.lua +++ b/map_gen/maps/diggy/feature/experience.lua @@ -58,7 +58,7 @@ Global.register( end ) -local config = {} +local config local gain_xp_color = Color.light_sky_blue local lose_xp_color = Color.red @@ -263,8 +263,6 @@ local function on_research_finished(event) Experience.update_inventory_slots(force, 0) Experience.update_mining_speed(force, 0) Experience.update_health_bonus(force, 0) - - game.forces.player.technologies['landfill'].enabled = false end ---Awards experience when a rocket has been launched based on percentage of total experience diff --git a/map_gen/maps/diggy/feature/setup_player.lua b/map_gen/maps/diggy/feature/setup_player.lua index 64630dd3..7d47879b 100644 --- a/map_gen/maps/diggy/feature/setup_player.lua +++ b/map_gen/maps/diggy/feature/setup_player.lua @@ -1,27 +1,28 @@ local Event = require 'utils.event' local SetupPlayer = {} +local config -global.SetupPlayer = { - first_player_spawned = false -} - -function SetupPlayer.register(config) +function SetupPlayer.register(cfg) + config = cfg Event.add( defines.events.on_player_created, function() local redmew_player_create = global.config.player_create - if #config.starting_items > 0 then - redmew_player_create.starting_items = config.starting_items + if #cfg.starting_items > 0 then + redmew_player_create.starting_items = cfg.starting_items end if not _DEBUG then - local cheats = config.cheats - redmew_player_create.cheats = cheats + redmew_player_create.cheats = cfg.cheats end end ) end +function SetupPlayer.on_init() + game.forces.player.manual_mining_speed_modifier = config.initial_mining_speed_bonus +end + return SetupPlayer diff --git a/map_gen/maps/diggy/orepattern/clusters.lua b/map_gen/maps/diggy/orepattern/clusters.lua index 88288243..dd798c3b 100644 --- a/map_gen/maps/diggy/orepattern/clusters.lua +++ b/map_gen/maps/diggy/orepattern/clusters.lua @@ -38,7 +38,7 @@ return { ['iron-ore'] = 389, ['stone'] = 212, ['uranium-ore'] = 21, - ['crude-oil'] = 3, + ['crude-oil'] = 8, }, distances = { ['coal'] = 16, diff --git a/map_gen/maps/diggy/orepattern/tendrils.lua b/map_gen/maps/diggy/orepattern/tendrils.lua index 9b9127ab..b9e6bf51 100644 --- a/map_gen/maps/diggy/orepattern/tendrils.lua +++ b/map_gen/maps/diggy/orepattern/tendrils.lua @@ -210,8 +210,8 @@ return { }, }, weights = { - ['skip'] = 997, - ['crude-oil'] = 3, + ['skip'] = 990, + ['crude-oil'] = 10, }, distances = { ['crude-oil'] = 57, diff --git a/map_gen/maps/diggy/orepattern/tendrils_impure.lua b/map_gen/maps/diggy/orepattern/tendrils_impure.lua index f4f8fdb1..21309fa0 100644 --- a/map_gen/maps/diggy/orepattern/tendrils_impure.lua +++ b/map_gen/maps/diggy/orepattern/tendrils_impure.lua @@ -198,8 +198,8 @@ return { }, }, weights = { - ['skip'] = 997, - ['crude-oil'] = 3, + ['skip'] = 990, + ['crude-oil'] = 10, }, distances = { ['crude-oil'] = 57,