Add bags icons into textures

For compability with texture packs
This commit is contained in:
Wuzzy 2015-07-01 21:43:38 +02:00
parent c1728a7050
commit ce66056844
4 changed files with 10 additions and 6 deletions

@ -15,6 +15,10 @@ function inventory_icon.get_inventory_state(inv, listname)
return occupied, size
end
function inventory_icon.replace_icon(name)
return "inventory_icon_"..name
end
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
inventory_icon.hudids[name] = {}
@ -51,12 +55,12 @@ minetest.register_on_joinplayer(function(player)
if bag:is_empty() then
scale = { x = 0, y = 0 }
text = ""
icon = "bags_small.png"
icon = "inventory_icon_bags_small.png"
else
scale = { x = 2, y = 2 }
scale = { x = 1, y = 1 }
local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "bag"..i.."contents")
text = string.format("%d/%d", occupied, size)
icon = minetest.registered_items[bag:get_name()].inventory_image
icon = inventory_icon.replace_icon(minetest.registered_items[bag:get_name()].inventory_image)
if occupied >= size then
icon = icon .. "^" .. inventory_icon.COLORIZE_STRING
end
@ -111,12 +115,12 @@ minetest.register_globalstep(function(dtime)
if bag:is_empty() then
scale = { x = 0, y = 0 }
text = ""
icon = "bags_small.png"
icon = "inventory_icon_bags_small.png"
else
scale = { x = 2, y = 2 }
scale = { x = 1, y = 1 }
local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "bag"..i.."contents")
text = string.format("%d/%d", occupied, size)
icon = minetest.registered_items[bag:get_name()].inventory_image
icon = inventory_icon.replace_icon(minetest.registered_items[bag:get_name()].inventory_image)
if occupied >= size then
icon = icon .. "^" .. inventory_icon.COLORIZE_STRING
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B