I've addes the option to show the item values in shortend string versions like factorio to avoid string clipping on small icon sizes. 10000 -> 10k and on mousover show the exaxt value with a 1000 . tunctation -> 10.125 for example.
https://paste.pics/OW9W2 - Shortend version with tooltip
https://paste.pics/OW9V8 - Settings
https://paste.pics/OW9YE - Without shortend string
Added This to the control.lua:
function short_number(number)
if number == nil then return 0
elseif number <= 999 then return number
elseif number <= 9999 then return string.format("%.1fk", math.floor(number / 100)/10)
elseif number >= 1e12 then return string.format("%.0ft", math.floor(number / 1e12))
elseif number >= 1e9 then return string.format("%.0fg", math.floor(number / 1e9))
elseif number >= 1e6 then return string.format("%.0fm", math.floor(number / 1e6))
elseif number >= 1e3 then return string.format("%.0fk", math.floor(number / 1e3))
end
end
function comma_value(n) -- credit http://richard.warburton.it
local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
return left..(num:reverse():gsub('(%d%d%d)','%1.'):reverse())..right
end
and replaced this on the end of function update_gui(player) in control.lua
local count = frame.add{type="label", caption=data['amount']}
count.style.horizontal_align = 'center'
With:
local itemAmount = data['amount']
local count = frame.add{type="label"}
count.style.horizontal_align = 'center'
if player.mod_settings["QuantumResourceDistribution_raw_value"].value then
count.caption=itemAmount
else
count.caption=short_number(itemAmount)
count.tooltip=comma_value(itemAmount)
end
for the fluid:
local fluidAmount = math.floor(tonumber(data['amount']))
local count = frame.add{type="label"}
count.style.horizontal_align = 'center'
if player.mod_settings["QuantumResourceDistribution_raw_value"].value then
count.caption=fluidAmount
else
count.caption=short_number(fluidAmount)
count.tooltip=comma_value(fluidAmount)
end
and added to the settings.lua
data:extend({
{
type = "bool-setting",
name = "QuantumResourceDistribution_raw_value",
setting_type = "runtime-per-user",
default_value = true,
order = "3"
}
})
greetings