mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
adjust tooltip generation - use even numbers of 5
This commit is contained in:
parent
850edb564d
commit
5e77c90bb7
1 changed files with 6 additions and 2 deletions
|
@ -15,10 +15,14 @@ local function time_string(dur)
|
||||||
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
|
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
|
||||||
end
|
end
|
||||||
local function perc_string(num)
|
local function perc_string(num)
|
||||||
|
|
||||||
|
local rem = math.floor((num-1.0)*100 + 0.1) % 5
|
||||||
|
local out = math.floor((num-1.0)*100 + 0.1) - rem
|
||||||
|
|
||||||
if (num - 1.0) < 0 then
|
if (num - 1.0) < 0 then
|
||||||
return math.floor((num-1.0)*100 + 0.1).."%"
|
return out.."%"
|
||||||
else
|
else
|
||||||
return "+"..math.floor((num-1.0)*100 + 0.1).."%"
|
return "+"..out.."%"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue