Hi,
Is there any event when the player enters my custom locomotive? I would like to automatically open the locomotive's ui.
Event when entering custom locomotive
-
- Burner Inserter
- Posts: 16
- Joined: Wed Apr 30, 2014 7:49 pm
- Contact:
Re: Event when entering custom locomotive
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.
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.
-
- Burner Inserter
- Posts: 16
- Joined: Wed Apr 30, 2014 7:49 pm
- Contact:
Re: Event when entering custom locomotive
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!
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!