1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-11 14:49:24 +02:00

Show player numbers in scoreboard instead of info section

This commit is contained in:
blubFisch 2022-09-28 10:27:58 +01:00
parent fe5824af78
commit c7ea88d6db
2 changed files with 21 additions and 20 deletions

View File

@ -132,7 +132,7 @@ local function update_score()
information_table.style.margin = 4
information_table.style.column_alignments[3] = 'right'
for _, caption in pairs({'Rank', 'Town', 'Survival time'}) do
for _, caption in pairs({'Rank', 'Town (players online/total)', 'Survival time'}) do
local label = information_table.add {type = 'label', caption = caption}
label.style.font = 'default-bold'
end
@ -142,7 +142,6 @@ local function update_score()
if town_center ~= nil then
local age = game.tick - town_center.creation_tick
town_ages[town_center] = age
-- log('XDB age ' .. town_center.town_name .. ': ' .. age)
end
end
@ -154,13 +153,14 @@ local function update_score()
return t[b] < t[a]
end
) do
-- log('XDB age sorted ' .. town_center.town_name .. ' ' .. age)
local position = information_table.add {type = 'label', caption = '#' .. rank}
if town_center == ffatable.town_centers[player.force.name] then
position.style.font = 'default-semibold'
position.style.font_color = {r = 1, g = 1}
end
local label = information_table.add {type = 'label', caption = town_center.town_name}
local label = information_table.add {type = 'label', caption = town_center.town_name ..
" (" .. #town_center.market.force.connected_players ..
"/" .. #town_center.market.force.players..")"}
label.style.font = 'default-semibold'
label.style.font_color = town_center.color
local age_hours = age / 60 / 3600
@ -168,6 +168,17 @@ local function update_score()
rank = rank + 1
end
-- Outlander section
information_table.add {type = 'label', caption = '-'}
local outlander_on = #game.forces["player"].connected_players + #game.forces["rogue"].connected_players
local outlander_total = #game.forces["player"].players + #game.forces["rogue"].players
local label = information_table.add {type = 'label', caption = 'Outlanders' .. " (" .. outlander_on ..
"/" .. outlander_total ..")"}
label.style.font_color = {170, 170, 170}
information_table.add {type = 'label', caption = '-'}
end
end
end

View File

@ -4,7 +4,11 @@ local Table = require 'modules.scrap_towny_ffa.table'
local info = [[You wake up on this god-forsaken planet with a bunch of other desolate fools. Who will survive?
You better found a town and start producing and defending yourself!
You can either
- Found a new town or join an existing one
- Stay as an Outlander and fight towns side-by-side with the biters
Click on the "Info" button for full intro/help.
Have fun and be comfy ^.^
]]
@ -68,25 +72,11 @@ function Public.show(player, info_type)
local t = frame.add {type = 'table', column_count = 2}
local label = t.add {type = 'label', caption = 'Active Factions:'}
local label = t.add {type = 'label', caption = 'COMFY Towny: Wasteland survival'}
label.style.font = 'heading-1'
label.style.font_color = {r = 0.85, g = 0.85, b = 0.85}
label.style.right_padding = 8
t = t.add {type = 'table', column_count = 4}
local label2 = t.add {type = 'label', caption = 'Outlander' .. ':' .. #game.forces.player.connected_players .. ' '}
label2.style.font_color = {170, 170, 170}
label2.style.font = 'heading-3'
label2.style.minimal_width = 80
for _, town_center in pairs(ffatable.town_centers) do
local force = town_center.market.force
local label3 = t.add {type = 'label', caption = force.name .. ':' .. #force.connected_players .. ' '}
label3.style.font = 'heading-3'
label3.style.minimal_width = 80
label3.style.font_color = town_center.color
end
frame.add {type = 'line'}
local cap = info