[Mod] Show Wielded Item [1.2.0] [show_wielded_item]

Post Reply
User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

[Mod] Show Wielded Item [1.2.0] [show_wielded_item]

by Wuzzy » Post

This mod shows the name of the wielded item above the statbars.

Image

This mod is partially compatible with HUD Bars [hudbars] and changes the position of the text accordingly. If needed, you can change the position manually in the advanced settings.
Attachments
show_wielded_item1.0.0.zip
(14.71 KiB) Downloaded 286 times
screenshot.png
screenshot.png (11.58 KiB) Viewed 1695 times
Last edited by Wuzzy on Tue Mar 07, 2023 16:19, edited 4 times in total.

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by octacian » Post

You beat me to it! Was gonna release my own later today, compatible with HUDPlus. Oh well, probably will anyways. Great job though! Maybe add a simple check so that the mod does not function if unified inventory is installed? No clue why anyone would install this if they already had unified inventory, but considering that it's only a few lines of code, it could be worthwhile.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by hajo » Post

Wuzzy wrote:This mod shows the name of the wielded item above the statbars
This is essentially a part of 'customizing the HUD', and I think
every player should be able/allowed to do that for him/herself.

So, wouldn't this mod be more useful as a CSM ?

User avatar
Linuxdirk
Member
Posts: 3216
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by Linuxdirk » Post

hajo wrote:So, wouldn't this mod be more useful as a CSM ?
It would be most useful if it was an option and no mod would be needed for that. But yes, this is a good example for adding a missing feature to the client that otherwise won't be added anytime soon.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by Wuzzy » Post

I have requested this feature to be removed from Unified Inventory because it doesn't make sense there:
https://github.com/minetest-technic/uni ... issues/101

No reply so far.
This is essentially a part of 'customizing the HUD', and I think
every player should be able/allowed to do that for him/herself.
Good point. Ideally, this thing becomes a feature in the engine.

User avatar
Phoenixflo44
Member
Posts: 639
Joined: Fri Jul 28, 2017 15:01
In-game: EvilPhoenix
Location: Behind my PC, in Germany

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by Phoenixflo44 » Post

for 0.4.9 ?
Spoiler
I hate my life

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by Wuzzy » Post

I don't know, just try it out. I don't use Minetest versions from the stone age.

User avatar
AspireMint
Member
Posts: 415
Joined: Mon Jul 09, 2012 12:59
GitHub: AspireMint
IRC: AspireMint
In-game: AspireMint
Location: Stuck at spawn

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by AspireMint » Post

I can't run your mod, version 1.0.0.
hudbars is optional, im not using it.

depends.txt:

Code: Select all

hudbars?

Code: Select all

ERROR[Main]: ServerError: Lua: Runtime error from mod 'show_wielded_item' in callback on_joinplayer(): ...test/games/minetest_game/mods/show_wielded_item/init.lua:15: attempt to index field 'settings' (a nil value)
ERROR[Main]: stack traceback:
ERROR[Main]:       ...test/games/minetest_game/mods/show_wielded_item/init.lua:15: in function 'set_hud'
ERROR[Main]:       ...test/games/minetest_game/mods/show_wielded_item/init.lua:49: in function <...test/games/minetest_game/mods/show_wielded_item/init.lua:48>
ERROR[Main]:       /usr/share/games/minetest/builtin/game/register.lua:412: in function </usr/share/games/minetest/builtin/game/register.lua:392>

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by Wuzzy » Post

AspireMint, my first guess is that you're using an old version of Minetest. Please update to 0.4.16.

If you DID use version 0.4.16, I'm very confused.

User avatar
AspireMint
Member
Posts: 415
Joined: Mon Jul 09, 2012 12:59
GitHub: AspireMint
IRC: AspireMint
In-game: AspireMint
Location: Stuck at spawn

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by AspireMint » Post

Thanks, works in 0.4.16

User avatar
emperor_genshin
Member
Posts: 83
Joined: Tue Dec 22, 2015 05:04
GitHub: GenshinMT
IRC: Genshin
In-game: Genshin
Location: [REDACTED]
Contact:

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by emperor_genshin » Post

Wasn't this already implemented on RBA's Unified Inventory mod?
I'm just a individual who likes to make impressive things. | Current Mod: Dungeon Crawl Maker https://www.youtube.com/watch?v=c6g6H2kLBpg

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by octacian » Post

emperor_genshin wrote:Wasn't this already implemented on RBA's Unified Inventory mod?
Yeah, but if you ask me, I personally really dislike Unified Inventory so it's incredibly nice to have a mod that allows me to have this feature without being forced to use Unified Inventory.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by Wuzzy » Post

It's true it's in Unified Inventory (UI). But I follow a simple principle: one mod = one task. Rather than making one mod which does everything at once.

It gives the user way more choices to combine mods, it improves interoperability, makes the mods more maintainable, dependencies can be a lot simpler.
The benefits are very obvious.
By comparison, if you put every feature into one mod, you lose all this. It's much harder to combine, there are less possibilities. It's also a lot less flexible since users are forced to take everything or nothing. IMO this is just bad software engineering but VanessaE just won't listen.

Long story short, it's Unified Inventory which is at fault here, not Show Wielded Item.

User avatar
Linuxdirk
Member
Posts: 3216
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by Linuxdirk » Post

Wuzzy wrote:Long story short, it's Unified Inventory which is at fault here, not Show Wielded Item.
Unified Inventory is a fault in general since we have sfinv ...

User avatar
emperor_genshin
Member
Posts: 83
Joined: Tue Dec 22, 2015 05:04
GitHub: GenshinMT
IRC: Genshin
In-game: Genshin
Location: [REDACTED]
Contact:

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by emperor_genshin » Post

Fair point, also I agree.

Though honestly I feel like this should be applied on default rather than having it for one specific inventory.
Wuzzy wrote:It's true it's in Unified Inventory (UI). But I follow a simple principle: one mod = one task. Rather than making one mod which does everything at once.

It gives the user way more choices to combine mods, it improves interoperability, makes the mods more maintainable, dependencies can be a lot simpler.
The benefits are very obvious.
By comparison, if you put every feature into one mod, you lose all this. It's much harder to combine, there are less possibilities. It's also a lot less flexible since users are forced to take everything or nothing. IMO this is just bad software engineering but VanessaE just won't listen.

Long story short, it's Unified Inventory which is at fault here, not Show Wielded Item.
I'm just a individual who likes to make impressive things. | Current Mod: Dungeon Crawl Maker https://www.youtube.com/watch?v=c6g6H2kLBpg

User avatar
MetaNomad
Member
Posts: 27
Joined: Sat Apr 10, 2021 09:58
In-game: MetaNomad

Re: [Mod] Show Wielded Item [1.0.0] [show_wielded_item]

by MetaNomad » Post

Hi,

For my personal use, I replaced the line 103

Code: Select all

player:hud_change(huds[player_name], 'text', desc)
by

Code: Select all

player:hud_change(huds[player_name], 'text', desc.."  ("..wname..")" )
to add the itemstring

Maybe it could be added as a setting

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version 1.1.0 + version 1.2.0 released!

by Wuzzy » Post

Version 1.1.0 released! Version 1.2.0 released!

Changes:
  • Add support for short_description
  • Add setting for optionally appending the itemstring (e.g. "default:apple")
Note: The itemstring setting will of course apply server-wide, i.e. it applies to all players.

BTW: There is also a client-side Minetest setting to append the itemstring in the item tooltip: tooltip_append_itemname.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Show Wielded Item [1.2.0] [show_wielded_item]

by Wuzzy » Post

The Git repository was moved to Codeberg.org.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests