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.
Tie a sprite-button to a LuaItemStack
Tie a sprite-button to a LuaItemStack
Last edited by raiguard on Tue Dec 22, 2020 7:21 pm, edited 2 times in total.
Don't forget, you're here forever.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Tie a sprite-button to a LuaItemStack
+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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Tie a sprite-button to a LuaItemStack
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.
An item-button would solve my problem perfectly.
Re: Tie a sprite-button to a LuaItemStack
An item stack button would be helpful. Doesn't have to be sprite-button specifically.
-
- Inserter
- Posts: 24
- Joined: Sun Jun 04, 2017 1:38 am
- Contact:
Re: Tie a sprite-button to a LuaItemStack
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.
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
any news on this?