Page 1 of 1

How can I move the player to a safe spot?

Posted: Fri May 12, 2017 9:55 pm
by sparr
I am doing LuaSurface.set_tiles() and might put water or not-on-map under the player. This kills the player.

I'd like to teleport the player to a nearby safe-to-exist spot. Is there an easy way to find such a spot?

Re: How can I move the player to a safe spot?

Posted: Fri May 12, 2017 10:22 pm
by Nexela
First teleport player away, then place tiles then player.teleport(surface.find_non_colliding_position(players original position, other options))

Something like that anyway.