Also, Sokomine, you gave me idea with the snow. Plotmarkers have to be walkable=false in order for it to find paths to/from it! Thank you!
I did change the definition of what walkable nodes are. I'm looking to get the list of nodes from a position to another, even if that means going through doors. To that end, I replaced the "walkable()" function in burli's pathfinder with this:Sokomine wrote: I don't think that the pathfinder can handle slabs or other nodebox-like nodes. It does seem to have no trouble with stairs, but then it might just consider jumping to be an option. When trying to get paths for the mobs to leave their beds and go outside (dry-run only), snow turned out to be an obstacle which made it impossible to get a path. As the new, higher snow also makes it impossible to enter houses as a player in some situations, I changed the snow node's definition so that it presents no obstacle to anyone:Some of my houses contain nodes that are very thin. Depending on param2, the very same node might either be floor, ceiling or a wall. Players can figure out where to walk, but for the pathfinding algorithm it's just a solid node, blocking movement in all directions.Code: Select all
minetest.override_item("default:snow", {walkable=false})
Code: Select all
local function walkable(node, exceptions)
local exceptions = exceptions or {}
local is_openable = false
for _,node_prefix in pairs(pathfinder.nodes.openable_prefix) do
local start_i,end_i = string.find(node.name, node_prefix)
if start_i ~= nil then
is_openable = true
break
end
end
if node ~= nil and node.name ~= nil and not minetest.registered_nodes[node.name].walkable then
return true
elseif is_openable then
return true
else
for i = 1, #exceptions do
if node.name == exceptions[i] then
return true
end
end
return false
end
end
I'm trying to find the path from the door to the stone-like node (the one I'm pointing to in Minetest, which is the plotmarker for that plot). I start from the door node, as I have already scanned it and know its position (actually starting from the bottom pos of the door). The end node is the plotmarker. However, it doesn't work. On the left side you can see the path it is "finding", and it is only the start node. I tried also changing the nodebox to be flat instead of 2/16 and that still doesn't works. I also changed the node to be walkable = false, but still same thing.
Any ideas?