Report used keys in on_gui_click event.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Report used keys in on_gui_click event.

Post by eradicator »

It would be much easier to make vanilla-like GUIs if the buttons used to do the clicking in on_gui_click events were available, as currently all buttons and modifiers are the same.

This could be a simple "control"-like string

Code: Select all

event.control = "Shift + Right mouse button"
or preferably a table for easier processing:

Code: Select all

event.buttons = {
  left = false,
  right = true,
  ctrl = false,
  shift = true,
  alt = false,
}
Because the event still fires for all clicks old mods would still work as before ensuring a smooth transition.
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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14913
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Report used keys in on_gui_click event.

Post by Rseding91 »

The mouse button info is known only for the "gui_clicked" event. The other events like gui check state changed don't have an associated mouse anything.

I'll add the mouse button for the clicked event for 0.15.
If you want to get ahold of me I'm almost always on Discord.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Report used keys in on_gui_click event.

Post by eradicator »

Great! Thanks :D. (I think i can live without modifyer keys on check boxes.)
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.
Post Reply

Return to “Implemented mod requests”