1
0
forked from noxious/server

Pathfinding spam fix, persistence character location without saving every step

This commit is contained in:
Zaxiure
2024-09-09 22:22:06 +02:00
parent 293b2be919
commit 592496861a
3 changed files with 55 additions and 26 deletions

View File

@ -6,7 +6,7 @@ import Rotation from '../../utilities/character/rotation'
import logger from '../../utilities/logger'
export class CharacterMoveService {
public async updatePosition(character: ExtendedCharacter, position: { x: number; y: number }, newZoneId?: number): Promise<void> {
public updatePosition(character: ExtendedCharacter, position: { x: number; y: number }, newZoneId?: number) {
Object.assign(character, {
positionX: position.x,
positionY: position.y,
@ -14,15 +14,15 @@ export class CharacterMoveService {
zoneId: newZoneId || character.zoneId
})
await prisma.character.update({
where: { id: character.id },
data: {
positionX: position.x,
positionY: position.y,
rotation: character.rotation,
zoneId: newZoneId
}
})
// await prisma.character.update({
// where: { id: character.id },
// data: {
// positionX: position.x,
// positionY: position.y,
// rotation: character.rotation,
// zoneId: newZoneId
// }
// })
}
public async calculatePath(character: ExtendedCharacter, targetX: number, targetY: number): Promise<Array<{ x: number; y: number }> | null> {