Pathfinding: Cleaned up pathfinder.lua logs.
Changed init.lua to refer to proper files. Updated comment about Jumper library in pathfinder.lua
This commit is contained in:
		| @@ -5,8 +5,9 @@ | |||||||
| -- This class contains functions that allows to map the 3D map of Minetest into  | -- This class contains functions that allows to map the 3D map of Minetest into  | ||||||
| -- a 2D array (basically by ignoring the y coordinate for the moment being) in order | -- a 2D array (basically by ignoring the y coordinate for the moment being) in order | ||||||
| -- to use the A* pathfinding algorithm to find the shortest path from one node to | -- to use the A* pathfinding algorithm to find the shortest path from one node to | ||||||
| -- another. The A* algorithm implementation is in the external Jumper LUA library, | -- another. The A* algorithm implementation is in the 'jumper.lua' file which a  | ||||||
| -- by Roland Yonaba (https://github.com/Yonaba/Jumper). | -- reduced and slightly modified version of the Jumper library, by Roland Yonaba  | ||||||
|  | -- (https://github.com/Yonaba/Jumper). | ||||||
| -- Mapping algorithm: transforms a Minetest map surface to a 2d grid. | -- Mapping algorithm: transforms a Minetest map surface to a 2d grid. | ||||||
|  |  | ||||||
| pathfinder = {} | pathfinder = {} | ||||||
| @@ -96,8 +97,8 @@ end | |||||||
|  |  | ||||||
| function pathfinder.create_map(start_pos, end_pos, extra_range, walkables) | function pathfinder.create_map(start_pos, end_pos, extra_range, walkables) | ||||||
|  |  | ||||||
|   minetest.log("Start pos: "..dump(start_pos)) |   minetest.log("Start pos: "..minetest.pos_to_string(start_pos)) | ||||||
|   minetest.log("End pos: "..dump(end_pos)) |   minetest.log("End pos: "..minetest.pos_to_string(end_pos)) | ||||||
|  |  | ||||||
|   -- Calculate all signs to ensure: |   -- Calculate all signs to ensure: | ||||||
|   -- 1. Correct area calculation |   -- 1. Correct area calculation | ||||||
| @@ -180,7 +181,7 @@ end | |||||||
| -- for the pathfinding algorithm to use | -- for the pathfinding algorithm to use | ||||||
| function pathfinder.find_start_and_end_pos(map) | function pathfinder.find_start_and_end_pos(map) | ||||||
|   -- This is for debug |   -- This is for debug | ||||||
|   print_map(map) |   --print_map(map) | ||||||
|   local result = {} |   local result = {} | ||||||
|   for z,row in pairs(map) do |   for z,row in pairs(map) do | ||||||
|     for x,node in pairs(row) do |     for x,node in pairs(row) do | ||||||
| @@ -193,7 +194,7 @@ function pathfinder.find_start_and_end_pos(map) | |||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   minetest.log("Found start and end positions: "..dump(result)) |   --minetest.log("Found start and end positions: ("..result.start_pos.)..", "..minetest.pos_to_string(result.end_pos)) | ||||||
|   return result |   return result | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								init.lua
									
									
									
									
									
								
							| @@ -57,8 +57,7 @@ dofile(path .. "/trade/prices.lua") | |||||||
| dofile(path .. "/actions/actions.lua") | dofile(path .. "/actions/actions.lua") | ||||||
| dofile(path .. "/actions/places.lua") | dofile(path .. "/actions/places.lua") | ||||||
| dofile(path .. "/actions/pathfinder.lua") | dofile(path .. "/actions/pathfinder.lua") | ||||||
| dofile(path .. "/actions/pathfinding.lua") | dofile(path .. "/actions/jumper.lua") | ||||||
| --dofile(path .. "/actions/pathfinder2.lua") |  | ||||||
| dofile(path .. "/actions/node_registry.lua") | dofile(path .. "/actions/node_registry.lua") | ||||||
| dofile(path .. "/random_data.lua") | dofile(path .. "/random_data.lua") | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user