It would be nice if there was a way to temporarily grab keyboard and/or mouse events (similarly to the way focused text fields intercept most of keystokes).
This event grab could be implemented by adding an additional lua event and a LuaPlayer.grab_input_events(grab_keyboard, grab_mouse) (or similar) method(s) that would initiate the grab.
Grabbing keyboard events would allow to implement more interesting custom GUI elements, while allowing to grab mouse events would enable creating interactive game overlays (when done in conjunction with the rendering API).
The new mouse event could be similar to on_gui_click, but it could contain entity instead of LuaGuiElement. The location of the click in surface coordinates would also be useful.
Allow temporarily to grab keyboard and/or mouse events
-
- Long Handed Inserter
- Posts: 68
- Joined: Thu Jan 15, 2015 2:20 pm
- Contact:
Re: Allow temporarily to grab keyboard and/or mouse events
Sorry but no. Mods will never be allowed to read keyboard/mouse events directly. Not even the base game is allowed to do that. It completely breaks multiplayer determinism where you don't have access to other players keyboard/mouse events.
If you want to get ahold of me I'm almost always on Discord.