Showing wear on formspec's item_image_button[]

bell07
Member
 
Posts: 140
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Showing wear on formspec's item_image_button[]

by bell07 » Sat Mar 11, 2017 23:19

As described in subject, is there a way implemented to show tool wear on formspec / item_image_button[]? (for armor in smart_inventory). I know, using list[] it works out of the box, but I like to see it on a button.
In doc/lua_api.txt there is a "serialized itemstring" described with sample 'default:pick_wood 21323'. The MT seems to be parsed the string in item_image_button[] (with 0: no item, with >0: item is displayed) but no wear indicator bar is shown.
Is there a way to get it or is it a missed feature in core? Any known workaround?
 

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

Re: Showing wear on formspec's item_image_button[]

by octacian » Sun Mar 12, 2017 18:21

I don't believe this is possible. On the other hand, I don't understand why one would need to do this in the first place as item_image_buttons are typically used in places like crafting guides or creative inventories where you don't need buttons. Now, if you need to update the formspec or something when someone clicks an item, you could have an extra slot that whenever an item was added to it the formspec would be updated.

In short, we need more info ;)
God isn't dead!

My Coolest Mods:
MicroExpansion, Working Computers, Interchangeable Hands

Check out my YouTube channel! (octacian)
 

bell07
Member
 
Posts: 140
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: Showing wear on formspec's item_image_button[]

by bell07 » Sun Mar 12, 2017 19:16

I don't understand why one would need to do this

I need it on players page of smart_inventory https://forum.minetest.net/viewtopic.php?f=9&t=16597 (see 3rd screenshot) to display wear status of used armor. I like to change (add or replace) armor by click instead of 2x drag&drop, But a inventory slot does not have an "on_click" callback, therefore I implemented it using item_image_button[]. It is already implemented and working fine. Only thing missed is the "progress bar" indicator of armor status wear. Is there a way to use something existing or is the way only to implement a small colorized image[] under the button by self?
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron