[Solved] Artillery Projectile Created Event
Posted: Wed Jun 01, 2022 7:15 pm
The Problem:
I want to try and mod artillery-projectile behavior, like spawning effects below it or colliding with defensive enemy entities on the way.
For this, I need an event listener on artillery projectile creation, to keep track of all currently flying artillery projectiles.
My Journey:
I've read through all events available, where I found: on_trigger_fired_artillery which seems like what I want, getting a event every time a shell is fired, but just registering a listener in control.lua doesn't work, can I make the vanilla artillery give me these events? If yes how?
I know I should probably add trigger_fired_artillery=true somewhere in my data.raw[ artillery-projectile? artillery-turret? projectile? ], but I don't know where.
Resources I found already:
Here is the doc for on_trigger_fired_artillery: https://lua-api.factorio.com/1.1.59/eve ... _artillery
And here is an old thread I found, which feels related, I think it's telling me to change the artillery turret somewhere, but I don't understand how exactly: Factorio Forums: Entity Creation not detected
And here are three Prototypes I think are useful, but I don't know:
https://wiki.factorio.com/Prototype/ArtilleryTurret
https://wiki.factorio.com/Prototype/ArtilleryProjectile
https://wiki.factorio.com/Prototype/Projectile
I want to try and mod artillery-projectile behavior, like spawning effects below it or colliding with defensive enemy entities on the way.
For this, I need an event listener on artillery projectile creation, to keep track of all currently flying artillery projectiles.
My Journey:
I've read through all events available, where I found: on_trigger_fired_artillery which seems like what I want, getting a event every time a shell is fired, but just registering a listener in control.lua doesn't work, can I make the vanilla artillery give me these events? If yes how?
I know I should probably add trigger_fired_artillery=true somewhere in my data.raw[ artillery-projectile? artillery-turret? projectile? ], but I don't know where.
Resources I found already:
Here is the doc for on_trigger_fired_artillery: https://lua-api.factorio.com/1.1.59/eve ... _artillery
And here is an old thread I found, which feels related, I think it's telling me to change the artillery turret somewhere, but I don't understand how exactly: Factorio Forums: Entity Creation not detected
And here are three Prototypes I think are useful, but I don't know:
https://wiki.factorio.com/Prototype/ArtilleryTurret
https://wiki.factorio.com/Prototype/ArtilleryProjectile
https://wiki.factorio.com/Prototype/Projectile