Page 1 of 1

Beam prototype with definable lifespan

Posted: Wed Aug 22, 2018 3:33 pm
by kyranzor
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!

Re: Beam prototype with definable lifespan

Posted: Wed Aug 22, 2018 3:50 pm
by posila
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.

Re: Beam prototype with definable lifespan

Posted: Thu Aug 23, 2018 10:07 am
by kyranzor
Ah hah! Awesome news, thank you very much. I can remove some global tables and tick logic now ;)