This commit is contained in:
2025-02-12 22:29:27 +09:00
parent 2ab8a8ae66
commit e759ca3c48

View File

@@ -56,35 +56,17 @@ local production_data_group = Gui.element("production_data_group")
item.style.width = 32 item.style.width = 32
end end
local data_1 = parent.add{ for j = 1, 3 do
type = "label", local data_1 = parent.add{
name = "production_" .. i .. "_1", type = "label",
caption = "0.0", name = "production_" .. i .. "_" .. j,
style = "heading_2_label", caption = "0.0",
} style = "heading_2_label",
data_1.style.width = 90 }
data_1.style.horizontal_align = "right" data_1.style.width = 90
data_1.style.font_color = font_color["positive"] data_1.style.horizontal_align = "right"
data_1.style.font_color = font_color["positive"]
local data_2 = parent.add{ end
type = "label",
name = "production_" .. i .. "_2",
caption = "0.0",
style = "heading_2_label",
}
data_2.style.width = 90
data_2.style.horizontal_align = "right"
data_2.style.font_color = font_color["negative"]
local data_3 = parent.add{
type = "label",
name = "production_" .. i .. "_3",
caption = "0.0",
style = "heading_2_label",
}
data_3.style.width = 90
data_3.style.horizontal_align = "right"
data_3.style.font_color = font_color["positive"]
return item return item
end) end)
@@ -145,16 +127,10 @@ Event.on_nth_tick(60, function()
local add = math.floor(stat.get_flow_count{ name = item, category = "input", precision_index = precision_value, count = false } / 6) / 10 local add = math.floor(stat.get_flow_count{ name = item, category = "input", precision_index = precision_value, count = false } / 6) / 10
local minus = math.floor(stat.get_flow_count{ name = item, category = "output", precision_index = precision_value, count = false } / 6) / 10 local minus = math.floor(stat.get_flow_count{ name = item, category = "output", precision_index = precision_value, count = false } / 6) / 10
local sum = add - minus local sum = add - minus
table[production_prefix .. "_1"].caption = format_n(add) table[production_prefix .. "_1"].caption = format_n(add)
table[production_prefix .. "_2"].caption = format_n(minus) table[production_prefix .. "_2"].caption = format_n(minus)
table[production_prefix .. "_3"].caption = format_n(sum) table[production_prefix .. "_3"].caption = format_n(sum)
table[production_prefix .. "_3"].style.font_color = (sum < 0 and font_color["negative"]) or font_color["positive"]
if sum < 0 then
table[production_prefix .. "_3"].style.font_color = font_color["negative"]
else
table[production_prefix .. "_3"].style.font_color = font_color["positive"]
end
else else
table[production_prefix .. "_1"].caption = "0.0" table[production_prefix .. "_1"].caption = "0.0"
table[production_prefix .. "_2"].caption = "0.0" table[production_prefix .. "_2"].caption = "0.0"