Blank entity to extend with 4way sprite?

Place to get help with not working mods / modding interface.
tubs
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Jan 06, 2015 7:29 pm
Contact:

Blank entity to extend with 4way sprite?

Post 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?
bubbels (sic)
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Blank entity to extend with 4way sprite?

Post by DaveMcW »

Constant combinator.
tubs
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Jan 06, 2015 7:29 pm
Contact:

Re: Blank entity to extend with 4way sprite?

Post 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?
bubbels (sic)
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5402
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Blank entity to extend with 4way sprite?

Post 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
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Blank entity to extend with 4way sprite?

Post by Optera »

It's much simpler to set operable = false in created events than close guis.
tubs
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Jan 06, 2015 7:29 pm
Contact:

Re: Blank entity to extend with 4way sprite?

Post 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?
bubbels (sic)
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Blank entity to extend with 4way sprite?

Post 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.
tubs
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Jan 06, 2015 7:29 pm
Contact:

Re: Blank entity to extend with 4way sprite?

Post 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
bubbels (sic)
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Blank entity to extend with 4way sprite?

Post by DaveMcW »

tubs
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Jan 06, 2015 7:29 pm
Contact:

Re: Blank entity to extend with 4way sprite?

Post by tubs »

DaveMcW wrote: Sat May 02, 2020 2:26 pm LuaPlayer.opened
This seems to return the entity rather than the gui though (unless I am going completely mad...)
bubbels (sic)
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Blank entity to extend with 4way sprite?

Post by DaveMcW »

Correct, you can't edit the constant combinator gui. All you know is that the gui for that entity is open.
tubs
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Jan 06, 2015 7:29 pm
Contact:

Re: Blank entity to extend with 4way sprite?

Post 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.
bubbels (sic)
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Blank entity to extend with 4way sprite?

Post 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:

Code: Select all

player.opened = nil
Post Reply

Return to “Modding help”