Fix lineup index. (#38)

This commit is contained in:
GanyusLeftHorn 2022-08-04 05:37:57 +02:00 committed by GitHub
parent 4738e7c44a
commit 77d6b6dcee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 8 deletions

View File

@ -22,8 +22,11 @@ export default async function handle(command: Command, session: Session) {
if (!planeID) return c.log("Usage: /scene <planeID>");
const db = Database.getInstance();
await db.update('players',{_id:uid},{posData: { floorID: Number(planeID!.StartFloorID), planeID: Number(planeID!.PlaneID)}})
Interface.target.player.db.posData = {
floorID: Number(planeID!.StartFloorID),
planeID: Number(planeID!.PlaneID),
pos: Interface.target.player.db.posData.pos
};
await Interface.target.player.save()
//ty for tamilpp25 scene

View File

@ -16,7 +16,7 @@ export default async function handle(command: Command) {
SRServer.getInstance().sessions.forEach(client => {
possibleTargets.push({
id: `${client.ctx.address}:${client.ctx.port}`,
uid: Number(client.player.db._id),
uid: client.player.uid,
session: client
});
});

View File

@ -64,8 +64,6 @@ export default class Database {
}
return await _collection.insertOne(payload);
} catch (e) {
c.error("In set.")
c.error(payload)
c.error(e as Error);
}
}

View File

@ -94,7 +94,7 @@ export default class Player {
return {
...lineup,
index: 0,
index: index,
avatarList: lineupAvatars
}
}
@ -172,7 +172,7 @@ export default class Player {
for (let i = 0; i < LINEUPS; i++) {
const copy = {
...baseLineup,
index: 0,
index: i,
name: `Team ${i}`
};
dataObj.lineup.lineups[i] = copy;

View File

@ -36,7 +36,7 @@ export default async function handle(session: Session, packet: Packet) {
session.player.setLineup(lineup);
*/
session.player.save();
await session.player.save();
session.send(SyncLineupNotify, {
lineup: await session.player.getLineup(),