1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-30 23:17:53 +02:00

Update functions.lua

This commit is contained in:
Agocelt 2021-10-11 21:53:27 +02:00 committed by GitHub
parent aef46f2d0e
commit f1df85a95c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -854,6 +854,7 @@ function Public.set_difficulty()
local collapse_speed = WPT.get('collapse_speed')
local difficulty = WPT.get('difficulty')
local mining_bonus_till_wave = WPT.get('mining_bonus_till_wave')
local mining_bonus = WPT.get('mining_bonus')
local disable_mining_boost = WPT.get('disable_mining_boost')
local wave_number = WD.get_wave()
local player_count = calc_players()
@ -909,17 +910,18 @@ function Public.set_difficulty()
local force = game.forces.player
if wave_number < mining_bonus_till_wave then
-- the mining speed of the players will increase drastically since RPG is also loaded.
-- additional mining speed comes from steel axe research: 100%, and difficulty settings: too young to die 50%, hurt me plenty 25%
force.manual_mining_speed_modifier = force.manual_mining_speed_modifier - mining_bonus
if player_count <= 5 then
force.manual_mining_speed_modifier = 3 -- set a static 400% bonus if there are <= 5 players.
if force.technologies['steel-axe'].researched then
force.manual_mining_speed_modifier = 4
end
mining_bonus = 3 -- set a static 300% bonus if there are <= 5 players.
elseif player_count >= 6 and player_count <= 10 then
force.manual_mining_speed_modifier = 1 -- set a static 100% bonus if there are <= 10 players.
if force.technologies['steel-axe'].researched then
force.manual_mining_speed_modifier = 2
end
mining_bonus = 1 -- set a static 100% bonus if there are <= 10 players.
end
force.manual_mining_speed_modifier = force.manual_mining_speed_modifier + mining_bonus
WPT.set('mining_bonus', mining_bonus) -- Setting mining_bonus globally so it remembers how much to reduce
else
force.manual_mining_speed_modifier = force.manual_mining_speed_modifier - mining_bonus
WPT.set('disable_mining_boost', true)
end
end
end