raduprv / Eternal-Lands

http://www.eternal-lands.com
Other
155 stars 56 forks source link

Make the pathfinder more flexible. #171

Closed gvissers closed 2 years ago

gvissers commented 2 years ago

When clicking on an unwalkable tile, the pathfinder will give up immediately and refuse to walk anywhere. This is annoying when navigating terrain with many obstacles, as a walk will be interrupted many times. Instead of giving up, walk to a walkable tile as close as possible to the destination, if that tile is within a specified number of steps (currently 2) from the destination tile. Since the tile is returned that is first found in the search, situations where the actor goes off on a tangent unnecessarily to walk to the nearest tile on the other side of a fence should be avoided, at least in cases where there is a tile within the same distance on the actor's side of the fence.