mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Merge pull request #930 from linaori/diggy-tweaks
Some diggy tweaks based on feedback
This commit is contained in:
commit
f73039a55e
@ -2,6 +2,7 @@ local table = require 'utils.table'
|
|||||||
local Event = require 'utils.event'
|
local Event = require 'utils.event'
|
||||||
local Global = require 'utils.global'
|
local Global = require 'utils.global'
|
||||||
local Info = require 'features.gui.info'
|
local Info = require 'features.gui.info'
|
||||||
|
local pairs = pairs
|
||||||
|
|
||||||
local get_random_weighted = table.get_random_weighted
|
local get_random_weighted = table.get_random_weighted
|
||||||
|
|
||||||
|
@ -26,8 +26,11 @@ local Config = {
|
|||||||
{name = 'iron-gear-wheel', count = 8},
|
{name = 'iron-gear-wheel', count = 8},
|
||||||
{name = 'iron-plate', count = 16}
|
{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
|
-- see config.lua -> config.player_create.cheats for available options
|
||||||
cheats = {
|
cheats = {
|
||||||
enabled = true,
|
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
|
-- 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,
|
robot_initial_mining_damage = 4,
|
||||||
-- damage added per level of mining productivity level research
|
-- 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
|
-- adds the ability to collapse caves
|
||||||
diggy_cave_collapse = {
|
diggy_cave_collapse = {
|
||||||
|
@ -31,7 +31,7 @@ local collapse_rocks_size = #collapse_rocks
|
|||||||
-- this
|
-- this
|
||||||
local DiggyCaveCollapse = {}
|
local DiggyCaveCollapse = {}
|
||||||
|
|
||||||
local config = {}
|
local config
|
||||||
|
|
||||||
local n = 9
|
local n = 9
|
||||||
local radius = 0
|
local radius = 0
|
||||||
|
@ -11,7 +11,6 @@ local ScoreTable = require 'map_gen.maps.diggy.score_table'
|
|||||||
local Command = require 'utils.command'
|
local Command = require 'utils.command'
|
||||||
local CreateParticles = require 'features.create_particles'
|
local CreateParticles = require 'features.create_particles'
|
||||||
local Ranks = require 'resources.ranks'
|
local Ranks = require 'resources.ranks'
|
||||||
|
|
||||||
local random = math.random
|
local random = math.random
|
||||||
local tonumber = tonumber
|
local tonumber = tonumber
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
@ -23,6 +22,7 @@ local raise_event = script.raise_event
|
|||||||
|
|
||||||
-- this
|
-- this
|
||||||
local DiggyHole = {}
|
local DiggyHole = {}
|
||||||
|
local config
|
||||||
|
|
||||||
-- keeps track of the amount of times per player when they mined with a full inventory in a row
|
-- keeps track of the amount of times per player when they mined with a full inventory in a row
|
||||||
local full_inventory_mining_cache = {}
|
local full_inventory_mining_cache = {}
|
||||||
@ -151,8 +151,9 @@ end)
|
|||||||
--[[--
|
--[[--
|
||||||
Registers all event handlers.
|
Registers all event handlers.
|
||||||
]]
|
]]
|
||||||
function DiggyHole.register(config)
|
function DiggyHole.register(cfg)
|
||||||
robot_mining.damage = config.robot_initial_mining_damage
|
config = cfg
|
||||||
|
robot_mining.damage = cfg.robot_initial_mining_damage
|
||||||
ScoreTable.set('Robot mining damage', robot_mining.damage)
|
ScoreTable.set('Robot mining damage', robot_mining.damage)
|
||||||
ScoreTable.reset('Mine size')
|
ScoreTable.reset('Mine size')
|
||||||
|
|
||||||
@ -241,7 +242,7 @@ function DiggyHole.register(config)
|
|||||||
increment_score('Mine size')
|
increment_score('Mine size')
|
||||||
end)
|
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)
|
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
|
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
|
end
|
||||||
|
|
||||||
function DiggyHole.on_init()
|
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
|
game.forces.player.technologies['atomic-bomb'].enabled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ Global.register(
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
local config = {}
|
local config
|
||||||
|
|
||||||
local gain_xp_color = Color.light_sky_blue
|
local gain_xp_color = Color.light_sky_blue
|
||||||
local lose_xp_color = Color.red
|
local lose_xp_color = Color.red
|
||||||
@ -263,8 +263,6 @@ local function on_research_finished(event)
|
|||||||
Experience.update_inventory_slots(force, 0)
|
Experience.update_inventory_slots(force, 0)
|
||||||
Experience.update_mining_speed(force, 0)
|
Experience.update_mining_speed(force, 0)
|
||||||
Experience.update_health_bonus(force, 0)
|
Experience.update_health_bonus(force, 0)
|
||||||
|
|
||||||
game.forces.player.technologies['landfill'].enabled = false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---Awards experience when a rocket has been launched based on percentage of total experience
|
---Awards experience when a rocket has been launched based on percentage of total experience
|
||||||
|
@ -1,27 +1,28 @@
|
|||||||
local Event = require 'utils.event'
|
local Event = require 'utils.event'
|
||||||
|
|
||||||
local SetupPlayer = {}
|
local SetupPlayer = {}
|
||||||
|
local config
|
||||||
|
|
||||||
global.SetupPlayer = {
|
function SetupPlayer.register(cfg)
|
||||||
first_player_spawned = false
|
config = cfg
|
||||||
}
|
|
||||||
|
|
||||||
function SetupPlayer.register(config)
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_player_created,
|
defines.events.on_player_created,
|
||||||
function()
|
function()
|
||||||
local redmew_player_create = global.config.player_create
|
local redmew_player_create = global.config.player_create
|
||||||
|
|
||||||
if #config.starting_items > 0 then
|
if #cfg.starting_items > 0 then
|
||||||
redmew_player_create.starting_items = config.starting_items
|
redmew_player_create.starting_items = cfg.starting_items
|
||||||
end
|
end
|
||||||
|
|
||||||
if not _DEBUG then
|
if not _DEBUG then
|
||||||
local cheats = config.cheats
|
redmew_player_create.cheats = cfg.cheats
|
||||||
redmew_player_create.cheats = cheats
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SetupPlayer.on_init()
|
||||||
|
game.forces.player.manual_mining_speed_modifier = config.initial_mining_speed_bonus
|
||||||
|
end
|
||||||
|
|
||||||
return SetupPlayer
|
return SetupPlayer
|
||||||
|
@ -38,7 +38,7 @@ return {
|
|||||||
['iron-ore'] = 389,
|
['iron-ore'] = 389,
|
||||||
['stone'] = 212,
|
['stone'] = 212,
|
||||||
['uranium-ore'] = 21,
|
['uranium-ore'] = 21,
|
||||||
['crude-oil'] = 3,
|
['crude-oil'] = 8,
|
||||||
},
|
},
|
||||||
distances = {
|
distances = {
|
||||||
['coal'] = 16,
|
['coal'] = 16,
|
||||||
|
@ -210,8 +210,8 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
weights = {
|
weights = {
|
||||||
['skip'] = 997,
|
['skip'] = 990,
|
||||||
['crude-oil'] = 3,
|
['crude-oil'] = 10,
|
||||||
},
|
},
|
||||||
distances = {
|
distances = {
|
||||||
['crude-oil'] = 57,
|
['crude-oil'] = 57,
|
||||||
|
@ -198,8 +198,8 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
weights = {
|
weights = {
|
||||||
['skip'] = 997,
|
['skip'] = 990,
|
||||||
['crude-oil'] = 3,
|
['crude-oil'] = 10,
|
||||||
},
|
},
|
||||||
distances = {
|
distances = {
|
||||||
['crude-oil'] = 57,
|
['crude-oil'] = 57,
|
||||||
|
Loading…
Reference in New Issue
Block a user