mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-27 21:48:52 +02:00
Updated readme and minor perf fix
This commit is contained in:
parent
1c5ccdf8f5
commit
f249cab9df
@ -54,10 +54,26 @@ to adjust the difficulty for your needs. You can find the config in `map_gen/Dig
|
||||
well-explained. For Single-player it's recommend to enable cheats with modified values. You can change the starting
|
||||
items and some pre-defined cheat values (if cheats are enabled) under the `SetupPlayer` config item.
|
||||
|
||||
You can turn off certain features if you wish.
|
||||
- DiggyCaveCollapse, disable this feature if you wish to play without collapses.
|
||||
- SimpleRoomGenerator, disable this if you want to play without room generation. _**WARNING:** this is the mechanic
|
||||
that spawns water._
|
||||
- AlienSpawner, disable this if you wish to disable spawning biters and spitters when mining.
|
||||
- ScatteredResources, used to tweak random resource spawning.
|
||||
- MarketExchange, regulates all the market related features.
|
||||
## Configuring Diggy
|
||||
|
||||
### Changing or Disabling Biter Spawning
|
||||
You can find the biter spawning feature in the config file under `AlienSpawner`. If you don't want biters to spawn
|
||||
according to the Diggy scenario, turn this feature off completely.
|
||||
|
||||
### Disabling Collapses
|
||||
While one of the core features, it can also be fun to play without. To turn off collapses completely, you can turn off
|
||||
this feature under `DiggyCaveCollapse`. If you experience performance issues while digging, you can turn off this
|
||||
feature as well as it can be quite heavy.
|
||||
|
||||
### Configuring Resource Spawning
|
||||
At the moment, Diggy is not yet using any of the build-in mechanics to spawn resources and you will have to manually add
|
||||
them. The resource spawning mechanism is quite complex, so don't hesitate to us how to configure it on Discord. Most
|
||||
basic configuration can be found under `ScatteredResources`. To customize the resource weights, you have to configure
|
||||
those specifics in the `map_gen/Diggy/Orepattern` directory. Resources are defined with a weight, meaning you can add
|
||||
your own resources (for example bobs or angels) with a value and the scenario will automatically calculate the proper
|
||||
spawn chances.
|
||||
|
||||
### Adding Market Items
|
||||
Items can be configured by adding the desired item under the `MarketExchange` configuration. You only have to define a
|
||||
level at which it unlocks, a price or prices in case it can cost more, and what the item prototype is. For a list of
|
||||
items, you can look up each possible item on the [Factorio raw data page](https://wiki.factorio.com/Data.raw#item).
|
||||
|
@ -340,18 +340,19 @@ local Config = {
|
||||
{level = 100, price = {{"stone", 5000}, {"coin", 9999}}, name = 'atomic-bomb'},
|
||||
}
|
||||
),
|
||||
buffs = { --Define new buffs here
|
||||
|
||||
buffs = { --Define new buffs here, they are handed out for each level
|
||||
{prototype = {name = 'mining_speed', value = 5}},
|
||||
{prototype = {name = 'inventory_slot', value = 1}},
|
||||
{prototype = {name = 'stone_automation', value = 3}},
|
||||
},
|
||||
|
||||
-- controls the formula for calculating level up costs in stone sent to surface
|
||||
difficulty_scale = 25, -- Diggy default 25. Higher increases difficulity, lower decreases (Only affects the stone requirement/cost to level up) (Only integers has been tested succesful)
|
||||
difficulty_scale = 25, -- Diggy default 25. Higher increases difficulty, lower decreases (Only affects the stone requirement/cost to level up) (Only integers has been tested succesful)
|
||||
start_stone = 50, -- Diggy default 50. This sets the price for the first level.
|
||||
cost_precision = 2, -- Diggy default 2. This sets the precision of the stone requirements to level up. E.g. 1234 becomes 1200 with precision 2 and 1230 with precision 3.
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return Config
|
||||
return Config
|
||||
|
@ -12,15 +12,14 @@ local Debug = require 'map_gen.Diggy.Debug'
|
||||
local insert = table.insert
|
||||
local random = math.random
|
||||
|
||||
--BT's additions
|
||||
local Config = require 'map_gen.Diggy.Config'
|
||||
-- todo remove this dependency
|
||||
local ResourceConfig = require 'map_gen.Diggy.Config'.features.ScatteredResources
|
||||
|
||||
local Perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Simplex = require 'map_gen.shared.simplex_noise'
|
||||
|
||||
local sqrt = math.sqrt
|
||||
local ceil = math.ceil
|
||||
local floor = math.floor
|
||||
|
||||
-- this
|
||||
local DiggyHole = {}
|
||||
@ -57,16 +56,12 @@ local function diggy_hole(entity)
|
||||
local tiles = {}
|
||||
local rocks = {}
|
||||
local surface = entity.surface
|
||||
|
||||
local out_of_map_found = Scanner.scan_around_position(surface, entity.position, 'out-of-map');
|
||||
|
||||
local position = entity.position
|
||||
local x = position.x
|
||||
local y = position.y
|
||||
local surface = entity.surface
|
||||
|
||||
|
||||
local distance = Config.features.ScatteredResources.distance(x, y)
|
||||
local out_of_map_found = Scanner.scan_around_position(surface, position, 'out-of-map');
|
||||
local distance = ResourceConfig.distance(x, y)
|
||||
|
||||
-- source of noise for resource generation
|
||||
-- index determines offset
|
||||
@ -97,42 +92,25 @@ local function diggy_hole(entity)
|
||||
return noise
|
||||
end
|
||||
|
||||
-- local c_clusters = Config.features.ScatteredResources.clusters
|
||||
-- local c_mode = Config.features.ScatteredResources.cluster_mode
|
||||
|
||||
-- global config values
|
||||
|
||||
local resource_richness_weights = Config.features.ScatteredResources.resource_richness_weights
|
||||
local resource_richness_weights = ResourceConfig.resource_richness_weights
|
||||
local resource_richness_weights_sum = 0
|
||||
for _, weight in pairs(resource_richness_weights) do
|
||||
resource_richness_weights_sum = resource_richness_weights_sum + weight
|
||||
end
|
||||
local resource_richness_values = Config.features.ScatteredResources.resource_richness_values
|
||||
local resource_type_scalar = Config.features.ScatteredResources.resource_type_scalar
|
||||
local resource_richness_values = ResourceConfig.resource_richness_values
|
||||
local resource_type_scalar = ResourceConfig.resource_type_scalar
|
||||
|
||||
-- scattered config values
|
||||
local s_mode = Config.features.ScatteredResources.scattered_mode
|
||||
local s_dist_mod = Config.features.ScatteredResources.scattered_distance_probability_modifier
|
||||
local s_min_prob = Config.features.ScatteredResources.scattered_min_probability
|
||||
local s_max_prob = Config.features.ScatteredResources.scattered_max_probability
|
||||
local s_dist_richness = Config.features.ScatteredResources.scattered_distance_richness_modifier
|
||||
local s_cluster_prob = Config.features.ScatteredResources.scattered_cluster_probability_multiplier
|
||||
local s_cluster_mult = Config.features.ScatteredResources.scattered_cluster_yield_multiplier
|
||||
|
||||
local s_resource_weights = Config.features.ScatteredResources.scattered_resource_weights
|
||||
local s_resource_weights = ResourceConfig.scattered_resource_weights
|
||||
local s_resource_weights_sum = 0
|
||||
for _, weight in pairs(s_resource_weights) do
|
||||
s_resource_weights_sum = s_resource_weights_sum + weight
|
||||
end
|
||||
local s_min_dist = Config.features.ScatteredResources.scattered_minimum_resource_distance
|
||||
|
||||
-- cluster config values
|
||||
local cluster_mode = Config.features.ScatteredResources.cluster_mode
|
||||
|
||||
-- compound cluster spawning
|
||||
local c_mode = Config.features.ScatteredResources.cluster_mode
|
||||
local c_mode = ResourceConfig.cluster_mode
|
||||
-- local c_clusters = Config.features.ScatteredResources.clusters
|
||||
local c_clusters = require(Config.features.ScatteredResources.cluster_file_location)
|
||||
local c_clusters = require(ResourceConfig.cluster_file_location)
|
||||
if ('table' ~= type(c_clusters)) then
|
||||
error('cluster_file_location invalid')
|
||||
end
|
||||
@ -147,20 +125,20 @@ local function diggy_hole(entity)
|
||||
end
|
||||
|
||||
local function spawn_cluster_resource(surface, x, y, cluster_index, cluster)
|
||||
local distance = sqrt(x * x + y * y)
|
||||
local cluster_distance = sqrt(x * x + y * y)
|
||||
local resource_name = get_name_by_weight(cluster.weights, cluster.weights_sum)
|
||||
if resource_name == 'skip' then
|
||||
return false
|
||||
end
|
||||
if cluster.distances[resource_name] then
|
||||
if distance < cluster.distances[resource_name] then
|
||||
if cluster_distance < cluster.distances[resource_name] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local range = resource_richness_values[get_name_by_weight(resource_richness_weights, resource_richness_weights_sum)]
|
||||
local amount = random(range[1], range[2])
|
||||
amount = amount * (1 + ((distance / cluster.distance_richness) * 0.01))
|
||||
amount = amount * (1 + ((cluster_distance / cluster.distance_richness) * 0.01))
|
||||
amount = amount * cluster.yield
|
||||
|
||||
if resource_type_scalar[resource_name] then
|
||||
|
Loading…
x
Reference in New Issue
Block a user