1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Diggy - Fixed some bugs and tweaked some balance

This commit is contained in:
Lynn 2018-12-07 19:35:40 +01:00
parent b5de650716
commit 06d64a6e7c
5 changed files with 20 additions and 23 deletions

View File

@ -64,10 +64,6 @@ local Config = {
DiggyHole = {
enabled = true,
-- displays a warning when a player continues digging with a full inventory
-- primarily used for multiplayer, can be disabled without consequences
enable_digging_warning = true,
-- 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,

View File

@ -104,7 +104,6 @@ end
@param value of number to be displayed
@param surface LuaSurface
@param position Position {x, y}
@param scale float
@param offset float position offset
@param immutable bool if immutable, only set, never do a surface lookup, values never change
@param color_value float How far along the range of values of colors the value is to be displayed
@ -113,7 +112,7 @@ end
@param under_bound {r,g,b} The color to be used if color_value < 0
@param over_bound {r,g,b} The color to be used if color_value > 1
]]
function Debug.print_colored_grid_value(value, surface, position, scale, offset, immutable,
function Debug.print_colored_grid_value(value, surface, position, offset, immutable,
color_value, base_color, delta_color, under_bound, over_bound)
local is_string = type(value) == 'string'
-- default values:
@ -127,9 +126,11 @@ function Debug.print_colored_grid_value(value, surface, position, scale, offset,
elseif (color_value > 1) then
color = o_color
else
color = { r = color.r + color_value * d_color.r,
g = color.g + color_value * d_color.g,
b = color.b + color_value * d_color.b }
color = {
r = color.r + color_value * d_color.r,
g = color.g + color_value * d_color.g,
b = color.b + color_value * d_color.b
}
end
local text = value

View File

@ -47,7 +47,7 @@ local support_beam_entities
local on_surface_created
local stress_threshold_causing_collapse = 3.57
local near_stress_threshold_causing_collapse = 3.57 * 0.9
local near_stress_threshold_causing_collapse = 3.3 --
local show_deconstruction_alert_message = {}
local stress_map_storage = {}
@ -464,7 +464,7 @@ local function add_fraction(stress_map, x, y, fraction, player_index, surface)
end
end
if enable_stress_grid then
Debug.print_colored_grid_value(value, surface, {x = x, y = y}, 4, 0.5, false,
Debug.print_colored_grid_value(value, surface, {x = x, y = y}, 0.5, false,
value / stress_threshold_causing_collapse, {r = 0, g = 1, b = 0}, {r = 1, g = -1, b = 0},
{r = 0, g = 1, b = 0}, {r = 1, g = 1, b = 1})
end
@ -492,7 +492,7 @@ end
---@param callback function
stress_map_check_stress_in_threshold = function(surface, x, y, threshold, callback)
local stress_map = stress_map_storage[surface.index]
local value = add_fraction(stress_map, x, y, 0, surface)
local value = add_fraction(stress_map, x, y, 0, nil, surface)
if (value >= stress_threshold_causing_collapse - threshold) then
callback(surface, x, y)

View File

@ -118,7 +118,7 @@ function ScatteredResources.register(config)
end
end
local function spawn_cluster_resource(surface, x, y, cluster_index, cluster)
local function spawn_cluster_resource(surface, x, y, cluster)
local distance = sqrt(x * x + y * y)
local resource_name = get_name_by_weight(cluster.weights, cluster.weights_sum)
if resource_name == 'skip' then
@ -158,7 +158,7 @@ function ScatteredResources.register(config)
if cluster.noise_settings.type == "connected_tendril" then
local noise = seeded_noise(surface, x, y, index, cluster.noise_settings.sources)
if -1 * cluster.noise_settings.threshold < noise and noise < cluster.noise_settings.threshold then
if spawn_cluster_resource(surface, x, y, index, cluster) then
if spawn_cluster_resource(surface, x, y, cluster) then
return -- resource spawned
end
end
@ -168,14 +168,14 @@ function ScatteredResources.register(config)
if -1 * cluster.noise_settings.threshold < noise1 and noise1 < cluster.noise_settings.threshold
and -1 * cluster.noise_settings.discriminator_threshold < noise2
and noise2 < cluster.noise_settings.discriminator_threshold then
if spawn_cluster_resource(surface, x, y, index, cluster) then
if spawn_cluster_resource(surface, x, y, cluster) then
return -- resource spawned
end
end
else
local noise = seeded_noise(surface, x, y, index, cluster.noise_settings.sources)
if noise >= cluster.noise_settings.threshold then
if spawn_cluster_resource(surface, x, y, index, cluster) then
if spawn_cluster_resource(surface, x, y, cluster) then
return -- resource spawned
end
end
@ -228,7 +228,7 @@ function ScatteredResources.register(config)
local noise = seeded_noise(surface, x, y, index, cluster.noise_settings.sources)
if -1 * cluster.noise_settings.threshold < noise and noise < cluster.noise_settings.threshold then
color[index] = color[index] or cluster.color or {r=random(), g=random(), b=random()}
Debug.print_colored_grid_value('o' .. index, surface, {x = x, y = y}, nil, nil, true, 0, color[index])
Debug.print_colored_grid_value('o' .. index, surface, {x = x, y = y}, nil, true, 0, color[index])
end
elseif cluster.noise_settings.type == "fragmented_tendril" then
local noise1 = seeded_noise(surface, x, y, index, cluster.noise_settings.sources)
@ -237,13 +237,13 @@ function ScatteredResources.register(config)
and -1 * cluster.noise_settings.discriminator_threshold < noise2
and noise2 < cluster.noise_settings.discriminator_threshold then
color[index] = color[index] or cluster.color or {r=random(), g=random(), b=random()}
Debug.print_colored_grid_value('o' .. index, surface, {x = x, y = y}, nil, nil, true, 0, color[index])
Debug.print_colored_grid_value('o' .. index, surface, {x = x, y = y}, nil, true, 0, color[index])
end
elseif cluster.noise_settings.type ~= 'skip' then
local noise = seeded_noise(surface, x, y, index, cluster.noise_settings.sources)
if noise >= cluster.noise_settings.threshold then
color[index] = color[index] or cluster.color or {r=random(), g=random(), b=random()}
Debug.print_colored_grid_value('o' .. index, surface, {x = x, y = y}, nil, nil, true, 0, color[index])
Debug.print_colored_grid_value('o' .. index, surface, {x = x, y = y}, nil, true, 0, color[index])
end
end
end

View File

@ -39,9 +39,9 @@ return {
},
weights = {
['coal'] = 160,
['copper-ore'] = 215,
['iron-ore'] = 389,
['stone'] = 182,
['copper-ore'] = 280,
['iron-ore'] = 395,
['stone'] = 135,
['uranium-ore'] = 6,
},
distances = {
@ -70,7 +70,7 @@ return {
['coal'] = 160,
['copper-ore'] = 215,
['iron-ore'] = 389,
['stone'] = 182,
['stone'] = 100,
['uranium-ore'] = 30,
},
distances = {