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

Added locking chance

This commit is contained in:
SimonFlapse 2019-02-24 00:02:16 +01:00
parent e57d339467
commit a989c87c03
2 changed files with 10 additions and 3 deletions

View File

@ -197,6 +197,7 @@ global.config = {
hail_hydra = {
enabled = false,
-- enables difficulty scaling with number of online players
-- if enabled you can disable it for individual spawns by setting {locked = true}
online_player_scale_enabled = true,
-- the number of players required for regular values.
-- less online players than this number decreases the spawn chances
@ -215,6 +216,8 @@ global.config = {
-- eg. {min = 0.2, max = 2, trigger = 0.3} means that after evolution 0.3 this hydra spawns with a chance of at least 0.2
-- and at evolution = 1.00 it spawns with a chance of 2.
-- At evolution 0.60 it would spawn with a chance of min + max * (percentage of max) = 1.1
-- Example of all available options (only min is required):
-- ['behemoth-biter'] = {min = 0.1, max = 0.5, trigger = 0.90, locked = true}}
hydras = {
-- spitters
['small-spitter'] = {['small-worm-turret'] = {min = 0.2, max = -1}},
@ -228,7 +231,7 @@ global.config = {
-- worms
['small-worm-turret'] = {['small-biter'] = {min = 2.5, max = -1}},
['medium-worm-turret'] = {['small-biter'] = {min = 2.5, max = -1}, ['medium-biter'] = {min = 0.6, max = -1}},
['big-worm-turret'] = {['small-biter'] = {min = 3.8, max = -1}, ['medium-biter'] = {min = 1.3, max = -1}, ['big-biter'] = {min = 1.1, max = -1}, ['behemoth-biter'] = {min = 0.1, max = -1, trigger = 0.99}}
['big-worm-turret'] = {['small-biter'] = {min = 3.8, max = -1}, ['medium-biter'] = {min = 1.3, max = -1}, ['big-biter'] = {min = 1.1, max = -1}, ['behemoth-biter'] = {min = 0.1, max = -1, trigger = 0.99, locked = true}}
}
},
-- grants reward coins for certain actions

View File

@ -88,8 +88,8 @@ local on_died =
player_scale = (num_online_players - primitives.online_player_scale) * 0.01
end
local evolution_factor = primitives.evolution_scale_formula(force.evolution_factor)
evolution_factor = evolution_factor + evolution_factor * player_scale
local evolution_scaled = primitives.evolution_scale_formula(force.evolution_factor)
local evolution_factor = evolution_scaled + evolution_scaled * player_scale
local cause = event.cause
local surface = entity.surface
@ -104,6 +104,10 @@ local on_died =
end
local trigger = amount.trigger
if trigger == nil or trigger < force.evolution_factor then
if amount.locked then
evolution_factor = evolution_scaled
game.print('Locked!')
end
local min = amount.min
local max = amount.max
max = (max ~= nil and max >= min) and max or min