Entity Creation Tick

Things that we aren't going to implement
klugemonkey
Inserter
Inserter
Posts: 24
Joined: Tue Jun 12, 2018 5:07 am
Contact:

Entity Creation Tick

Post by klugemonkey »

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.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1735
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Entity Creation Tick

Post by Pi-C »

klugemonkey wrote: Mon Mar 16, 2020 10:00 am Is there a way to get the creation tick for a specific entity?
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!

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!
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Entity Creation Tick

Post by Klonan »

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
Trebor
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Apr 30, 2017 1:39 pm
Contact:

Re: Entity Creation Tick

Post by Trebor »

Question from a non-modern: Is it possible to store extra data in entities you create? Can you get the current tick?
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Entity Creation Tick

Post by Deadlock989 »

Trebor wrote: Tue Mar 17, 2020 12:21 pm Question from a non-modern: Is it possible to store extra data in entities you create? Can you get the current tick?
1) Not literally "in" the entity, but you could maintain a global look-up table of entity -> tick
2) Yes
Post Reply

Return to “Won't implement”