Skip to content

Commit

Permalink
Format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Feb 8, 2025
1 parent 5da8620 commit fec94a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions data/pigui/libs/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ ui.Format = {
end,
Speed = function(distance, fractional)
local s, u = ui.Format.SpeedUnit(distance, fractional)
return s .. u
return s .. " " .. u
end,
MassUnit = function(mass, digits)
local m = math.abs(mass)
Expand All @@ -291,7 +291,7 @@ ui.Format = {
end,
Mass = function(mass, digits)
local m, u = ui.Format.MassUnit(mass, digits)
return m .. u
return m .. " " .. u
end,
Money = Format.Money,
Date = Format.Date,
Expand All @@ -300,7 +300,7 @@ ui.Format = {
return string.format("%4i-%02i-%02i %02i:%02i:%02i", year, month, day, hour, minute, second)
end,
Gravity = function(grav)
return string.format("%0.2f", grav) .. lc.UNIT_EARTH_GRAVITY
return string.format("%0.2f", grav) .. " " .. lc.UNIT_EARTH_GRAVITY
end,
Pressure = function(pres)
return string.format("%0.2f", pres) .. lc.UNIT_PRESSURE_ATMOSPHERES
Expand All @@ -311,9 +311,9 @@ ui.Format = {
number = math.abs(number)
local fmt = "%." .. (places or '2') .. "f%s"
if number < 1e3 then return s .. fmt:format(number, "")
elseif number < 1e6 then return s .. fmt:format(number / 1e3, "k")
elseif number < 1e9 then return s .. fmt:format(number / 1e6, "mil")
elseif number < 1e12 then return s .. fmt:format(number / 1e9, "bil")
elseif number < 1e6 then return s .. fmt:format(number / 1e3, " k")
elseif number < 1e9 then return s .. fmt:format(number / 1e6, " mil")
elseif number < 1e12 then return s .. fmt:format(number / 1e9, " bil")
else return s .. fmt:format(number / 1e12, "trn") end
end,
-- write the entire number using thousands-place grouping
Expand Down
2 changes: 1 addition & 1 deletion data/pigui/modules/system-view-ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ function Windows.objectInfo:Show()
{ name = lc.ESCAPE_VELOCITY, icon = icons.body_radius,
value = (not starport) and ui.Format.Speed(body.escapeVelocity , true) or nil },
{ name = lc.MEAN_DENSITY, icon = icons.body_radius,
value = (not starport) and ui.Format.Mass(body.meanDensity).."/m3" or nil },
value = (not starport) and ui.Format.Mass(body.meanDensity).."/" or nil },
{ name = lc.ORBITAL_PERIOD, icon = icons.body_orbit_period,
value = op and op > 0 and ui.Format.Duration(op, 2) or nil },
{ name = lc.DAY_LENGTH, icon = icons.body_day_length,
Expand Down

0 comments on commit fec94a1

Please sign in to comment.