1
0
forked from noxious/server

Stop moving if path is invalid

This commit is contained in:
Dennis Postma 2025-02-16 01:35:25 +01:00
parent 17fa2a8f6e
commit 9f84247839

View File

@ -57,12 +57,16 @@ export default class CharacterMove extends BaseEvent {
const path = await CharacterMoveService.calculatePath(character, Math.floor(positionX), Math.floor(positionY)) const path = await CharacterMoveService.calculatePath(character, Math.floor(positionX), Math.floor(positionY))
if (!path?.length) { if (!path?.length) {
// Ensure movement state is cleaned up for invalid paths
mapCharacter.isMoving = false
mapCharacter.currentPath = null
CharacterMoveService.broadcastMovement(character, false)
return return
} }
// Set new movement state // Only set movement state if we have a valid path
mapCharacter.isMoving = true
mapCharacter.currentPath = path mapCharacter.currentPath = path
mapCharacter.isMoving = true
this.isProcessingMove = true this.isProcessingMove = true
// Start the movement // Start the movement