[1.1.61] Switch raises on_gui_click twice

This subforum contains all the issues which we already resolved.
User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 525
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

[1.1.61] Switch raises on_gui_click twice

Post by Mylon »

Problem: On_gui_click event fires twice when a switch is toggled.

Expected: Event only fires once.

To recreate:

* Run this command to create a gui element and hook into the event:

Code: Select all

/c global.count = 0; game.player.gui.center.add{type="switch", name="bug"}; script.on_event(defines.events.on_gui_click, function() global.count = global.count +1 game.print(global.count) end)
* Click the toggle in the center of the screen.
* Observe results:
1
2

Expected:
1

I suspect this wasn't noticed because most people interacting with this were listening to the toggle event which works fine, but for most use cases this event should work as well.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14594
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.61] Switch raises on_gui_click twice

Post by Rseding91 »

Thanks for the report. It's 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”