Follow is the piece of my code:
Code: Select all
self.path_id = entity.surface.request_path({
bounding_box = entity.bounding_box,
collision_mask = {"player-layer"},
start = entity.position,
goal = self.position,
force = entity.force,
})
surface.request_path may fail if i use it frequently. Once it failed, it always fails in future for a time.
In some case , the pathfinding algorithm cannot generate a straight way when there is no obstruction. By the way, is there any mod implement a custom pathfinding algorithm?