The beams used by destroyer bots are used as ammo, and has a nice action parameter for the duration of the beam in ticks and the max length etc.
When creating a beam entity by script, using create_entity(), there is no way to set the duration/lifespan of the beam.
The beam just sits there, forever, running through the animation. I have to manually add the beam to a table and keep track of it and kill it after X game ticks.
Please add an optional parameter either to the beam prototype itself for specified lifespan for automatic self-destroy, or perhaps have this as a more generic parameter added to create_entity (can have other uses) so that ANY entity spawned by create_entity can have a timed lifespan, perhaps even with optional end-of-time function call/callback or even raised in case users want to catch the timeout and add a nice swirl of magic dust or something silly.
Pic for example of never-ending beam lol. Construction units trying to 'zap' building into existence, only their beams stayed forever!
Beam prototype with definable lifespan
Beam prototype with definable lifespan
- Attachments
-
- picture showing never-ending beams after construction
- unknown.png (624.08 KiB) Viewed 2133 times
Re: Beam prototype with definable lifespan
You can set duration and max_lenght as fields of table that you pass to create_entity.
I can see it is not documented for beams, though.
I can see it is not documented for beams, though.
Re: Beam prototype with definable lifespan
Ah hah! Awesome news, thank you very much. I can remove some global tables and tick logic now