Skip to content

Commit

Permalink
Production GUI 1dp (#333)
Browse files Browse the repository at this point in the history
* Update production.lua

* Update production.lua

* Removed repetitive call to string format

---------

Co-authored-by: Cooldude2606 <[email protected]>
  • Loading branch information
PHIDIAS0303 and Cooldude2606 authored Oct 20, 2024
1 parent 2f13aa7 commit 16813dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/gui/production.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 16813dc

Please sign in to comment.