forked from noxious/server
Improved walking
This commit is contained in:
parent
2490b08479
commit
3c0b713af0
@ -21,7 +21,7 @@ export default function (socket: TSocket, io: Server) {
|
||||
socket.character.position_x = data.position_x;
|
||||
socket.character.position_y = data.position_y;
|
||||
|
||||
await CharacterRepository.update(socket.character);
|
||||
await CharacterRepository.updatePosition(socket.character.id as number, data.position_x, data.position_y);
|
||||
ZoneManager.updateCharacterInZone(socket.character.zoneId, socket.character);
|
||||
console.log(socket.character);
|
||||
|
||||
|
@ -23,6 +23,9 @@ class CharacterRepository {
|
||||
userId,
|
||||
id: characterId,
|
||||
},
|
||||
include: {
|
||||
zone: true
|
||||
}
|
||||
});
|
||||
} catch (error: any) {
|
||||
// Handle error
|
||||
@ -62,13 +65,16 @@ class CharacterRepository {
|
||||
}
|
||||
}
|
||||
|
||||
async update(character: Character): Promise<Character | null> {
|
||||
async updatePosition(id:number, position_x: number, position_y: number): Promise<Character | null> {
|
||||
try {
|
||||
return await prisma.character.update({
|
||||
where: {
|
||||
id: character.id,
|
||||
id: id,
|
||||
},
|
||||
data: {
|
||||
position_x,
|
||||
position_y,
|
||||
},
|
||||
data: character
|
||||
});
|
||||
} catch (error: any) {
|
||||
// Handle error
|
||||
|
Loading…
x
Reference in New Issue
Block a user