1
0
mirror of https://github.com/BlockMen/invtweak.git synced 2025-06-30 15:30:42 +02:00

4 Commits

2 changed files with 23 additions and 8 deletions

View File

@ -1,6 +1,6 @@
Minetest mod "Inventory Tweaks"
===============================
version: 2.0
version: 2.0.1
License of source code: WTFPL
-----------------------------

View File

@ -34,6 +34,9 @@ local function add_buttons(player, formspec)
formspec = player:get_inventory_formspec()
end
local w,h = get_formspec_size(formspec)
if not w or not h then
return
end
for i=1,#tweak.buttons do
formspec = formspec .. "button["..w-2+(i*0.5)..",-0.2;" .. tweak.buttons[i]
end
@ -188,6 +191,7 @@ end
-- tool break sound + autorefill
function refill(player, stck_name, index)
local inv = player:get_inventory()
if inv:get_list("main") then
for i,stack in ipairs(inv:get_list("main")) do
if stack:get_name() == stck_name then
inv:set_stack("main", index, stack)
@ -197,6 +201,7 @@ function refill(player, stck_name, index)
return
end
end
end
end
if auto_refill == true then
@ -269,6 +274,14 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
if not old and tname == "" then
old = 0
end
--debug
if not old then
old = 0
print("Debug invtweak: OLD is nil\nplayer is ")
print(name)
print("\nname is ")
print(tname)
end
local new = item:get_wear()
if old ~= new then
@ -285,3 +298,5 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
end
end
end)
minetest.log("action", "[invtweak] loaded.")