1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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
This commit is contained in:
Wuzzy 2020-03-05 12:07:52 +01:00 committed by sfan5
parent 6d8e2d2483
commit 580e7e8eb9
4 changed files with 353 additions and 250 deletions

View file

@ -1194,7 +1194,7 @@ int ModApiEnvMod::l_find_path(lua_State *L)
unsigned int max_jump = luaL_checkint(L, 4);
unsigned int max_drop = luaL_checkint(L, 5);
PathAlgorithm algo = PA_PLAIN_NP;
if (!lua_isnil(L, 6)) {
if (!lua_isnoneornil(L, 6)) {
std::string algorithm = luaL_checkstring(L,6);
if (algorithm == "A*")