is it possible to extend a base entity's gui??

Place to get help with not working mods / modding interface.
zanven
Inserter
Inserter
Posts: 30
Joined: Thu Jul 07, 2016 2:11 am
Contact:

is it possible to extend a base entity's gui??

Post by zanven »

hi im just starting to mod an idea i had but i didn't want to re create the train station gui,

im just trying to add a extra checkbox option in the mode of operation box in the train station gui that would ideally pop up another box the same way enable/disable does.
i don't need to read any information in the gui except my custom content.

im guessing through all my googling this isn't possible but i have no idea what my other options would be :/.
321freddy
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Sep 23, 2016 10:16 pm
Contact:

Re: is it possible to extend a base entity's gui??

Post by 321freddy »

No this is not possible. However you can define a custom hotkey which, when pressed while hovering over a train station, opens up your custom gui. The custom gui can contain anything you want. This is probably the easiest solution to this.

Another possible workaround for this is detecting if the player has opened a train station gui and then attaching a custom gui window to the side of the main window by offsetting the position. This however has the issue that there is no way to detect the game resolution and gui scale, which means the attached window might be a bit off on different screens. I wouldn't recommend this.
zanven
Inserter
Inserter
Posts: 30
Joined: Thu Jul 07, 2016 2:11 am
Contact:

Re: is it possible to extend a base entity's gui??

Post by zanven »

thanks for that, is their any button already used in the modding community for such a hover button so i can stay consistent with the community and end user expectation? (also just learned using q while hovering items lets u place items of that type if you have them. QOL improved! xD)
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: is it possible to extend a base entity's gui??

Post by Choumiko »

zanven wrote:thanks for that, is their any button already used in the modding community for such a hover button so i can stay consistent with the community and end user expectation? (also just learned using q while hovering items lets u place items of that type if you have them. QOL improved! xD)
Most mods use LuaPlayer.gui.top for permanently visible buttons and LuaPlayer.gui.left for extended guis/toggable stuff (http://lua-api.factorio.com/latest/LuaP ... Player.gui)
321freddy
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Sep 23, 2016 10:16 pm
Contact:

Re: is it possible to extend a base entity's gui??

Post by 321freddy »

I think he ment the hotkey itself. And as far as I know there is no convention to hotkeys just pick the one that suits you best. These hotkeys can be changed by the user in the control settings. Upon hotkey press you can choose to add the gui panel either to LuaPlayer.gui.left (as Choumiko said) which is just below the top left corner of the screen, or to LuaPlayer.gui.center if you want to have something more like a popup.
Post Reply

Return to “Modding help”