Big Bad Waffle 4 роки тому
джерело
коміт
1173a8e604
1 змінених файлів з 3 додано та 3 видалено
  1. +3
    -3
      src/server/world/map/canPathFromPos.js

+ 3
- 3
src/server/world/map/canPathFromPos.js Переглянути файл

@@ -5,13 +5,13 @@ const canPath = (pos, positions, maxDistance = 0) => {
return positions.some(p => {
const path = physics.getPath(pos, p);
//Are we on the position?
if (!path.length)
return true;
if (!path.length)
return (p.x === pos.x && p.y === pos.y);

const { x, y } = path[path.length - 1];
//Can we get close enough to the position?
const isCloseEnough = Math.max(Math.abs(p.x - x), Math.abs(p.y - y)) <= maxDistance;
if (isCloseEnough)
if (isCloseEnough)
return true;

return false;


Завантаження…
Відмінити
Зберегти