Fix timeer, revert text color to white

This commit is contained in:
Wuzzy 2015-05-27 18:25:09 +02:00
parent c3cd4e8589
commit 2f4c3c85fc
1 changed files with 3 additions and 7 deletions

View File

@ -18,13 +18,11 @@ minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
inventory_icon.hudids[name] = {}
local occupied, size = inventory_icon.get_inventory_state(player)
local icon, color
local icon
if occupied >= size then
icon = "inventory_icon_backpack_full.png"
color = "0xFF0000"
else
icon = "inventory_icon_backpack_free.png"
color = "0xFFFFFF"
end
inventory_icon.hudids[name].icon = player:hud_add({
hud_elem_type = "image",
@ -39,7 +37,7 @@ minetest.register_on_joinplayer(function(player)
scale = {x=1,y=1},
offset = {x=-36,y=-20},
alignment = {x=0,y=0},
number = color,
number = 0xFFFFFF,
text = string.format("%d/%d", occupied, size)
})
end)
@ -58,14 +56,12 @@ minetest.register_globalstep(function(dtime)
local icon, color
if occupied >= size then
icon = "inventory_icon_backpack_full.png"
color = "0xFF0000"
else
icon = "inventory_icon_backpack_free.png"
color = "0xFFFFFF"
end
player:hud_change(hudids.icon, "text", icon)
player:hud_change(hudids.text, "text", string.format("%d/%d", occupied, size))
player:hud_change(hudids.text, "number", color)
end
inventory_icon.timer = 0
end
end)