[2.1.12] LuaGuiElement clicked_sprite and hovered_sprite overwrite each other

This subforum contains all the issues which we already resolved.
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 333
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

[2.1.12] LuaGuiElement clicked_sprite and hovered_sprite overwrite each other

Post by Osmo »

Steps to reproduce:

Code: Select all

/c button = game.player.gui.screen.add{type = "sprite-button"}
/c button.sprite = "utility/close"
/c button.hovered_sprite = "utility/add"
At this point both hovering and clicking use the "utility/add" icon. This is fine as clicked_sprite is not set.

Code: Select all

/c button.clicked_sprite = "utility/search"
Now, both clicking and hovering shows "utility/search" icon, which is incorrect because hovered_sprite is still set to "utility/add".
Setting clicked and hovered in a different order also results in this issue.
the button is hovered, not clicked, but shows the clicked_sprite
the button is hovered, not clicked, but shows the clicked_sprite
изображение.png (1.08 MiB) Viewed 157 times
Attachments
factorio-current.log
(10.14 KiB) Downloaded 9 times
User avatar
Shemp
Long Handed Inserter
Long Handed Inserter
Posts: 68
Joined: Mon Jan 19, 2026 6:51 pm
Contact:

Re: [2.1.12] LuaGuiElement clicked_sprite and hovered_sprite overwrite each other

Post by Shemp »

I'll add that in the above example, button.hovered_sprite would be readable from Lua as "utility/add" despite not being displayed on the button.

In Factorio 1.1.110, clicked_sprite and hovered_sprite are completely distinct from each other, but there is no default assignment behaviour between them. Leaving either of these values blank will cause them to show the sprite-button's standard "sprite".
Rseding91
Factorio Staff
Factorio Staff
Posts: 17306
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.1.12] LuaGuiElement clicked_sprite and hovered_sprite overwrite each other

Post by Rseding91 »

Thanks for the report. This is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”