Use pathfinding algorithm to determine teleport validity.

This commit is contained in:
2023-07-06 03:22:05 -05:00
parent c97886fbbe
commit 46e3c7f7e7
8 changed files with 38 additions and 16 deletions
+3 -2
View File
@@ -435,6 +435,7 @@ std::vector<Buff>Player::GetBuffs(BuffType buff){
return filteredBuffs;
}
bool Player::CanPathfindTo(vf2d pos,vf2d targetPos){
return path.Solve_AStar(pos,targetPos)<8;//We'll say 7 tiles or less is close enough to 650 range. Have a little bit of wiggle room.
bool Player::CanPathfindTo(vf2d pos,vf2d targetPos,float range){
int pathLength=path.Solve_AStar(pos,targetPos);
return pathLength<8;//We'll say 7 tiles or less is close enough to 650 range. Have a little bit of wiggle room.
}