Page 1 of 1
Custom console commands
Posted: Sun Aug 16, 2015 4:58 am
by erisco
From what I can tell, there is no way to receive mouse or keyboard events with a mod. Also there is no way to poll for the keyboard or mouse state per game tick. I am trying to find some way to activate the function of my mod. If those options are not available then the next best thing I can think of is to let the player toggle the function on and off using the in-game console. However, I cannot figure out how to add a custom console command -- it may also be impossible.
Thanks for your help.
Re: Custom console commands
Posted: Sun Aug 16, 2015 5:08 am
by erisco
I found that with "Script Interfaces" (see
https://forums.factorio.com/wiki/inde ... interfaces) you can also use the interface from the in-game console. In this way the player can communicate with your mod. However, it is unfortunately verbose, especially since the ideal solution is a single key press or button click.
Additionally, game.local_player is not defined when the player issues a remote.call from the console.
Re: Custom console commands
Posted: Sun Aug 16, 2015 6:33 am
by GopherAtl
You can also add custom guis, which many mods do. Can't actually override the gui that opens when you click a building, but you can create guis that are always visible, or that are created when the player is in proximity to something and removed when they leave.