Minor improvements

This commit is contained in:
2025-02-06 13:12:19 +01:00
parent 9baffd1327
commit ba96ae7dd4
3 changed files with 18 additions and 11 deletions

View File

@ -29,6 +29,7 @@ class CharacterMoveService extends BaseService {
return null
}
// Ensure we're working with valid coordinates
const start: Position = {
positionX: Math.floor(character.positionX),
positionY: Math.floor(character.positionY)
@ -39,6 +40,11 @@ class CharacterMoveService extends BaseService {
positionY: Math.floor(targetY)
}
// Don't calculate path if start and end are the same
if (start.positionX === end.positionX && start.positionY === end.positionY) {
return null
}
return this.findPath(start, end, grid)
}