Page 1 of 1
Blank entity to extend with 4way sprite?
Posted: Fri May 01, 2020 5:19 pm
by tubs
Hi,
If I want an entity/prototype to extend that supports 4way sprites but doesn't have any special logic like an assembly machine, which entity would I use?
Re: Blank entity to extend with 4way sprite?
Posted: Fri May 01, 2020 6:30 pm
by DaveMcW
Constant combinator.
Re: Blank entity to extend with 4way sprite?
Posted: Fri May 01, 2020 7:41 pm
by tubs
That has a GUI already associated with it though?
Is the correct thing to do check player.selected every few ticks, close the default gui (if open) and open my custom gui?
Re: Blank entity to extend with 4way sprite?
Posted: Fri May 01, 2020 7:46 pm
by Klonan
tubs wrote: Fri May 01, 2020 7:41 pm
That has a GUI already associated with it though?
Is the correct thing to do check player.selected every few ticks, close the default gui (if open) and open my custom gui?
You can just listen to on_gui_opened:
https://lua-api.factorio.com/latest/eve ... gui_opened
Re: Blank entity to extend with 4way sprite?
Posted: Fri May 01, 2020 8:10 pm
by Optera
It's much simpler to set operable = false in created events than close guis.
Re: Blank entity to extend with 4way sprite?
Posted: Fri May 01, 2020 8:11 pm
by tubs
Thanks Klonan!
Optera, if I set operable to false, can I still open my own gui when the player clicks on the entity?
Re: Blank entity to extend with 4way sprite?
Posted: Sat May 02, 2020 5:36 am
by Optera
I didn't read the part about custom gui.
In that case, Klonans way of closing the base gui is easier. Otherwise you'd have to monitor every click.
Re: Blank entity to extend with 4way sprite?
Posted: Sat May 02, 2020 1:04 pm
by tubs
Klonan wrote: Fri May 01, 2020 7:46 pm
tubs wrote: Fri May 01, 2020 7:41 pm
That has a GUI already associated with it though?
Is the correct thing to do check player.selected every few ticks, close the default gui (if open) and open my custom gui?
You can just listen to on_gui_opened:
https://lua-api.factorio.com/latest/eve ... gui_opened
How do I get the gui that was opened? I can see it open on the screen but in the debugger I can't find it under player.gui
Re: Blank entity to extend with 4way sprite?
Posted: Sat May 02, 2020 2:26 pm
by DaveMcW
Re: Blank entity to extend with 4way sprite?
Posted: Sat May 02, 2020 2:50 pm
by tubs
This seems to return the entity rather than the gui though (unless I am going completely mad...)
Re: Blank entity to extend with 4way sprite?
Posted: Sat May 02, 2020 6:58 pm
by DaveMcW
Correct, you can't edit the constant combinator gui. All you know is that the gui for that entity is open.
Re: Blank entity to extend with 4way sprite?
Posted: Sat May 02, 2020 7:14 pm
by tubs
Right, so this brings us all the way back to the start.
Is there an entity that supports 4way sprites that does not have a GUI (or at least, an empty one like an accumulator)?
I can do it with LuaRendering but that would, I assume, suck.
Re: Blank entity to extend with 4way sprite?
Posted: Sat May 02, 2020 7:30 pm
by DaveMcW
tubs wrote: Sat May 02, 2020 7:14 pmIs there an entity that supports 4way sprites that
does not have a GUI (or at least, an empty one like an accumulator)?
No.
What you really want is: