mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-30 23:17:53 +02:00
Fix issues found by luacheck
This commit is contained in:
parent
79e9bdee7e
commit
9abbd226da
@ -53,8 +53,8 @@ end
|
||||
|
||||
local function dirtlands(surface, room)
|
||||
local dungeontable = DungeonsTable.get_dungeontable()
|
||||
max_spawn = math.floor(dungeontable.depth[surface.index] / 8)
|
||||
max_worm = max_spawn + 1
|
||||
local max_spawn = math.floor(dungeontable.depth[surface.index] / 8)
|
||||
local max_worm = max_spawn + 1
|
||||
local path_tile = 'dirt-' .. math_random(1, 3)
|
||||
for _, tile in pairs(room.path_tiles) do
|
||||
surface.set_tiles({{name = path_tile, position = tile.position}}, true)
|
||||
|
@ -363,18 +363,6 @@ end
|
||||
--
|
||||
-- 1000 science (all types) = 9822 coal, 13492 stone, 48736 copper, 63018 iron
|
||||
-- 20 27 98 127 max-stones
|
||||
local function get_ore_amount_old(surface_index)
|
||||
local scaling = game.forces.player.mining_drill_productivity_bonus
|
||||
local amount = 5000 * Public.get_dungeon_evolution_factor(surface_index) * (1 + scaling)
|
||||
if amount > 500 then
|
||||
amount = 500
|
||||
end
|
||||
amount = math_random(math_floor(amount * 0.7), math_floor(amount * 1.3))
|
||||
if amount < 1 then
|
||||
amount = 1
|
||||
end
|
||||
return amount
|
||||
end
|
||||
|
||||
local function get_ore_amount(surface_index)
|
||||
local d = DungeonsTable.get_dungeontable()
|
||||
@ -440,7 +428,7 @@ function Public.rocky_loot(event)
|
||||
end
|
||||
local player = game.players[event.player_index]
|
||||
local amount = math.ceil(get_ore_amount(player.surface.index))
|
||||
local rock_mining = {}
|
||||
local rock_mining
|
||||
local floor = player.surface.index - DungeonsTable.get_dungeontable().original_surface_index;
|
||||
if floor < 10 then
|
||||
-- early game science uses less copper and more iron/stone
|
||||
|
@ -75,12 +75,12 @@ function Fixed.Init()
|
||||
end
|
||||
end
|
||||
|
||||
local function get_surface_research(index)
|
||||
local function get_surface_research(index)
|
||||
return locked_researches[floor_num(index)]
|
||||
end
|
||||
|
||||
function Fixed.techs_remain(index)
|
||||
local tech = get_surface_research(index)
|
||||
local tech = get_surface_research(index)
|
||||
if tech and game.forces.player.technologies[tech].enabled == false then
|
||||
return 1
|
||||
end
|
||||
@ -104,6 +104,11 @@ function Fixed.room_is_lab(index)
|
||||
return tech and game.forces.player.technologies[tech].enabled == false
|
||||
end
|
||||
|
||||
function Fixed.noop()
|
||||
end
|
||||
|
||||
Fixed.noop() -- eliminate luacheck warning
|
||||
|
||||
-- Variant 2, all research needs unlocking, several can be found on each floor
|
||||
-- and the research is semi-randomly distributed. Research packs occur at the
|
||||
-- first half of the ranges.
|
||||
@ -357,7 +362,7 @@ function Variable.calculate_distribution()
|
||||
table.shuffle_table(all_research)
|
||||
local technologies = game.forces.player.technologies
|
||||
for i = 1, #all_research do
|
||||
v = all_research[i]
|
||||
local v = all_research[i]
|
||||
local floor1 = math.random(v.min, v.max)
|
||||
local floor2 = math.random(v.min, v.max)
|
||||
local res1 = get_research_by_floor(floor1)
|
||||
@ -505,4 +510,9 @@ function Variable.room_is_lab(index)
|
||||
return rooms_opened(index) >= res[1].room
|
||||
end
|
||||
|
||||
function Variable.noop()
|
||||
end
|
||||
Variable.noop() -- eliminate luacheck warning if return Fixed is used
|
||||
|
||||
-- return Fixed
|
||||
return Variable
|
||||
|
@ -56,11 +56,11 @@ local disabled_for_deconstruction = {
|
||||
}
|
||||
|
||||
local function enable_hard_rooms(position, surface_index)
|
||||
dungeon_table = DungeonsTable.get_dungeontable()
|
||||
floor = surface_index - dungeon_table.original_surface_index
|
||||
local dungeon_table = DungeonsTable.get_dungeontable()
|
||||
local floor = surface_index - dungeon_table.original_surface_index
|
||||
-- can make it out to ~200 before hitting the "must explore more" limit
|
||||
-- 140 puts hard rooms halfway between the only dirtlands and the edge
|
||||
floor_mindist = 140 - floor * 10
|
||||
local floor_mindist = 140 - floor * 10
|
||||
if floor_mindist < 80 then -- all dirtlands within this
|
||||
return true
|
||||
end
|
||||
|
@ -1,5 +1,4 @@
|
||||
local Event = require 'utils.event'
|
||||
local Global = require 'utils.global'
|
||||
local Tabs = require 'comfy_panel.main'
|
||||
local SpamProtection = require 'utils.spam_protection'
|
||||
local Token = require 'utils.token'
|
||||
|
@ -88,8 +88,8 @@ local function change_to_ranged(player)
|
||||
if main_inv == nil or gun_inv == nil or ammo_inv == nil then
|
||||
return false
|
||||
end
|
||||
local gun_moved = try_move_from_main(main_inv, gun_inv, moved.gun)
|
||||
local ammo_moved = try_move_from_main(main_inv, ammo_inv, moved.ammo)
|
||||
try_move_from_main(main_inv, gun_inv, moved.gun)
|
||||
try_move_from_main(main_inv, ammo_inv, moved.ammo)
|
||||
state[player.index] = {}
|
||||
return true
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user