Code: Select all
game.player.surface.find_non_colliding_position('car', game.player.position, 10, 1)
When using a precision of 2 it works, in that I have not seen the returned position being invalid.
The same can also be seen when using 'character' instead of 'car' with a precision value of 0.5, which also causes the returned position to be invalid. This can no longer be observed (in my experience) when using 1 as a precision value instead.
This happens most frequently with cliffs, but with the character I have also observed it with rocks.
According to the function name and the description the function is supposed to take into account the collision box of the prototype specified, but this does not seem to be working correctly sometimes.