forked from pikdum/thistle_tea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule ThistleTea.Pathfinding do | ||
def get_zone_and_area(map_id, {x, y, z}) do | ||
load_adt_at(map_id, {x, y}) | ||
ThistleTea.Namigator.get_zone_and_area(map_id, x, y, z) | ||
end | ||
|
||
def find_random_point_around_circle(map_id, {x, y, z}, radius) do | ||
load_adt_at(map_id, {x, y}) | ||
ThistleTea.Namigator.find_random_point_around_circle(map_id, x, y, z, radius) | ||
end | ||
|
||
def find_path(map_id, {start_x, start_y, start_z}, {stop_x, stop_y, stop_z}) do | ||
load_adt_at(map_id, {start_x, start_y}) | ||
load_adt_at(map_id, {stop_x, stop_y}) | ||
ThistleTea.Namigator.find_path(map_id, start_x, start_y, start_z, stop_x, stop_y, stop_z) | ||
end | ||
|
||
defp load_adt_at(map_id, {x, y}) do | ||
# TODO: store in :ets or similar, maybe with last access time, and unload periodically? | ||
ThistleTea.Namigator.load_adt_at(map_id, x, y) | ||
end | ||
end |