Is there a way to get the creation tick for a specific entity?
I understand characters have tick_of_last_damage and tick_of_last_attack, but looking for something that would tell me for a particular unit, on what tick it was created to get sort of an "age" of it.
Entity Creation Tick
-
- Inserter
- Posts: 24
- Joined: Tue Jun 12, 2018 5:07 am
- Contact:
Re: Entity Creation Tick
As the thread has been posted under Modding interface requests, I take it you're not asking how to get the creation tick, but actually requesting a new modding interface. I second this!klugemonkey wrote: ↑Mon Mar 16, 2020 10:00 am Is there a way to get the creation tick for a specific entity?
Being able to get the age of an entity would help me with the problem to determine if a "fire-flame" is still burning or whether it's already in the entity.burnt_patch phase (where the fire seems to be out, but the fire entity still exists). In my mod, I mark fires with a dummy placed over it, which should be destroyed once the fire's lifetime has expired. I'm currently using an entity based on a combat-robot as marker because combat-robots have both health and lifetime and can therefore expire of their own. If it were possible to get the creation time of an entity, I could revert that and use a simple-entity-with-force again, which probably would improve performance somewhat (I guess the bouncing up and down of a bot isn't for free).
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: Entity Creation Tick
As far as I see it, we won't add this.
It would require storing the tick for every entity, which would be an extra 4 bytes for each entity in RAM and in the save game, and decrease memory cache performance,
For something that we would not use for the base game, so its likely not to happen
It would require storing the tick for every entity, which would be an extra 4 bytes for each entity in RAM and in the save game, and decrease memory cache performance,
For something that we would not use for the base game, so its likely not to happen
Re: Entity Creation Tick
Question from a non-modern: Is it possible to store extra data in entities you create? Can you get the current tick?
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm