1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-30 04:40:54 +02:00

fish v2 - fixes

This commit is contained in:
Gerkiz 2021-12-10 22:47:16 +01:00
parent 9772db468f
commit 392d023091
2 changed files with 34 additions and 29 deletions

View File

@ -731,39 +731,44 @@ local function get_sorted_list(column_name, score_list)
end
local function get_mvps()
local get_score = Score.get_table().score_table
if not get_score['player'] then
local get_score = Score.get_table()
local score_table = get_score.score_table
if not score_table['player'] then
return false
end
local score = get_score['player']
local score = score_table['player']
local score_list = {}
for _, p in pairs(game.players) do
local killscore = 0
if score.players[p.name].killscore then
killscore = score.players[p.name].killscore
if p and p.valid then
local killscore = 0
if score and score.players[p.name] then
if score.players[p.name].killscore then
killscore = score.players[p.name].killscore
end
local deaths = 0
if score.players[p.name].deaths then
deaths = score.players[p.name].deaths
end
local built_entities = 0
if score.players[p.name].built_entities then
built_entities = score.players[p.name].built_entities
end
local mined_entities = 0
if score.players[p.name].mined_entities then
mined_entities = score.players[p.name].mined_entities
end
table.insert(
score_list,
{
name = p.name,
killscore = killscore,
deaths = deaths,
built_entities = built_entities,
mined_entities = mined_entities
}
)
end
end
local deaths = 0
if score.players[p.name].deaths then
deaths = score.players[p.name].deaths
end
local built_entities = 0
if score.players[p.name].built_entities then
built_entities = score.players[p.name].built_entities
end
local mined_entities = 0
if score.players[p.name].mined_entities then
mined_entities = score.players[p.name].mined_entities
end
table.insert(
score_list,
{
name = p.name,
killscore = killscore,
deaths = deaths,
built_entities = built_entities,
mined_entities = mined_entities
}
)
end
local mvp = {}
score_list = get_sorted_list('killscore', score_list)

View File

@ -101,7 +101,7 @@ function Public.get_replacement_tile(surface, position)
shuffle(vectors)
for k, v in pairs(vectors) do
local tile = surface.get_tile(position.x + v[1], position.y + v[2])
if not tile.collides_with('resource-layer') then
if tile and not tile.collides_with('resource-layer') then
return tile.name
end
end