1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00

Added more loops in mutagen log for easier reading

This commit is contained in:
Masamune 2020-02-01 10:30:07 +01:00
parent 7f9f0a560c
commit 5b38d03780
3 changed files with 49 additions and 94 deletions

View File

@ -109,19 +109,11 @@ local function add_stats(player, food, flask_amount,biter_force_name,evo_before_
if global.science_logs_total_north == nil then if global.science_logs_total_north == nil then
global.science_logs_total_north = { 0 } global.science_logs_total_north = { 0 }
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
global.science_logs_total_south = { 0 } global.science_logs_total_south = { 0 }
table.insert(global.science_logs_total_south, 0) for a = 1, flask_amount, 7 do
table.insert(global.science_logs_total_south, 0) table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_south, 0) table.insert(global.science_logs_total_south, 0)
table.insert(global.science_logs_total_south, 0) end
table.insert(global.science_logs_total_south, 0)
table.insert(global.science_logs_total_south, 0)
end end
local total_science_of_player_force = nil local total_science_of_player_force = nil

View File

@ -9,6 +9,12 @@ local dropdown_users_choice_force = {}
local dropdown_users_choice_science = {} local dropdown_users_choice_science = {}
local dropdown_users_choice_evo_filter = {} local dropdown_users_choice_evo_filter = {}
local frame_sciencelogs = nil local frame_sciencelogs = nil
local food_long_and_short = tables.food_long_and_short
local food_long_to_short = tables.food_long_to_short
local forces_list = tables.forces_list
local science_list = tables.science_list
local evofilter_list = tables.evofilter_list
local food_value_table_version = tables.food_value_table_version
local function get_science_text(food_name,food_short_name) local function get_science_text(food_name,food_short_name)
return table.concat({"[img=item/", food_name, "][color=",food_values[food_name].color, "]", food_short_name, "[/color]"}) return table.concat({"[img=item/", food_name, "][color=",food_values[food_name].color, "]", food_short_name, "[/color]"})
@ -19,36 +25,18 @@ local function add_science_logs(player, element)
science_scrollpanel.style.maximal_height = 530 science_scrollpanel.style.maximal_height = 530
if global.science_logs_category_potion == nil then if global.science_logs_category_potion == nil then
local science_text = get_science_text("automation-science-pack","automation") global.science_logs_category_potion = { }
global.science_logs_category_potion = { science_text } for i = 1, 7 do
science_text = get_science_text("logistic-science-pack", "logistic") table.insert(global.science_logs_category_potion, get_science_text(food_long_and_short[i].long_name, food_long_and_short[i].short_name))
table.insert(global.science_logs_category_potion, science_text) end
science_text = get_science_text("military-science-pack","military")
table.insert(global.science_logs_category_potion, science_text)
science_text = get_science_text("chemical-science-pack","chemical")
table.insert(global.science_logs_category_potion, science_text)
science_text = get_science_text("production-science-pack","production")
table.insert(global.science_logs_category_potion, science_text)
science_text = get_science_text("utility-science-pack","utility")
table.insert(global.science_logs_category_potion, science_text)
science_text = get_science_text("space-science-pack","space")
table.insert(global.science_logs_category_potion, science_text)
end end
if global.science_logs_total_north == nil then if global.science_logs_total_north == nil then
global.science_logs_total_north = { 0 } global.science_logs_total_north = { 0 }
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_north, 0)
global.science_logs_total_south = { 0 } global.science_logs_total_south = { 0 }
table.insert(global.science_logs_total_south, 0) for i = 1, 7 do
table.insert(global.science_logs_total_south, 0) table.insert(global.science_logs_total_north, 0)
table.insert(global.science_logs_total_south, 0) table.insert(global.science_logs_total_south, 0)
table.insert(global.science_logs_total_south, 0) end
table.insert(global.science_logs_total_south, 0)
table.insert(global.science_logs_total_south, 0)
end end
local t_summary = science_scrollpanel.add { type = "table", name = "science_logs_summary_header_table", column_count = 8 } local t_summary = science_scrollpanel.add { type = "table", name = "science_logs_summary_header_table", column_count = 8 }
@ -66,26 +54,16 @@ local function add_science_logs(player, element)
[8] = global.science_logs_category_potion[7] [8] = global.science_logs_category_potion[7]
} }
for _, w in ipairs(column_widths) do for _, w in ipairs(column_widths) do
local label = t_summary.add { type = "label", caption = headersSummary[_] } local label = t_summary.add { type = "label", caption = headersSummary[_] }
label.style.minimal_width = w label.style.minimal_width = w
label.style.maximal_width = w label.style.maximal_width = w
--label.style.font = "default-bold"
--label.style.font_color = { r=0.98, g=0.66, b=0.22 }
end end
local food_value_table_version = { food_values["automation-science-pack"].value }
table.insert(food_value_table_version, food_values["logistic-science-pack"].value)
table.insert(food_value_table_version, food_values["military-science-pack"].value)
table.insert(food_value_table_version, food_values["chemical-science-pack"].value)
table.insert(food_value_table_version, food_values["production-science-pack"].value)
table.insert(food_value_table_version, food_values["utility-science-pack"].value)
table.insert(food_value_table_version, food_values["space-science-pack"].value)
summary_panel_table = science_scrollpanel.add { type = "table", column_count = 8 } summary_panel_table = science_scrollpanel.add { type = "table", column_count = 8 }
local label = summary_panel_table.add { type = "label", name = "science_logs_total_north_header", caption = "Total sent by north" } local label = summary_panel_table.add { type = "label", name = "science_logs_total_north_header", caption = "Total sent by north" }
label.style.minimal_width = width_summary_first_column label.style.minimal_width = width_summary_first_column
label.style.maximal_width = width_summary_first_column label.style.maximal_width = width_summary_first_column
for i = 1, 7, 1 do for i = 1, 7 do
local label = summary_panel_table.add { type = "label", name = "science_logs_total_north_" .. i, caption = global.science_logs_total_north[i] } local label = summary_panel_table.add { type = "label", name = "science_logs_total_north_" .. i, caption = global.science_logs_total_north[i] }
label.style.minimal_width = width_summary_columns label.style.minimal_width = width_summary_columns
label.style.maximal_width = width_summary_columns label.style.maximal_width = width_summary_columns
@ -96,7 +74,7 @@ local function add_science_logs(player, element)
local label = summary_panel_table2.add { type = "label", name = "science_logs_total_south_header", caption = "Total sent by south" } local label = summary_panel_table2.add { type = "label", name = "science_logs_total_south_header", caption = "Total sent by south" }
label.style.minimal_width = width_summary_first_column label.style.minimal_width = width_summary_first_column
label.style.maximal_width = width_summary_first_column label.style.maximal_width = width_summary_first_column
for i = 1, 7, 1 do for i = 1, 7 do
local label = summary_panel_table2.add { type = "label", name = "science_logs_total_south" .. i, caption = global.science_logs_total_south[i] } local label = summary_panel_table2.add { type = "label", name = "science_logs_total_south" .. i, caption = global.science_logs_total_south[i] }
label.style.minimal_width = width_summary_columns label.style.minimal_width = width_summary_columns
label.style.maximal_width = width_summary_columns label.style.maximal_width = width_summary_columns
@ -107,7 +85,7 @@ local function add_science_logs(player, element)
local label = summary_panel_table3.add { type = "label", name = "science_logs_total_passive_feed_header", caption = "Total passive feed" } local label = summary_panel_table3.add { type = "label", name = "science_logs_total_passive_feed_header", caption = "Total passive feed" }
label.style.minimal_width = width_summary_first_column label.style.minimal_width = width_summary_first_column
label.style.maximal_width = width_summary_first_column label.style.maximal_width = width_summary_first_column
for i = 1, 7, 1 do for i = 1, 7 do
local text_passive_feed = "0" local text_passive_feed = "0"
if global.total_passive_feed_redpotion ~= nil then if global.total_passive_feed_redpotion ~= nil then
text_passive_feed = math.round(global.total_passive_feed_redpotion * food_value_table_version[1] / food_value_table_version[i],1) text_passive_feed = math.round(global.total_passive_feed_redpotion * food_value_table_version[1] / food_value_table_version[i],1)
@ -117,31 +95,7 @@ local function add_science_logs(player, element)
label.style.maximal_width = width_summary_columns label.style.maximal_width = width_summary_columns
end end
science_scrollpanel.add({type = "line"}) science_scrollpanel.add({type = "line"})
-- science_scrollpanel.add { type = "label", name = "whitespace1", caption = " " }
local forces_list = { "all teams" }
table.insert(forces_list, "north")
table.insert(forces_list, "south")
local science_list = { "all science" }
table.insert(science_list, "very high tier (space, utility, production)")
table.insert(science_list, " high tier (space, utility, production, chemical)")
table.insert(science_list, " mid+ tier (space, utility, production, chemical, military)")
table.insert(science_list, "space")
table.insert(science_list, "utility")
table.insert(science_list, "production")
table.insert(science_list, "chemical")
table.insert(science_list, "military")
table.insert(science_list, "logistic")
table.insert(science_list, "automation")
local evofilter_list = { "all evo jump" }
table.insert(evofilter_list, "no 0 evo jump")
table.insert(evofilter_list, "10+ only")
table.insert(evofilter_list, "5+ only")
table.insert(evofilter_list, "4+ only")
table.insert(evofilter_list, "3+ only")
table.insert(evofilter_list, "2+ only")
table.insert(evofilter_list, "1+ only")
if dropdown_users_choice_force[player.name] == nil then if dropdown_users_choice_force[player.name] == nil then
dropdown_users_choice_force[player.name] = 1 dropdown_users_choice_force[player.name] = 1
end end
@ -189,23 +143,8 @@ local function add_science_logs(player, element)
for i = 1, #global.science_logs_date, 1 do for i = 1, #global.science_logs_date, 1 do
local real_force_name = global.science_logs_fed_team[i] local real_force_name = global.science_logs_fed_team[i]
local custom_force_name = team_strings[real_force_name]; local custom_force_name = team_strings[real_force_name];
local easy_food_name = "" local easy_food_name = food_long_to_short[global.science_logs_food_name[i]].short_name
if global.science_logs_food_name[i] == "automation-science-pack" then
easy_food_name = "automation"
elseif global.science_logs_food_name[i] == "logistic-science-pack" then
easy_food_name = "logistic"
elseif global.science_logs_food_name[i] == "military-science-pack" then
easy_food_name = "military"
elseif global.science_logs_food_name[i] == "chemical-science-pack" then
easy_food_name = "chemical"
elseif global.science_logs_food_name[i] == "production-science-pack" then
easy_food_name = "production"
elseif global.science_logs_food_name[i] == "utility-science-pack" then
easy_food_name = "utility"
elseif global.science_logs_food_name[i] == "space-science-pack" then
easy_food_name = "space"
end
if dropdown_force.selected_index == 1 or real_force_name:match(dropdown_force.get_item(dropdown_force.selected_index)) then if dropdown_force.selected_index == 1 or real_force_name:match(dropdown_force.get_item(dropdown_force.selected_index)) then
if dropdown_science.selected_index == 1 if dropdown_science.selected_index == 1
or (dropdown_science.selected_index == 2 and (easy_food_name:match("space") or easy_food_name:match("utility") or easy_food_name:match("production"))) or (dropdown_science.selected_index == 2 and (easy_food_name:match("space") or easy_food_name:match("utility") or easy_food_name:match("production")))

