On biter nest absorb pollution... Do

Place to get help with not working mods / modding interface.
reaperrar
Burner Inserter
Burner Inserter
Posts: 16
Joined: Mon Mar 14, 2016 5:47 am
Contact:

On biter nest absorb pollution... Do

Post by reaperrar »

Whenever a biter nest absorbs pollution, I'd like to hook into the event with a reference to the nest and how much pollution was absorbed.
Can that be done?

If not, at a fixed rate I'd like to iterate over all biters nests in tiles that have pollution... with a reference to the tile pollution total and biter nest per iteration. Is that feasible? I'm not sure how to implement this without affecting performance too heavily.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14363
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: On biter nest absorb pollution... Do

Post by Rseding91 »

reaperrar wrote:Whenever a biter nest absorbs pollution, I'd like to hook into the event with a reference to the nest and how much pollution was absorbed.
Can that be done?
No, there's no such event and there isn't likely to be one as it would add a large constant overhead for minimal gains as pollution absorption happens frequently.
If you want to get ahold of me I'm almost always on Discord.
reaperrar
Burner Inserter
Burner Inserter
Posts: 16
Joined: Mon Mar 14, 2016 5:47 am
Contact:

Re: On biter nest absorb pollution... Do

Post by reaperrar »

Rseding91 wrote: No, there's no such event and there isn't likely to be one as it would add a large constant overhead for minimal gains as pollution absorption happens frequently.
Cheers.

If anyone is interested...
I ended up finding all nests on game init and also added to my array when they are built.
Every game tick my iteration loop only iterates over a certain number of nests per tick (with the entire iteration deferred over multiple game ticks) and using the delta from last tick per nest to scale my calculations.
It isn't entirely accurate due to the deferring (nabbing the tile pollution at iteration time) but it's close enough.
Post Reply

Return to “Modding help”