Stop moving if path is invalid
This commit is contained in:
parent
17fa2a8f6e
commit
9f84247839
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user