Hi
How can I reach the gui of an entity? I can reach the GUI of a player, I can reach the entity whose gui is opened, but I cannot reach the gui itself. Is this possible? and if so, how?
THanks
Niko
Work on the gui of an entity
Re: Work on the gui of an entity
It's not possible.
If you want to get ahold of me I'm almost always on Discord.
Re: Work on the gui of an entity
But... why??
Seriously, could it be implemented? It would be great!

Seriously, could it be implemented? It would be great!
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: Work on the gui of an entity
You can detect when an entity is opened via http://lua-api.factorio.com/latest/LuaC ... rol.opened
But there's no way to get a handle to the GUI or change it's contents.
Some "workarounds" exist. For example, you can mod an item that doesn't have a GUI and then use .selected to see when player selects it: http://lua-api.factorio.com/latest/LuaC ... l.selected
Once you detect an appropriate selection, you can draw your own GUI.
Another alternate is to have a "custom-input" (keyboard shortcut) that can be used to open custom GUI for selected entity.
But there's no way to get a handle to the GUI or change it's contents.
Some "workarounds" exist. For example, you can mod an item that doesn't have a GUI and then use .selected to see when player selects it: http://lua-api.factorio.com/latest/LuaC ... l.selected
Once you detect an appropriate selection, you can draw your own GUI.
Another alternate is to have a "custom-input" (keyboard shortcut) that can be used to open custom GUI for selected entity.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: Work on the gui of an entity
Because the GUIs we create contain information that isn't deterministic and isn't always guaranteed to be safe to read from at any given point in time. Allowing mods to read it would lead to desyncs and crashes.Hermios wrote:But... why??![]()
Seriously, could it be implemented? It would be great!
If you want to get ahold of me I'm almost always on Discord.
Re: Work on the gui of an entity
Life is tough!
Well, I found a solution, wich is not so pretty, but it works.
Thanks for your help

Well, I found a solution, wich is not so pretty, but it works.
Thanks for your help