mirror of
https://repo.or.cz/minetest_inventory_icon.git
synced 2024-12-04 21:03:47 +01:00
Add bags icons into textures
For compability with texture packs
This commit is contained in:
parent
c1728a7050
commit
ce66056844
16
init.lua
16
init.lua
@ -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
|
||||
|
BIN
textures/inventory_icon_bags_large.png
Normal file
BIN
textures/inventory_icon_bags_large.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 670 B |
BIN
textures/inventory_icon_bags_medium.png
Normal file
BIN
textures/inventory_icon_bags_medium.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 922 B |
BIN
textures/inventory_icon_bags_small.png
Normal file
BIN
textures/inventory_icon_bags_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 699 B |
Loading…
Reference in New Issue
Block a user