[2.0.76] Allow any entity to fire on_gui_opened events

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 169
Joined: Tue Feb 06, 2024 5:18 am
Contact:

[2.0.76] Allow any entity to fire on_gui_opened events

Post by hgschmie »

Pretty straightforward ask:

- add a new EntityPrototypeFlag: "allow-gui". Adding this flag to an entity prototype makes Entities fire the "on_gui_opened" event when clicked.
- in any on_gui_opened event that is fired by an entity that has no "natural" GUI, the gui_type in the event is set to defines.gui_type.none.

This would allow adding custom GUIs to any entity that does not have a natural GUI. A mod would listen for that event and set player.opened accordingly to the custom GUI.

The only way right now to achieve this is by adding a custom event that reacts on any mouse button press, filter and only open the custom gui if the pointer is over the entity. This is cumbersome and probably not very efficient. Or one has to find a matching entity with a GUI and (ab-)use that for the custom entity.

(My hunch is that this touches on some internal hardwired logic and can not be implemented for that reason. But I thought that I could ask. ;-) )
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 255
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: [2.0.76] Allow any entity to fire on_gui_opened events

Post by Osmo »

+1, for some entities it is possible to use another prototype (with the side effects that they have), but for others its just a no. Generators, units, etc.
User avatar
protocol_1903
Filter Inserter
Filter Inserter
Posts: 469
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

Re: [2.0.76] Allow any entity to fire on_gui_opened events

Post by protocol_1903 »

+1
Py and PyBlock developer, wielder of LUA in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
Post Reply

Return to “Modding interface requests”