Use user IDs instead of names

This commit is contained in:
PizZaKatZe 2021-12-15 14:48:45 +01:00
parent e528682403
commit 2bd71790b5
9 changed files with 48 additions and 57 deletions

View file

@ -1715,10 +1715,6 @@ ${escapedMessage}
});
}
public findPlayer(testFunction: (player: RemotePlayer) => boolean): RemotePlayer | undefined {
return Array.from(this.MapPlayersByKey.values()).find(testFunction);
}
/**
* Called by the connexion when a new player arrives on a map
*/

View file

@ -86,9 +86,9 @@ export class Player extends Character {
private computeFollowMovement(): number[] {
// Find followed WOKA and abort following if we lost it
const player = this.scene.findPlayer((p) => p.PlayerValue === get(followUsersStore)[0]);
const player = this.scene.MapPlayersByKey.get(get(followUsersStore)[0]);
if (!player) {
this.scene.connection?.emitFollowAbort(get(followUsersStore)[0], this.PlayerValue);
this.scene.connection?.emitFollowAbort();
followStateStore.set(followStates.off);
return [0, 0];
}