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

6 Commits

2 changed files with 24 additions and 9 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

@ -9,7 +9,7 @@ tweak.buttons = {
--sort_desc
"0.55,0.6;sort_desc;v]".."tooltip[sort_desc;sort Items desc.;#30434C;#FFF]",
--concatenate
"0.65,0.6;sort;<EFBFBD><EFBFBD>]".."tooltip[sort;stack Items and sort asc.;#30434C;#FFF]"
"0.65,0.6;sort;#]".."tooltip[sort;stack Items and sort asc.;#30434C;#FFF]"
}
local function get_formspec_size(formspec)
@ -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)
@ -198,6 +202,7 @@ function refill(player, stck_name, index)
end
end
end
end
if auto_refill == true then
minetest.register_on_placenode(function(pos, newnode, placer, oldnode)
@ -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.")