Page 1 of 1

Event when entering custom locomotive

Posted: Tue Dec 30, 2014 5:10 pm
by MeinAccount
Hi,

Is there any event when the player enters my custom locomotive? I would like to automatically open the locomotive's ui.

Re: Event when entering custom locomotive

Posted: Tue Dec 30, 2014 5:52 pm
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.

Re: Event when entering custom locomotive

Posted: Tue Dec 30, 2014 7:16 pm
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!