mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-25 10:52:25 +01:00
adjust tooltip generation - use even numbers of 5
This commit is contained in:
parent
850edb564d
commit
5e77c90bb7
@ -15,10 +15,14 @@ local function time_string(dur)
|
||||
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
|
||||
end
|
||||
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
|
||||
return math.floor((num-1.0)*100 + 0.1).."%"
|
||||
return out.."%"
|
||||
else
|
||||
return "+"..math.floor((num-1.0)*100 + 0.1).."%"
|
||||
return "+"..out.."%"
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user