forked from noxious/server
Pathfinding spam fix, persistence character location without saving every step
This commit is contained in:
@ -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> {
|
||||
|
Reference in New Issue
Block a user