Page 1 of 1

Tie a sprite-button to a LuaItemStack

Posted: Tue Dec 22, 2020 6:56 pm
by raiguard
I would like to request a way to tie a LuaItemStack to a sprite-button, so we can show the contents of that ItemStack in the same way that the base game does. Currently, sprite-buttons can only display SpritePaths, which are static and unchanging. This means that you can't display things such as a blueprint item's icon or a spidertron's tint.

I think the best solution would be to add an item property to sprite-buttons, and set the contents of that value to a LuaItemStack. The sprite-button would then take on the properties of that LuaItemStack, and update its sprite, number, and tooltip when the LuaItemStack changes. This would make it a lot easier to emulate an inventory in a fully custom GUI as well.

Edit: justarandomgeek pointed out that having this behavior on a sprite-button might be confusing, so it might make more sense to create a new type, like item-stack-button.

Re: Tie a sprite-button to a LuaItemStack

Posted: Tue Dec 22, 2020 7:14 pm
by eradicator
Raiguard wrote: Tue Dec 22, 2020 6:56 pm This means that you can't display things such as a blueprint item's icon or a spidertron's tint.
+1
+2
+3
+4
+∞

I'll take any method. I don't care how it's implemented. I'd also like a proper blueprint-preview tooltip on that slot-button please. Trying to create vanilla-like guis and hitting walls like this is quite frustrating.

Re: Tie a sprite-button to a LuaItemStack

Posted: Wed Dec 23, 2020 9:14 am
by PFQNiet
I agree. Bonus points if we get the native item tooltip as well, because currently I can either have a sprite-button with number but no tooltip, or a locked choose-elem-button with tooltip but no number.

An item-button would solve my problem perfectly.

Re: Tie a sprite-button to a LuaItemStack

Posted: Thu Apr 21, 2022 8:32 am
by curiosity
An item stack button would be helpful. Doesn't have to be sprite-button specifically.

Re: Tie a sprite-button to a LuaItemStack

Posted: Fri Apr 22, 2022 4:17 am
by KingIonTrueLove
I like the idea of an item stack button as well. It would solve the issue I listed on 102201 because as it being related only to items, it should fire on mouse_down.

Plus I had been wanting to pull Factorio's item tooltips onto my buttons as well.

There is many things a 'item-button' could to to help bring the user experience of mods closer to that of base Factorio.

Re: Tie a sprite-button to a LuaItemStack

Posted: Tue Jun 20, 2023 8:48 am
by Kraskaska
any news on this?