In my mod I have a custom constant combinator. I've added the technology, recipe, item, entity prototypes and graphics for it. I can research the tech, craft the item and place the entity.
Now when the player clicks at my custom combinator the vanilla constant combinator GUI opens. I want to replace that with my own window that behaves just like the vanilla one.
Meaning:
- centered on the screen
- draggable with the mouse
- closes on ESC or E (close window hotkey)
- closes when another GUI is opened
How do I do that?
What I have tried so far is catching the on_gui_opened and on_gui_closed events. In on_gui_open I can create my own frame and fill it with some test elements. But then it's just hidden under the vanilla constant combinator GUI. If I set "player.opened = my_frame" then the vanilla GUI gets closed right away leaving just mine (on_gui_closed gets called for the entity). But it doesn't behave like a game window, doesn't close on ESC or E or when the crafting window is opened. on_gui_closed never gets called for my GUI.
Replacing the GUI for a custom constant-combinator
Re: Replacing the GUI for a custom constant-combinator
Never mind. After some sleep I finally found the problem. I had a typo in the final line:
So it assigned "nil" instead of my GUI, which then breaks closing the window. I figured out the rest from Bobs adjustable inserters mod.player.opened = main_fame