Update Vessels mod
This commit is contained in:
parent
c660f1e512
commit
ce02a834a3
@ -379,7 +379,9 @@ Pumpkin Pie = Тыквенный Пирог
|
|||||||
|
|
||||||
#vessels
|
#vessels
|
||||||
Potion Shelf = Шкаф с Зельями
|
Potion Shelf = Шкаф с Зельями
|
||||||
|
Empty Potion Shelf = Пустой Шкаф с Зельями
|
||||||
Empty Glass Bottle = Пустой Стеклянный Бутыль
|
Empty Glass Bottle = Пустой Стеклянный Бутыль
|
||||||
|
Bottles: = Бутылей:
|
||||||
|
|
||||||
|
|
||||||
#signs
|
#signs
|
||||||
|
@ -8,10 +8,38 @@ local vessels_shelf_formspec =
|
|||||||
"listring[context;vessels]" ..
|
"listring[context;vessels]" ..
|
||||||
"listring[current_player;main]"
|
"listring[current_player;main]"
|
||||||
|
|
||||||
local function get_vessels_shelf_formspec(inv)
|
local function update_vessels_shelf(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local invlist = inv:get_list("vessels")
|
||||||
|
|
||||||
local formspec = vessels_shelf_formspec
|
local formspec = vessels_shelf_formspec
|
||||||
local invlist = inv and inv:get_list("vessels")
|
-- Inventory slots overlay
|
||||||
return formspec
|
local vx, vy = 0, 1
|
||||||
|
local n_items = 0
|
||||||
|
for i = 1, 18 do
|
||||||
|
if i == 10 then
|
||||||
|
vx = 0
|
||||||
|
vy = vy + 1
|
||||||
|
end
|
||||||
|
if not invlist or invlist[i]:is_empty() then
|
||||||
|
formspec = formspec ..
|
||||||
|
"image[" .. vx .. "," .. vy .. ";1,1;vessels_shelf_slot.png]"
|
||||||
|
else
|
||||||
|
local stack = invlist[i]
|
||||||
|
if not stack:is_empty() then
|
||||||
|
n_items = n_items + stack:get_count()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vx = vx + 1
|
||||||
|
end
|
||||||
|
meta:set_string("formspec", formspec)
|
||||||
|
if n_items == 0 then
|
||||||
|
meta:set_string("infotext", Sl("Empty Potion Shelf"))
|
||||||
|
else
|
||||||
|
meta:set_string("infotext", Sl("Potion Shelf") .. "\n(" ..
|
||||||
|
Sl("Bottles:") .. " " .. n_items .. ")")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("vessels:shelf", {
|
minetest.register_node("vessels:shelf", {
|
||||||
@ -25,7 +53,7 @@ minetest.register_node("vessels:shelf", {
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", get_vessels_shelf_formspec(nil))
|
update_vessels_shelf(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("vessels", 9 * 2)
|
inv:set_size("vessels", 9 * 2)
|
||||||
inv:set_size("split", 1)
|
inv:set_size("split", 1)
|
||||||
@ -51,16 +79,13 @@ minetest.register_node("vessels:shelf", {
|
|||||||
return count
|
return count
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
local meta = minetest.get_meta(pos)
|
update_vessels_shelf(pos)
|
||||||
meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory()))
|
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
local meta = minetest.get_meta(pos)
|
update_vessels_shelf(pos)
|
||||||
meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory()))
|
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
local meta = minetest.get_meta(pos)
|
update_vessels_shelf(pos)
|
||||||
meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory()))
|
|
||||||
end,
|
end,
|
||||||
on_blast = function(pos)
|
on_blast = function(pos)
|
||||||
local drops = {}
|
local drops = {}
|
||||||
|
BIN
files/vessels/textures/vessels_shelf_slot.png
Normal file
BIN
files/vessels/textures/vessels_shelf_slot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 133 B |
Loading…
x
Reference in New Issue
Block a user