Page 1 of 1

add on_event which is called when a player opens a gui

Posted: Fri Jun 02, 2017 8:28 am
by mophydeen

Code: Select all

opened :: LuaEntity or LuaItemStack or LuaEquipment or defines.gui_type [Read-Write]
The GUI target the player currently has open; nil if none.

Note: Write supports any of the types. Read will return the entity, equipment or nil.

edit: also on_event_gui_closed would be handy.

Call on_event_gui_opened when a window is opened, call on_event_gui_closed when a window is closed.

Ty

Re: add on_event which is called when a player opens a gui

Posted: Fri Jun 02, 2017 1:22 pm
by bobingabout
if this existed, I'd use it in my inserters mod instead of having to open my own GUI on alternate keypress.

Re: add on_event which is called when a player opens a gui

Posted: Fri Jun 02, 2017 2:21 pm
by Mooncat

Re: add on_event which is called when a player opens a gui

Posted: Fri Jun 09, 2017 12:55 am
by 321freddy
This would be very useful and remove the need for constant player.opened checking in on_tick which might get very expensive in large multiplayer games.

Also I would say one event is enough: Similar to the "on_selected_entity_changed" an "on_opened_entity_changed" event.