diff options
author | Wuzzy <Wuzzy2@mail.ru> | 2020-03-05 12:07:52 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2020-03-05 12:09:44 +0100 |
commit | 580e7e8eb902ae2faed36b4982e7e751e35f5201 (patch) | |
tree | dfb3d71a2d6777c1896a285585c8c798c92790ea /doc | |
parent | 6d8e2d2483715f05216be86a32f664bcbaac3efe (diff) | |
download | minetest-580e7e8eb902ae2faed36b4982e7e751e35f5201.tar.gz minetest-580e7e8eb902ae2faed36b4982e7e751e35f5201.tar.bz2 minetest-580e7e8eb902ae2faed36b4982e7e751e35f5201.zip |
Fix pathfinder bugs: returning nil frequently, broken A*, jump through solid nodes (#9339)
* Fix pathfinder fail when startpos is over air
* Note down pathfinder restrictions
* Implement real A* search
* Pathfinder: Implement buildPath non-recursively
* Update find_path documentation
* Pathfinder: Check if jump path is unobstructed
* Pathfinder: Fix drop check first checking upwards
* Pathfinder: Return nil if source or dest are solid
* Pathfinder: Use priority queue for open list
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lua_api.txt | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 4b7132828..af0d35f61 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -4045,6 +4045,8 @@ Utilities formspec_version_element = true, -- Whether AreaStore's IDs are kept on save/load (5.1.0) area_store_persistent_ids = true, + -- Whether minetest.find_path is functional (5.2.0) + pathfinder_works = true, } * `minetest.has_feature(arg)`: returns `boolean, missing_features` @@ -4709,16 +4711,25 @@ Environment access * `objects`: if false, only nodes will be returned. Default is `true`. * `liquids`: if false, liquid nodes won't be returned. Default is `false`. * `minetest.find_path(pos1,pos2,searchdistance,max_jump,max_drop,algorithm)` - * returns table containing path + * returns table containing path that can be walked on * returns a table of 3D points representing a path from `pos1` to `pos2` or - `nil`. + `nil` on failure. + * Reasons for failure: + * No path exists at all + * No path exists within `searchdistance` (see below) + * Start or end pos is buried in land * `pos1`: start position * `pos2`: end position - * `searchdistance`: number of blocks to search in each direction using a - maximum metric. + * `searchdistance`: maximum distance from the search positions to search in. + In detail: Path must be completely inside a cuboid. The minimum + `searchdistance` of 1 will confine search between `pos1` and `pos2`. + Larger values will increase the size of this cuboid in all directions * `max_jump`: maximum height difference to consider walkable * `max_drop`: maximum height difference to consider droppable - * `algorithm`: One of `"A*_noprefetch"` (default), `"A*"`, `"Dijkstra"` + * `algorithm`: One of `"A*_noprefetch"` (default), `"A*"`, `"Dijkstra"`. + Difference between `"A*"` and `"A*_noprefetch"` is that + `"A*"` will pre-calculate the cost-data, the other will calculate it + on-the-fly * `minetest.spawn_tree (pos, {treedef})` * spawns L-system tree at given `pos` with definition in `treedef` table * `minetest.transforming_liquid_add(pos)` |