Version MFF.
0
README.txt
Normal file → Executable file
2
depends.txt
Normal file → Executable file
@ -1 +1 @@
|
|||||||
unified_inventory?
|
unified_inventory
|
||||||
|
0
description.txt
Normal file → Executable file
30
init.lua
Normal file → Executable file
@ -16,7 +16,15 @@ function inventory_icon.get_inventory_state(inv, listname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function inventory_icon.replace_icon(name)
|
function inventory_icon.replace_icon(name)
|
||||||
return "inventory_icon_"..name
|
local icon = ""
|
||||||
|
if name:find("small") then
|
||||||
|
icon = "inventory_icon_bags_small.png"
|
||||||
|
elseif name:find("medium") then
|
||||||
|
icon = "inventory_icon_bags_medium.png"
|
||||||
|
elseif name:find("large") then
|
||||||
|
icon = "inventory_icon_bags_large.png"
|
||||||
|
end
|
||||||
|
return icon
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
@ -60,7 +68,7 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
scale = { x = 1, y = 1 }
|
scale = { x = 1, y = 1 }
|
||||||
local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "bag"..i.."contents")
|
local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "bag"..i.."contents")
|
||||||
text = string.format("%d/%d", occupied, size)
|
text = string.format("%d/%d", occupied, size)
|
||||||
icon = inventory_icon.replace_icon(minetest.registered_items[bag:get_name()].inventory_image)
|
icon = inventory_icon.replace_icon(bag:get_name())
|
||||||
if occupied >= size then
|
if occupied >= size then
|
||||||
icon = icon .. "^" .. inventory_icon.COLORIZE_STRING
|
icon = icon .. "^" .. inventory_icon.COLORIZE_STRING
|
||||||
end
|
end
|
||||||
@ -91,12 +99,11 @@ minetest.register_on_leaveplayer(function(player)
|
|||||||
inventory_icon.hudids[player:get_player_name()] = nil
|
inventory_icon.hudids[player:get_player_name()] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
inventory_icon.timer = 0
|
local function tick()
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.after(1, tick)
|
||||||
inventory_icon.timer = inventory_icon.timer + dtime
|
for playername,hudids in pairs(inventory_icon.hudids) do
|
||||||
if inventory_icon.timer > 1 then
|
local player = minetest.get_player_by_name(playername)
|
||||||
for playername,hudids in pairs(inventory_icon.hudids) do
|
if player then
|
||||||
local player = minetest.get_player_by_name(playername)
|
|
||||||
local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "main")
|
local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "main")
|
||||||
local icon, color
|
local icon, color
|
||||||
if occupied >= size then
|
if occupied >= size then
|
||||||
@ -120,7 +127,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
scale = { x = 1, y = 1 }
|
scale = { x = 1, y = 1 }
|
||||||
local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "bag"..i.."contents")
|
local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "bag"..i.."contents")
|
||||||
text = string.format("%d/%d", occupied, size)
|
text = string.format("%d/%d", occupied, size)
|
||||||
icon = inventory_icon.replace_icon(minetest.registered_items[bag:get_name()].inventory_image)
|
icon = inventory_icon.replace_icon(bag:get_name())
|
||||||
if occupied >= size then
|
if occupied >= size then
|
||||||
icon = icon .. "^" .. inventory_icon.COLORIZE_STRING
|
icon = icon .. "^" .. inventory_icon.COLORIZE_STRING
|
||||||
end
|
end
|
||||||
@ -133,6 +140,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
inventory_icon.timer = 0
|
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
|
||||||
|
tick()
|
||||||
|
BIN
textures/inventory_icon_backpack_free.png
Normal file → Executable file
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 348 B |
BIN
textures/inventory_icon_backpack_full.png
Normal file → Executable file
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 345 B |
BIN
textures/inventory_icon_bags_large.png
Normal file → Executable file
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 660 B |
BIN
textures/inventory_icon_bags_medium.png
Normal file → Executable file
Before Width: | Height: | Size: 922 B After Width: | Height: | Size: 836 B |
BIN
textures/inventory_icon_bags_small.png
Normal file → Executable file
Before Width: | Height: | Size: 699 B After Width: | Height: | Size: 625 B |