click event
Posted: Fri Mar 24, 2017 9:33 pm
Is there an event that fires whenever a player clicks? Or, even better, when a player clicks with a given item in their selection hand?
it does not list an event specifically for clicks./Factorio/doc-html/defines.html#defines.events
Nope, there is no event for this.Bizobinator wrote:Is there an event that fires whenever a player clicks?
There is, however, an event for this: http://lua-api.factorio.com/latest/even ... n_put_itemBizobinator wrote:Or, even better, when a player clicks with a given item in their selection hand?
Supercheese wrote:Nope, there is no event for this.Bizobinator wrote:Is there an event that fires whenever a player clicks?
There is, however, an event for this: http://lua-api.factorio.com/latest/even ... n_put_itemBizobinator wrote:Or, even better, when a player clicks with a given item in their selection hand?
Yes: https://github.com/Suprcheese/Orbital-I ... #L386-L397Bizobinator wrote:Yeah. I've read a bit of the code in a different mod. So, with that event, is it possible to, in between the starting to place & the entity being created, to have some code that stops the entity placement (& thus keeps the item in hand)?
Excellent! Yay!Supercheese wrote:Yes: https://github.com/Suprcheese/Orbital-I ... #L386-L397Bizobinator wrote:Yeah. I've read a bit of the code in a different mod. So, with that event, is it possible to, in between the starting to place & the entity being created, to have some code that stops the entity placement (& thus keeps the item in hand)?
Sure, go for it! I'm always happy to see folks get inspired and launch into Factorio modding.Bizobinator wrote:Excellent! Yay!
Supercheese, do you mind if I use your code for playing a sound too?
Hehehehehe, you have no idea what you've just unleashed xD