Show EU power values more readable (#424)

Add the EU_string helper function
In comparison to pretty_num it uses SI prefixes, adds "EU" (e.g. kEU) and rounds the number for readability
Add a constant_digit_count boolean setting
This commit is contained in:
HybridDog
2018-07-16 17:26:39 +02:00
committed by SmallJoker
parent 6af0376c23
commit 41f175986d
9 changed files with 72 additions and 30 deletions

View File

@ -35,7 +35,8 @@ local run = function(pos, node)
local charge_to_give = math.floor((light + pos1.y) * 3)
charge_to_give = math.max(charge_to_give, 0)
charge_to_give = math.min(charge_to_give, 200)
meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give)))
meta:set_string("infotext", S("@1 Active (@2)", machine_name,
technic.EU_string(charge_to_give)))
meta:set_int("LV_EU_supply", charge_to_give)
else
meta:set_string("infotext", S("%s Idle"):format(machine_name))
@ -54,7 +55,7 @@ minetest.register_node("technic:solar_panel", {
active = false,
drawtype = "nodebox",
paramtype = "light",
is_ground_content = true,
is_ground_content = true,
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},