Pollution Solutions (updated 2.0)


Turn pollution and combat into an interconnected system. Destroy alien nests to obtain red xenomass for building pollution collectors and blue xenomass for converting pollution into electricity or resources. Minimalist mod that rewards active defense and complex systems over passive turrets.

Content
a month ago
2.0
1.01K
Enemies Fluids Manufacturing Power

b Lags

2 days ago

Hi, I noticed waved lags lately so i had to look where it comes from. It surprised me a bit but it was Pollution Solutions that ate UPS everytime a laser was attacking asterioids in space.

So i looked a bit in the source and found that all deaths are cause a calculation.
I changed the code local slightly now to fix this:

--script.on_event(defines.events.on_entity_died, function(event) OnEntityPreRemoved(event) end)
--script.on_event(defines.events.on_entity_died, function(event) EntityDied(event) end)
script.on_event(defines.events.on_entity_died, function(event)
local entity = event.entity
if not entity or not entity.valid then return end

-- ignore player-owned stuff
if entity.force == game.forces.player then return end

-- ignore asteroids
if string.find(entity.name, "asteroid", 1, true) then return end

OnEntityPreRemoved(event)
EntityDied(event)

end)

This also considers that there multiple factions for biters/player teams. So i only excluded player force and asteroids. This alone fixed it for me. UPS before peaked easy on 27 now its 0.038.
Please review the code since i am not often use lua.
Thank you a lot for port this mod.

New response