Black Market 2

by djmango

Sell and buy items/fluids/energy on the black market using trading chests/tanks/accumulators, choosing the frequency of exchanges and related fees. You can now sell your overproduction and buy things that you don't want to craft by yourself. You can also use these trading units as a paying shipment system.

a month ago
0.17 - 2.0
21.3K

i Format Money value - here is what I did

5 months ago

I added a bunch of formatting - way more than the numbers can hold I think.

But in control.lua line 27 - function format_money()

I changed it to be:
"
function format_money(n)
if n == nil then return "0u" end

local suffixes = {
    [93] = "Tg",
    [90] = "NVg",
    [87] = "OVg",
    [84] = "SpVg",
    [81] = "SxVg",
    [78] = "QiVg",
    [75] = "QaVg",
    [72] = "TVg",
    [69] = "DVg",
    [66] = "UVg",
    [63] = "Vg",
    [60] = "NmDc",
    [57] = "OcDc",
    [54] = "SpDc",
    [51] = "SxDc",
    [48] = "QiDc",
    [45] = "QaDc",
    [42] = "TDc",
    [39] = "DDc",
    [36] = "UDc",
    [33] = "Dc",
    [30] = "No",
    [27] = "Oc",
    [24] = "Sp",
    [21] = "Sx",
    [18] = "Qi",
    [15] = "Qa",
    [12] = "T",
    [9] = "B",
    [6] = "M",
    [3] = "K",
    [0] = ""
}

local abs_n = math.abs(n)
local suffix = ""
local factor = 1

for exp = 93, 0, -3 do
    if abs_n >= 10^exp then
        suffix = suffixes[exp] .. "u"
        factor = 10^exp
        break
    end
end

local formatted_number = string.format("%.3f", n / factor)

if n < 0 then
    formatted_number = formatted_number
end

return formatted_number .. suffix

end
"

2 months ago

This is great! Could you submit this as a PR

2 months ago

There, I should have created the PR on github

a month ago

Merged and released!

New response