1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-09 13:37:02 +02:00

WIP science logs

This commit is contained in:
Masamune 2019-12-30 20:01:08 +01:00
parent 018e4bcb7f
commit 16d60dc211
2 changed files with 52 additions and 51 deletions

View File

@ -76,6 +76,8 @@ function add_stats(player, food, flask_amount,biter_force_name,evo_before_scienc
local formatted_amount = table.concat({"[font=heading-1][color=255,255,255]" .. flask_amount .. "[/color][/font]"})
local n = bb_config.north_side_team_name
local s = bb_config.south_side_team_name
if global.tm_custom_name["north"] then n = global.tm_custom_name["north"] end
if global.tm_custom_name["south"] then s = global.tm_custom_name["south"] end
local team_strings = {
["north"] = table.concat({"[color=120, 120, 255]", n, "'s[/color]"}),
["south"] = table.concat({"[color=255, 65, 65]", s, "'s[/color]"})
@ -111,7 +113,7 @@ function add_stats(player, food, flask_amount,biter_force_name,evo_before_scienc
local formatted_threat_after_feed = math.round(global.bb_threat[biter_force_name],0)
local evo_jump = table.concat({evo_before_science_feed .. " to " .. formatted_evo_after_feed})
local threat_jump = table.concat({threat_before_science_feed .. " to ".. formatted_threat_after_feed})
local line_log_stats_to_add = table.concat({ formatted_amount .. " " .. formatted_food .. " by " .. colored_player_name .. " to " .. team_strings[get_enemy_team_of(player.force.name)]})
local line_log_stats_to_add = table.concat({ formatted_amount .. " " .. formatted_food .. " by " .. colored_player_name .. " to " .. team_strings[get_enemy_team_of(player.force.name)] .. " biters"})
if global.science_logs_text then
table.insert(global.science_logs_date, formatted_feed_time)

View File

@ -236,57 +236,57 @@ local function draw_stats_gui(player)
local frame = player.gui.center.add({type = "frame", name = "stats_gui", caption = "Science logs", direction = "vertical"})
local t = frame.add({type = "table", name = "stats_root_table", column_count = 4})
local t = frame.add { type = "table", name = "science_logs_header_table", column_count = 4 }
local column_widths = {tonumber(150), tonumber(400), tonumber(150), tonumber(150)}
for _, w in ipairs(column_widths) do
local label = t.add { type = "label", caption = "" }
label.style.minimal_width = w
label.style.maximal_width = w
end
local l = t.add({type = "sprite-button", caption = "Date", "Date"})
l.style.minimal_width = 160
l.style.maximal_width = 160
l.style.font_color = {r = 0.88, g = 0.55, b = 0.11}
l.style.font = "heading-1"
local headers = {
[1] = "Date",
[2] = "Science details",
[3] = "Evo jump",
[4] = "Threat jump",
}
local l = t.add({type = "sprite-button", caption = "Science details", "Science details"})
l.style.minimal_width = 160
l.style.maximal_width = 160
l.style.font_color = {r = 0.88, g = 0.55, b = 0.11}
l.style.font = "heading-1"
for k, v in ipairs(headers) do
local label = t.add {
type = "label",
name = "science_logs_panel_header_" .. k,
caption = v
}
label.style.font = "default-bold"
label.style.font_color = { r=0.98, g=0.66, b=0.22 }
end
local l = t.add({type = "sprite-button", caption = "Evo jump", "Evo jump"})
l.style.minimal_width = 160
l.style.maximal_width = 160
l.style.font_color = {r = 0.88, g = 0.55, b = 0.11}
l.style.font = "heading-1"
local l = t.add({type = "sprite-button", caption = "Threat jump", "Threat jump"})
l.style.minimal_width = 160
l.style.maximal_width = 160
l.style.font_color = {r = 0.88, g = 0.55, b = 0.11}
l.style.font = "heading-1"
-- special style on first header
local label = t["science_logs_panel_header_1"]
label.style.minimal_width = 36
label.style.maximal_width = 36
label.style.horizontal_align = "right"
-- List management
local science_panel_table = frame.add { type = "scroll-pane", name = "scroll_pane", direction = "vertical", horizontal_scroll_policy = "never", vertical_scroll_policy = "auto"}
science_panel_table.style.maximal_height = 530
science_panel_table = science_panel_table.add { type = "table", name = "science_panel_table", column_count = 4 }
if global.science_logs_date then
local list_box = t.add({type = "list-box", name = "stats_list_box_" .. 1, items = global.science_logs_date})
list_box.style.minimal_height = 360
list_box.style.minimal_width = 160
list_box.style.maximal_height = 480
for i = 1, #global.science_logs_date, 1 do
local label = science_panel_table.add { type = "label", name = "science_logs_date" .. i, caption = global.science_logs_date[i] }
label.style.minimal_width = column_widths[1]
label.style.maximal_width = column_widths[1]
local label = science_panel_table.add { type = "label", name = "science_logs_text" .. i, caption = global.science_logs_text[i] }
label.style.minimal_width = column_widths[2]
label.style.maximal_width = column_widths[2]
local label = science_panel_table.add { type = "label", name = "science_logs_evo_jump" .. i, caption = global.science_logs_evo_jump[i] }
label.style.minimal_width = column_widths[3]
label.style.maximal_width = column_widths[3]
local label = science_panel_table.add { type = "label", name = "science_logs_threat" .. i, caption = global.science_logs_threat[i] }
label.style.minimal_width = column_widths[4]
label.style.maximal_width = column_widths[4]
end
if global.science_logs_text then
local list_box = t.add({type = "list-box", name = "stats_list_box_" .. 2, items = global.science_logs_text})
list_box.style.minimal_height = 360
list_box.style.minimal_width = 160
list_box.style.maximal_height = 480
end
if global.science_logs_evo_jump then
local list_box = t.add({type = "list-box", name = "stats_list_box_" .. 3, items = global.science_logs_evo_jump})
list_box.style.minimal_height = 360
list_box.style.minimal_width = 160
list_box.style.maximal_height = 480
end
if global.science_logs_threat then
local list_box = t.add({type = "list-box", name = "stats_list_box_" .. 4, items = global.science_logs_threat})
list_box.style.minimal_height = 360
list_box.style.minimal_width = 160
list_box.style.maximal_height = 480
end
frame.add({type = "label", caption = ""})
@ -298,7 +298,6 @@ local function draw_stats_gui(player)
tooltip = "Close this window."
})
button.style.font = "heading-2"
end
local function stats_gui_click(event)