Page 1 of 1

[Mod] Inventory Icon [1.1.0] [inventory_icon]

PostPosted: Sat May 30, 2015 23:56
by Wuzzy
This mod shows a backpack icon at the bottom right of the HUD. It shows the number of free and maximum slots in your main inventory. The backback icon turns red when all slots are occupied.

Image

There is also optional support for the bags from the mods “Unified Inventory” and “Bags”. If one of these mods are used, additional bag icons (if bags are present) are displayed.

Image

Dependencies: None!
Optional dependencies:
Code license: MIT License
License of graphics: Overall: CC-BY-SA 3.0 Unported.
+ Detailed license of graphics

Download: See attachment
Project page (with Git repository links): http://repo.or.cz/w/minetest_inventory_icon.git
Current version: 1.1.0

Re: [Mod] Inventory Icon [0.1.0] [inventory_icon]

PostPosted: Sun May 31, 2015 06:32
by Krock
Interesting idea.
What if the inventory is filled with dirt nodes (1 dirt per stack)?
My idea is to count each type in the inventory and then divide by its stack size then use math.ceil to get a more realistic number.

Re: [Mod] Inventory Icon [0.1.0] [inventory_icon]

PostPosted: Sun May 31, 2015 09:29
by Minetestforfun
I like the idea, it will be tested in my server soon :)

Thank you for your work Wuzzy

Re: [Mod] Inventory Icon [0.1.0] [inventory_icon]

PostPosted: Sun May 31, 2015 11:35
by Sokomine
This might be of special intrest in combination with the bags mod. A quick glance as to which bag still has free space might be very helpful.

Re: [Mod] Inventory Icon [0.1.0] [inventory_icon]

PostPosted: Sun May 31, 2015 14:00
by addi
really interesting.

