[Mod] Inventory Tweaks [2.0.1] [beta] [invtweak]

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

[Mod] Inventory Tweaks [2.0.1] [beta] [invtweak]

by BlockMen » Post

Hello everyone,

this mod adds some improvements to the players inventory.

Main feature: This mod adds 3 different buttons to player inventory. With those buttons you can sort your inventory easily.
"›•"-Button concernates all stacks to their maximum size.
"^"-Button sorts all items in an ascending order
"v"-Button sorts all items in an descending order

See demonstration video here: https://www.youtube.com/watch?v=PeOXqyP6h7o

Note: It's currently only working for the player inventory, not for chests or other formspecs.


Furthermore this mod has the ability to refill your wielded items automaticly. For example your current tool breaks and you have one more of the same type (e.g. a stone pickaxe) this mod puts it right in you hand and you can keep digging our placing nodes without opening the inventory.
You can disable this setting by adding/changing following to your minetest.conf file: "invtweak_autorefill = false"

As a small gimmick it adds also a sound when a tool breaks, just to improve the atmosphere of the gameplay. :)

Currently supported mods:
- unified_inventory
- 3d_armor

Notice:
This mod is in beta state, please report any issues you notice.

Download:
Version 2.0.1 beta: Download (tested on 0.4.12, should work on 0.4.10 or newer)
Source code: Github

Depends:
default
unified_inventory (optional)
3d_armor (optional)


License:
- source code: WTFPL
- sound by EdgardEdition (CC-BY-3.0)
Last edited by BlockMen on Thu Jul 16, 2015 21:13, edited 4 times in total.

Jordach
Member
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

by Jordach » Post

Okay. Breaking sound is a really good idea as I usually count down the uses before the tool breaks, so that's one thing I don't have todo anymore.

Secondly, I've used Tekkit before and the automatic refill in there is useful, provided you have the items to "fake" refill the stack.

In a nutshell, this mod makes life much, much easier for me, don't know about you.
viewtopic.php?f=10&t=19056 Solar Plains Dev Server

User avatar
Calinou
Moderator
Posts: 3162
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

by Calinou » Post

I like it. This should be in the default game. :D

User avatar
Zeg9
Member
Posts: 608
Joined: Fri Sep 21, 2012 11:02
Location: France

by Zeg9 » Post

Calinou wrote:I like it. This should be in the default game. :D
Auto-refill would fit more in the "build" game, but I agree.

By the way, nice mod.
Last edited by Zeg9 on Sun Apr 21, 2013 12:25, edited 1 time in total.
I made a few (a lot of?) mods for minetest: here is a list.
See also the MT-Faithful texture pack (work in progress).

User avatar
Mito551
Member
Posts: 1271
Joined: Sat Jun 16, 2012 15:03

by Mito551 » Post

what part of the code does the auto-refill?

User avatar
Zeg9
Member
Posts: 608
Joined: Fri Sep 21, 2012 11:02
Location: France

by Zeg9 » Post

Mito551 wrote:what part of the code does the auto-refill?
The first 22 lines.
I made a few (a lot of?) mods for minetest: here is a list.
See also the MT-Faithful texture pack (work in progress).

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

I have accidentally ziped und uploaded the wrong files. Please download again, if you want sound. Thanks

User avatar
cHyper
Member
Posts: 842
Joined: Fri May 06, 2011 08:49
GitHub: cHyper-0815OL
IRC: cHyper
In-game: cHyper cHyper_0815
Location: Austria
Contact:

by cHyper » Post

awesome tweak tool for minetest...

User avatar
jojoa1997
Member
Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth

by jojoa1997 » Post

could you make this work for all tools like if an item has minetest.register_tool then the things happen. In minitest there are 2 tools that dont do this. Also maybe adding an optional group would be nice if you have set some node/craftitems to do something like a tool
Coding;
1X coding
3X debugging
12X tweaking to be just right

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

jojoa1997 wrote:could you make this work for all tools like if an item has minetest.register_tool then the things happen. In minitest there are 2 tools that dont do this. Also maybe adding an optional group would be nice if you have set some node/craftitems to do something like a tool
Could you say me which tools that are? And the auto-refill should work for any stack, no matter what it contains.

User avatar
Casimir
Member
Posts: 1164
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

Prevent the game from crashing when there is no digger/placer/puncher:

Code: Select all

local auto_refill = true  -- set to false if you dont want get refilled your stack automatic

function refill(player, stck_name, index)
    local inv = player:get_inventory()
    for i,stack in ipairs(inv:get_list("main")) do
        if stack:get_name() == stck_name then
            inv:set_stack("main", index, stack)
            stack:clear()
            inv:set_stack("main", i, stack)
            return
        end
    end
end

if auto_refill == true then
    minetest.register_on_placenode(function(pos, newnode, placer, oldnode)
        if not placer then return end
        local index = placer:get_wield_index()
        local cnt = placer:get_wielded_item():get_count()-1
        if cnt == 0 then minetest.after(0.01, refill, placer, newnode.name, index) end
    end)
end


local tname = ""
minetest.register_on_punchnode(function(pos, node, puncher)
    if not puncher then return end
    if puncher:get_wielded_item():get_wear() ~= 0 then
        tname = puncher:get_wielded_item():get_name()
    else
        tname = ""
    end
end)

