diff --git a/map_gen/Diggy/Config.lua b/map_gen/Diggy/Config.lua index 584025d6..1b227dc1 100644 --- a/map_gen/Diggy/Config.lua +++ b/map_gen/Diggy/Config.lua @@ -41,6 +41,9 @@ local Config = { enabled = true, register = require 'map_gen.Diggy.Feature.DiggyHole'.register, initialize = require 'map_gen.Diggy.Feature.DiggyHole'.initialize, + + -- percentage * mining productivity level gets added to mining speed + mining_speed_productivity_multiplier = 15, }, DiggyCaveCollapse = { enabled = true, diff --git a/map_gen/Diggy/Feature/DiggyHole.lua b/map_gen/Diggy/Feature/DiggyHole.lua index de79744d..911ab763 100644 --- a/map_gen/Diggy/Feature/DiggyHole.lua +++ b/map_gen/Diggy/Feature/DiggyHole.lua @@ -7,6 +7,7 @@ local Event = require 'utils.event' local Scanner = require 'map_gen.Diggy.Scanner' local Template = require 'map_gen.Diggy.Template' +local Debug = require 'map_gen.Diggy.Debug' -- this local DiggyHole = {} @@ -56,7 +57,9 @@ local artificial_tiles = { --[[-- Registers all event handlers. ]] -function DiggyHole.register(config) +function DiggyHole.register(cfg) + local config = cfg.features.DiggyHole + Event.add(defines.events.on_entity_died, function (event) diggy_hole(event.entity) end) @@ -94,6 +97,11 @@ function DiggyHole.register(config) Template.insert(game.surfaces[event.surface_index], tiles, {}) end) + + Event.add(defines.events.on_research_finished, function(event) + local player = game.forces.player + player.manual_mining_speed_modifier = player.mining_drill_productivity_bonus * config.mining_speed_productivity_multiplier / 2 + end) end --[[-- diff --git a/map_gen/Diggy/Feature/StartingZone.lua b/map_gen/Diggy/Feature/StartingZone.lua index 7b473002..1672e271 100644 --- a/map_gen/Diggy/Feature/StartingZone.lua +++ b/map_gen/Diggy/Feature/StartingZone.lua @@ -18,6 +18,7 @@ local StartingZone = {} ]] function StartingZone.register(config) local callback_token + local starting_zone_size = config.features.StartingZone.starting_size local function on_chunk_generated(event) local start_point_area = {{-1, -1}, {0, 0}} @@ -37,18 +38,18 @@ function StartingZone.register(config) local tiles = {} local rocks = {} - Mask.circle(0, 0, config.features.StartingZone.starting_size, function(x, y, tile_distance_to_center) - if (tile_distance_to_center > math.floor(config.features.StartingZone.starting_size / 2)) then + Mask.circle(0, 0, starting_zone_size, function(x, y, tile_distance_to_center) + if (tile_distance_to_center > math.floor(starting_zone_size / 2)) then table.insert(tiles, {name = 'dirt-' .. math.random(1, 7), position = {x = x, y = y}}) else table.insert(tiles, {name = 'stone-path', position = {x = x, y = y}}) end - if (tile_distance_to_center > config.features.StartingZone.starting_size - 2) then + if (tile_distance_to_center > starting_zone_size - 2) then table.insert(rocks, {name = 'sand-rock-big', position = {x = x, y = y}}) end - if (tile_distance_to_center > math.floor(config.features.StartingZone.starting_size / 10)) then + if (tile_distance_to_center > math.floor(starting_zone_size / 10)) then Mask.blur(x, y, -0.3, function (x, y, fraction) StressMap.add(event.surface, {x = x, y = y}, fraction) end)