Page 1 of 1

Showing wear on formspec's item_image_button[]

PostPosted: Sat Mar 11, 2017 23:19
by bell07
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?

Re: Showing wear on formspec's item_image_button[]

PostPosted: Sun Mar 12, 2017 18:21
by octacian
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 ;)

Re: Showing wear on formspec's item_image_button[]

PostPosted: Sun Mar 12, 2017 19:16
by bell07
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?