maybe you can use [colorize to create smooth colour gradients into red.

Re: [Mod] Inventory Icon [0.1.0] [inventory_icon]

PostPosted: Sun May 31, 2015 16:51
by srifqi
Nice idea!
Sometimes, while mining, the mined items are dropped. Checked the inventory and it's full!

Version 0.2.0

PostPosted: Tue Jun 23, 2015 19:49
by Wuzzy
Following Sokomine's request, I have added support for showing the free space of the bags if you use the Unified Inventory mod. Here is a screenshot:

Image

You can download the new version 0.2.0 from the first post.
If anyone of you knows more mods which add additional inventory-related stuff and you think these deserve support by this mod, please write here.

Also report any bugs and weirdnesses you encounter when using this mod.

Have fun!


Further notes: I have decided to not use a gradient into red. I guess the difference of color of “full” vs “almost full” would not be really distinguishable.
I also decided to keep the way the numbers are displayed as of now. Even if all slots are filled with only 1 dirt, you can't collect new items anymore (except dirt), so I want solely count occupied slots. And yes, 1 dirt on a slot makes the slot be counted as “occupied”.
Also, Krock, I don't see a viable alternative here. Remember that each item type may have a different maximum stack size, so this would not allow to display any exact numbers. And you also didn't say how to treat the empty slots with your method.
I stick with the raw inventory slots for now, because its simple and straight-forward. It is easy to implement and easy to understand.

Re: [Mod] Inventory Icon [0.2.0] [inventory_icon]

PostPosted: Wed Jun 24, 2015 15:23
by Sokomine
Wuzzy wrote:Following Sokomine's request, I have added support for showing the free space of the bags if you use the Unified Inventory mod. Here is a screenshot:

Looks very nice! I hope it gets added to many servers soon.

Re: [Mod] Inventory Icon [1.0.0] [inventory_icon]

PostPosted: Wed Jul 01, 2015 19:56
by Wuzzy
Version 1.0.0 released!

The mod now provides its own bag icons, so the bags are displayed correctly even if a texture pack overwrites the original bag icons and changes their size. If I would not do that, the bag icons could be displayed incorrectly when using a texture pack.


Note to modders / texture pack makers: If you provide your own bags for Unified Inventory, please notify me. Or you may just add your inventory_icon-optimized icon to your mod. It must have a size of 32×32 and follow this naming convention:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
"inventory_icon_" .. ORIGINAL_FILE_NAME


For “bags_small.png", add the icon “inventory_icon_bags_small.png".

Edit: I uploaded a very minor update, I have messed up the credits in the README, version 1.0.1 should fix this.

Re: [Mod] Inventory Icon [1.0.1] [inventory_icon]

PostPosted: Sun Jul 05, 2015 14:40
by mahmutelmas06
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
2015-07-05 17:35:57: ERROR[main]: ServerError: ...Minetest\bin\..\mods\Hud_Modpack\inventory_icon\init.lua:53: attempt to index local 'bags_inv' (a nil value)
2015-07-05 17:35:57: ERROR[main]: stack traceback:
2015-07-05 17:35:57: ERROR[main]:    ...Minetest\bin\..\mods\Hud_Modpack\inventory_icon\init.lua:53: in function <...Minetest\bin\..\mods\Hud_Modpack\inventory_icon\init.lua:22>
2015-07-05 17:35:57: ERROR[main]:    D:\Oyun\Kurulan\Minetest\bin\..\builtin\game\register.lua:341: in function <D:\Oyun\Kurulan\Minetest\bin\..\builtin\game\register.lua:329>

Re: [Mod] Inventory Icon [1.0.1] [inventory_icon]

PostPosted: Mon Jul 06, 2015 06:01
by Wuzzy
You can't just paste random debug log snippets into a thread and hope a bug gets fixed.

Okay, so apparently something is nil, but I still need the following information to be sure:
  • So what exactly happened?
  • What did you do before this happened?
  • When/Under which circumstances did this happen?
  • Does this bug happen reliably?
  • How do you reproduce this bug? (If you know it.)
  • Did you use Unified Inventory?
  • Which bags were in your bag slots when this happened?
  • Did you have items in the main inventory, in the bags?

Re: [Mod] Inventory Icon [1.0.1] [inventory_icon]

PostPosted: Mon Jul 06, 2015 07:19
by TenPlus1
It seems that the soft dependency for unified_inventory is causing the error, since UI was loading after the inventory_icon mod so that the detached name.."_bags" inventories are not loaded before your mod is trying to display them when a player joins...

To fix this you can either make unified_inventory a proper depencency (remove the ? in depends.txt) or editing on_joinplayer for your own mod, have it wait a second or two using minetest.after() before displaying bags...

Re: [Mod] Inventory Icon [1.0.1] [inventory_icon]

PostPosted: Mon Jul 06, 2015 11:40
by Wuzzy
If Unified Inventory really loads *after* Inventory Icon, even if I added it as optional dependency, then what are optional dependencies good for? I think they would be completely useless. But I doubt that this is actually the case.

And how do you know that Unified Inventory was loaded after Inventory Icon, anyways? I have tested it for myselves: I have added minetest.log lines at the end of init.lua of both mods. According to my log, Inventory Icon was the mod which was loaded later.

Re: [Mod] Inventory Icon [1.0.1] [inventory_icon]

PostPosted: Mon Jul 06, 2015 12:26
by TenPlus1
While the mod works fine on my own system it *could* load both mods so quick that the name.."bags" inventory isn't set before the on_joinplayer routine of this mod tries to display it's numbered contents in the corner... What I propose is basic error checking to stop this from happening...

Re: [Mod] Inventory Icon [1.0.1] [inventory_icon]

PostPosted: Tue Jul 07, 2015 01:01
by mahmutelmas06
i use unified inventory lite version. it happens on even new created world if unified inventory lite enabled.

Version 1.1.0 released!

PostPosted: Sat Nov 12, 2016 20:31
by Wuzzy
Version 1.1.0 released!

Updates:
- Mod is now compatible with the original Bags [bags] mod as well.
- Intllib support
- German translation
- Code is now under MIT License
- Update metadata files (mod.conf, screenshot)
- Use the original bags icons from the mods which supply them instead of distributing them as additional (and redundant) files. This will make life easier for texture pack authors
- Refactor code

Sorry, mahmutelmas06, I haven't gotten around in fixing your reported bug yet. :-( I am also still not sure if this bug is really the fault of this mod.

Edit: Sorry, I can not reproduce the bug you reported, even in lite mode. But for some reason, something seems to be wrong with Unified Inventory as well. In lite mode, the bags button is hidden. WTF?! But honestly, I would personally prefer if Unified Inventory removes the bags and instead the bags are released as seperate mod (maybe optionally) depending on Unified Inventory. It would be less pain for all of us.

Still, if you really want to help in fixing this bug, more information is important. Can you please answer the other questions I asked? Also, can you please test if the bug still applies to you after upgrading Unified Inventory and Inventory Icon to the newest versions?



EDIT 2: mahmutelmas06: Can you please download the following test version?:
http://repo.or.cz/minetest_inventory_ic ... aa4a22.zip
And tell me if the bug still applies to you?

Re: [Mod] Inventory Icon [1.1.0] [inventory_icon]

PostPosted: Sun Nov 13, 2016 11:33
by mahmutelmas06
Thank you for considering the bug.
But it seems everything works fine on both versions. ( Test and stable )