Minor improvements
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user