Event when entering custom locomotive

Place to get help with not working mods / modding interface.
MeinAccount
Burner Inserter
Burner Inserter
Posts: 16
Joined: Wed Apr 30, 2014 7:49 pm
Contact:

Event when entering custom locomotive

Post by MeinAccount »

Hi,

Is there any event when the player enters my custom locomotive? I would like to automatically open the locomotive's ui.
Kexík
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Mon Dec 01, 2014 12:52 pm
Contact:

Re: Event when entering custom locomotive

Post by Kexík »

Hi,
You can find all events in Factorio/data/core/lualib/defines.lua I dont see any event that could do that, but you can do workaround
If you look to my EventHandler to function SelectionHandler that i call every 6th tick (10 times per sec)
You will see that i check if player have open any entity and check it with his last open that i have saved in glob.AlphaMod.playersSelection.

You can do exactly the same only you will not use player.opened but player.vehicle.

Problem is (or at least i dont know if its possible) that you cant open and close trane base gui. But if you wanna use it for custom gui it should work.
MeinAccount
Burner Inserter
Burner Inserter
Posts: 16
Joined: Wed Apr 30, 2014 7:49 pm
Contact:

Re: Event when entering custom locomotive

Post by MeinAccount »

Hi,

Thank you! I'll take a look on it later. A custom GUI would have been my next question but you mod seems to have some good example code in the liquid splitter.

Thanks!
Post Reply

Return to “Modding help”