View File

@ -46,4 +46,28 @@ Public.food_names = {
["space-science-pack"] = true ["space-science-pack"] = true
} }
Public.food_long_and_short = {
[1] = {short_name= "automation", long_name = "automation-science-pack"},
[2] = {short_name= "logistic", long_name = "logistic-science-pack"},
[3] = {short_name= "military", long_name = "military-science-pack"},
[4] = {short_name= "chemical", long_name = "chemical-science-pack"},
[5] = {short_name= "production", long_name = "production-science-pack"},
[6] = {short_name= "utility", long_name = "utility-science-pack"},
[7] = {short_name= "space", long_name = "space-science-pack"}
}
Public.food_long_to_short = {
["automation-science-pack"] = {short_name= "automation"},
["logistic-science-pack"] = {short_name= "logistic"},
["military-science-pack"] = {short_name= "military"},
["chemical-science-pack"] = {short_name= "chemical"},
["production-science-pack"] = {short_name= "production"},
["utility-science-pack"] = {short_name= "utility"},
["space-science-pack"] = {short_name= "space"}
}
Public.forces_list = { "all teams", "north", "south" }
Public.science_list = { "all science", "very high tier (space, utility, production)", "high tier (space, utility, production, chemical)", "mid+ tier (space, utility, production, chemical, military)","space","utility","production","chemical","military", "logistic", "automation" }
Public.evofilter_list = { "all evo jump", "no 0 evo jump", "10+ only","5+ only","4+ only","3+ only","2+ only","1+ only" }
Public.food_value_table_version = { Public.food_values["automation-science-pack"].value, Public.food_values["logistic-science-pack"].value, Public.food_values["military-science-pack"].value, Public.food_values["chemical-science-pack"].value, Public.food_values["production-science-pack"].value, Public.food_values["utility-science-pack"].value, Public.food_values["space-science-pack"].value}
return Public return Public