DM needs a variant of get_step_to() that returns a list of turfs that were pathed through for the successful pathfinding operation.
The return format will be a list containing all the turfs between ref and trg. that result in a successful path. Arguments will exactly mirror get_step_to().
In the case of a pathfinding failure, that list will be slightly different. The first element in the list will be null. All subsequent elements will be all the turfs that tied for the closest distance to ref that the mover could reach.
If the mover is already within range of the target, the proc will return null.
This will allow developers to optimize their pathfinding solutions much easier than the built-in method does, alleviating one of the complaints about DM that results in built-in pathfinding being "best avoided".
ID:2149190
Sep 17 2016, 10:52 pm
|
|||||||
| |||||||
Sep 18 2016, 2:38 pm
|
|
Rather than turfs, I think it'd make sense to return a list of directions.
|
That'd work too. Except for the fallback. The fallback needs to be a list of the highest-scoring locations so that we can potentially pick a position to attempt to walk toward in the case of an unreachable target.
Or shit, maybe just return the distance of the closest scoring locations from the player and we can re-attempt to pathfind to within X tiles of target. |