Tie a sprite-button to a LuaItemStack
Posted: Tue Dec 22, 2020 6:56 pm
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.
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.