[Used google translate]
The LuaSurface.pollute(...) method has an implicit additional effect: it increases the value of the evolution factor when the parameter is positive.
Can I ask to add an analog of this method to the API, for example, called "set_pollute( MapPosition, double )" which will set the specified "double" value in the specified chunk (not add, but set) and without affecting the evolution factor.
At a minimum, this should be a lighter function than its current version and which will be suitable for mass use with manual (LUA) pollution control on the map.
LuaSurface.pollute(...) without influence on evolution
Re: LuaSurface.pollute(...) without influence on evolution
That seems fine, however it’s not going to meaningful impact performance to do or not change the evolution factor.
If you want to get ahold of me I'm almost always on Discord.
Re: LuaSurface.pollute(...) without influence on evolution
[Used google translate]Rseding91 wrote: Thu Apr 24, 2025 11:13 pm That seems fine, however it’s not going to meaningful impact performance to do or not change the evolution factor.
It may not have a significant effect on performance in the method itself, but when the very fact of the presence of this effect is undesirable, the load on performance can be felt more when it is necessary to build additional logic code to compensate for this effect.
Instead of being able to write like this:
Code: Select all
for ... in pairs( list_chunks ) do
local pol_count = surface.get_pollution( pos_A )
surface.set_pollute( pos_A , 0 )
surface.set_pollute( pos_B , pol_count )
end
Only to remove the secondary effect with the growth of evolution from the ".pollute()" method
And here it becomes clear that the direct + indirect performance costs (LUA additional logic and actions) are no longer as small as it may seem for such a simple function.
P.S. Especially when you need to work with all the chunks in the world
Re: LuaSurface.pollute(...) without influence on evolution
Not against your specific request, but I think you should be able to do this already, maybe to help unblock your project 

Code: Select all
local evo = force.get_evolution_factor_by_pollution(surface)
for ... in pairs( list_chunks ) do
local pol_count = surface.get_pollution( pos_A )
surface.set_pollute( pos_A , 0 )
surface.set_pollute( pos_B , pol_count )
end
force.set_evolution_factor_by_pollution(evo, surface)
Re: LuaSurface.pollute(...) without influence on evolution
[Used google translate]berggen wrote: Thu May 01, 2025 4:32 pm Not against your specific request, but I think you should be able to do this already, maybe to help unblock your project
Code: Select all
local evo = force.get_evolution_factor_by_pollution(surface) for ... in pairs( list_chunks ) do local pol_count = surface.get_pollution( pos_A ) surface.set_pollute( pos_A , 0 ) surface.set_pollute( pos_B , pol_count ) end force.set_evolution_factor_by_pollution(evo, surface)
Unfortunately, I have to disappoint you, what you are proposing is just part of this problem.
You can't remember the current value and "sort of" return it back after the cycle, since the evolution value will increase post-factum after the script has run.
It turns out that you are trying to change the value that has not yet been changed due to your intervention.
I have already implemented a crutch solution to this problem here:
https://mods.factorio.com/mod/Pollution ... bbon-world
And its meaning was this: that at the end of the cycle it was necessary to sum up the value of the transferred pollution, and then, using a formula, calculate the value of evolution that would have preceded the current one if this value of the summed pollution had been added to it.
And this solution seems to work perfectly accurately.
So, returning to the topic of the function request, perhaps I was wrong in that I initially did not describe in detail what the essence of the problem was and the different aspects affected directly and indirectly.
Re: LuaSurface.pollute(...) without influence on evolution
Implemented for 2.0.48: Added LuaSurface::set_pollution.