Better Air Filtering

by JoeyDP

An overhaul of the air filtering mod by Schorty. Includes complex air filtering steps to remove pollution.

Content
3 years ago
0.17 - 1.1
10.3K
Environment

b Possible crash on large numbers of entities destroyed

2 years ago

I make True-Nukes, and I've had a crash reported, which seems to be common to a few mods like this. When destroy is called on huge numbers of entities, it can cause the callbacks to not happen properly (or so it seems).
This means that calling destroy with raise_destroy=true can cause a crash. The fix should be fairly simple, in control.lua, change FilteredChunk:removeFilter, and make the if statement check valid first:

    if not f.valid then
        table.remove(self.filters, i)
    else if f.unit_number == filter.unit_number then
        table.remove(self.filters, i)
        break
    end

Then it should work nicely (I can't test this as I can't make the bug happen reliably...). The original report is here:
https://mods.factorio.com/mod/True-Nukes/discussion/626d8e9b3f4eac6fa2ad7d79

New response