Pollution API events
Posted: Mon Sep 11, 2017 5:26 pm
TL;DR
Factorio API is missing some pollution-related events which would better suit modders needs.What ?
https://wiki.factorio.com/PollutionConsider this topic tells us truth 'bout the mechanics, there are two events required:
on_pollution_spread - after (or before?) the pollution is recalculated.
LuaChunkIterator with all chunks modified (or all polluted?) would be enough for this event.
on_pollution_consumed - after pollution was consumed.
There it is required to somehow specify entities or types of consumers and the amount consumed. The best way to represent data here is an open question.
Optionally, there could be a sequence of on_pollution_consumed events, each for different consumer types (or even consumers) to clarify the order. I think it may depend on how it is calculated in game.
Why ?
There is a demand for more complex pollution-related mechanics already:viewtopic.php?f=6&t=52012
Me personally only need second event as I'm intended to implement the idea above and make pollution evolution spawner-oriented:
viewtopic.php?f=25&t=52416
But if we're talking 'bout extending API, it would be easier to think it all through.
You can deal with it on your own or you can leave it to us...
P.s. What is "TL;DR" stands for?