From 16813dca40136875712b929a4cfda3cd80843ebe Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 20 Oct 2024 23:57:12 +0900 Subject: [PATCH] Production GUI 1dp (#333) * Update production.lua * Update production.lua * Removed repetitive call to string format --------- Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> --- modules/gui/production.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/gui/production.lua b/modules/gui/production.lua index 4eaf307cd0..ce9ead41c7 100644 --- a/modules/gui/production.lua +++ b/modules/gui/production.lua @@ -23,7 +23,7 @@ local font_color = { } local function format_n(n) - local _i, _j, m, i, f = tostring(n):find('([-]?)(%d+)([.]?%d*)') + local _i, _j, m, i, f = string.format('%.1f', n):find('([-]?)(%d+)([.]?%d*)') i = i:reverse():gsub('(%d%d%d)', '%1,') if f ~= '' then @@ -139,8 +139,8 @@ Event.on_nth_tick(60, function() local item = table[production_prefix .. '_e'].elem_value if item then - local add = math.floor(stat.get_flow_count{name=item, input=true, precision_index=precision_value, count=false} / 6) / 10 - local minus = math.floor(stat.get_flow_count{name=item, input=false, precision_index=precision_value, count=false} / 6) / 10 + local add = stat.get_flow_count{name=item, input=true, precision_index=precision_value, count=false} / 60 + local minus = stat.get_flow_count{name=item, input=false, precision_index=precision_value, count=false} / 60 local sum = add - minus table[production_prefix .. '_1'].caption = format_n(add)