minetest.register_on_dignode(function(pos, oldnode, digger)
        if not digger then return end
        local num = digger:get_wielded_item():get_wear()
        local index = digger:get_wield_index()
        if num == 0 and tname ~= "" then
            minetest.sound_play("intweak_tool_break", {gain = 1.5, max_hear_distance = 5})
            if auto_refill == true then minetest.after(0.01, refill, digger, tname, index) end
        end
end)
btw.: Nice mod. Tried to code the auto refill some time ago but failed. And your solution is more simple than I expected.
Last edited by Casimir on Sun Apr 21, 2013 16:55, edited 1 time in total.

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Casimir wrote:Prevent the game from crashing when there is no digger/placer/puncher:

Code: Select all

#code
btw.: Nice mod. Tried to code the auto refill some time ago but failed. And your solution is more simple than I expected.
Thanks, but where is the change in my code? And i tried that, there was no crash. Did you had one?

User avatar
Casimir
Member
Posts: 1164
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

Lines 17, 27, 36. Is a rare bug caused by certain mods that use place_node without a placer, or dig_node without a digger.

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Casimir wrote:Lines 17, 27, 36. Is a rare bug caused by certain mods that use place_node without a placer, or dig_node without a digger.
Ok, thx. I think i will add this, but im not convinced that it is neccesary. I have tested with minetest.env:dig_node(), place_node(), and punch_node() (all have no placer) and it does have no effect. No error, no crash, nothing.

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Update: Version 1.1

Changelog:
- Added Casimir's crash prevention

- supports now also costum tools, that don't digg nodes

Notice: Inventory Tweaks works always for the default tools. The support of costum tools brings no interference for usage.

User avatar
Iqualfragile
Member
Posts: 160
Joined: Tue Sep 18, 2012 22:11

by Iqualfragile » Post

please upload this mod into a repository ( https://bitbucket.org )
Gr8 b8, m8. I rel8, str8 appreci8, and congratul8. I r8 this b8 an 8/8. Plz no h8, I'm str8 ir8. Cr8 more, can't w8. We should convers8, I won't ber8, my number is 8888888, ask for N8. No calls l8 or out of st8. If on a d8, ask K8 to loc8. Even with a full pl8, I always have time to communic8 so don't hesit8.

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Update: Version 1.2

Changelog:
- Fixed sound-bug in multiplayer
- Fixed bug in creative mode
- full Multiplayer support
- improved support for costum tools

User avatar
Casimir
Member
Posts: 1164
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

I noticed a bug: when you have a unused tool and use it on something it is not made for it breaks instantly. E.g. dig dirt with a brand new pickaxe.

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Casimir wrote:I noticed a bug: when you have a unused tool and use it on something it is not made for it breaks instantly. E.g. dig dirt with a brand new pickaxe.
Thanks for feedback.

Survival or creative mode? Because i noticed that issue in creative already but had no time to update yet.

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Version 1.2.1 released

Changelog:
- fix instant break of unused tools in creative mode

User avatar
Mossmanikin
Member
Posts: 599
Joined: Sun May 19, 2013 16:26
Location: where we don't speak english.

by Mossmanikin » Post

Very cool this mod. Minetest has far too less sounds and the auto-refilling is very handy.

Both features seem not to work in creative mode for me (stable 0.4.7, no other mods).
Don't know if it's a bug or a feature, but who needs anything but building blocks in creative mode anyway?

Noob 4 life!
My stuff

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Mossmanikin wrote:Very cool this mod. Minetest has far too less sounds and the auto-refilling is very handy.

Both features seem not to work in creative mode for me (stable 0.4.7, no other mods).
Don't know if it's a bug or a feature, but who needs anything but building blocks in creative mode anyway?
Both. Auto-refill = feature, sound = bug :P

I will check that, thx.

EDIT: This bug (and its fix in 1.2.1) is only occuring in dev-versions of Minetest. So if you are using Minetest 0.4.7 stable, then stay at Version 1.2 of this mod.

Caused is this bug by this commit -> https://github.com/minetest/minetest/co ... 3e9cb5409d
Last edited by BlockMen on Fri Jul 26, 2013 13:07, edited 1 time in total.

User avatar
onpon4
Member
Posts: 517
Joined: Thu Mar 21, 2013 01:54
GitHub: onpon4
In-game: diligentcircle
Contact:

by onpon4 » Post

I find it really annoying that this instantly breaks many tools when you use them on the wrong thing. I was annoyed when I lost a perfectly good diamond sword because I was wielding it while I picked up a torch, and I've lost a compass from another mod more than once because of it.

(It's not whatever bug you fixed in 1.2.1. This is version 0.4.7 without creative mode.)
Last edited by onpon4 on Fri Oct 04, 2013 17:24, edited 1 time in total.

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

onpon4 wrote:I find it really annoying that this instantly breaks many tools when you use them on the wrong thing. I was annoyed when I lost a perfectly good diamond sword because I was wielding it while I picked up a torch, and I've lost a compass from another mod more than once because of it.

(It's not whatever bug you fixed in 1.2.1. This is version 0.4.7 without creative mode.)
Thanks for reporting that bug. I will fix that as soon as possible, but it seems i have to rewrite the mod for that, so it could take a while.

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Update: Version 1.2.2

Changelog:
- Fixed instantly break of unused tools when digging wrong block
- lowered volume of break sound a bit

Version 1.2 (for Minetest 0.4.7 stable) is also fixed

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests