formating for linter

This commit is contained in:
bgoulard 2026-01-07 15:04:03 +01:00 committed by Nigel
parent 8df5c57b9a
commit 93d927e27f
2 changed files with 11 additions and 19 deletions

View file

@ -1,8 +1,6 @@
import { UserId } from '@shared/database/mixin/user';
import { randomInt } from 'crypto';
export class Paddle {
public static readonly DEFAULT_SPEED = 10;
public static readonly DEFAULT_HEIGHT = 80;
@ -155,28 +153,24 @@ export class Pong {
public userRight: UserId,
) { }
public readyup(uid : UserId)
{
public readyup(uid : UserId) {
if (uid === this.userLeft) {
this.ready_checks[LEFT] = true;
} if (uid === this.userRight) {
}
if (uid === this.userRight) {
this.ready_checks[RIGHT] = true;
}
}
public readydown(uid : UserId)
{
public readydown(uid : UserId) {
// is everyone already ready?
if (this.ready_checks[LEFT] === true && this.ready_checks[RIGHT] === true) return ;
if (uid === this.userLeft)
this.ready_checks[LEFT] = false;
if (uid === this.userRight)
this.ready_checks[RIGHT] = false;
if (uid === this.userLeft) { this.ready_checks[LEFT] = false; }
if (uid === this.userRight) { this.ready_checks[RIGHT] = false; }
}
public tick() {
if (!this.local && (this.ready_checks[LEFT] !== true || this.ready_checks[RIGHT] !== true))
return;
if (!this.local && (this.ready_checks[LEFT] !== true || this.ready_checks[RIGHT] !== true)) { return;}
if (this.paddleCollision(this.leftPaddle, 'left')) {
this.ball.collided(
'left',

View file

@ -74,14 +74,12 @@ class StateI {
// wait for ready up
// ---
g.tick();
if (g.sendSig === false && g.ready_checks[0] === true && g.ready_checks[1] === true)
{
if (g.sendSig === false && g.ready_checks[0] === true && g.ready_checks[1] === true) {
u1.socket.emit('rdyEnd');
u2.socket.emit('rdyEnd');
g.sendSig = true;
}
if (g.ready_checks[0] === true && g.ready_checks[1] === true)
{
if (g.ready_checks[0] === true && g.ready_checks[1] === true) {
this.gameUpdate(gameId, u1.socket);
this.gameUpdate(gameId, u2.socket);
}
@ -228,7 +226,7 @@ class StateI {
socket.emit('queueEvent', 'unregistered');
}
private readydownUser(socket: SSocket) : void { //
private readydownUser(socket: SSocket) : void {
// do we know this user ?
if (!this.users.has(socket.authUser.id)) return;
const user = this.users.get(socket.authUser.id)!;
@ -239,7 +237,7 @@ class StateI {
if (game.local === true) return;
game.readydown(user.id);
}
private readyupUser(socket: SSocket) : void { //
private readyupUser(socket: SSocket) : void {
// do we know this user ?
if (!this.users.has(socket.authUser.id)) return;
const user = this.users.get(socket.authUser.id)!;