formating for linter
This commit is contained in:
parent
8df5c57b9a
commit
93d927e27f
2 changed files with 11 additions and 19 deletions
|
|
@ -1,8 +1,6 @@
|
||||||
import { UserId } from '@shared/database/mixin/user';
|
import { UserId } from '@shared/database/mixin/user';
|
||||||
import { randomInt } from 'crypto';
|
import { randomInt } from 'crypto';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class Paddle {
|
export class Paddle {
|
||||||
public static readonly DEFAULT_SPEED = 10;
|
public static readonly DEFAULT_SPEED = 10;
|
||||||
public static readonly DEFAULT_HEIGHT = 80;
|
public static readonly DEFAULT_HEIGHT = 80;
|
||||||
|
|
@ -155,28 +153,24 @@ export class Pong {
|
||||||
public userRight: UserId,
|
public userRight: UserId,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
public readyup(uid : UserId)
|
public readyup(uid : UserId) {
|
||||||
{
|
|
||||||
if (uid === this.userLeft) {
|
if (uid === this.userLeft) {
|
||||||
this.ready_checks[LEFT] = true;
|
this.ready_checks[LEFT] = true;
|
||||||
} if (uid === this.userRight) {
|
}
|
||||||
|
if (uid === this.userRight) {
|
||||||
this.ready_checks[RIGHT] = true;
|
this.ready_checks[RIGHT] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public readydown(uid : UserId)
|
public readydown(uid : UserId) {
|
||||||
{
|
|
||||||
// is everyone already ready?
|
// is everyone already ready?
|
||||||
if (this.ready_checks[LEFT] === true && this.ready_checks[RIGHT] === true) return ;
|
if (this.ready_checks[LEFT] === true && this.ready_checks[RIGHT] === true) return ;
|
||||||
|
|
||||||
if (uid === this.userLeft)
|
if (uid === this.userLeft) { this.ready_checks[LEFT] = false; }
|
||||||
this.ready_checks[LEFT] = false;
|
if (uid === this.userRight) { this.ready_checks[RIGHT] = false; }
|
||||||
if (uid === this.userRight)
|
|
||||||
this.ready_checks[RIGHT] = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public tick() {
|
public tick() {
|
||||||
if (!this.local && (this.ready_checks[LEFT] !== true || this.ready_checks[RIGHT] !== true))
|
if (!this.local && (this.ready_checks[LEFT] !== true || this.ready_checks[RIGHT] !== true)) { return;}
|
||||||
return;
|
|
||||||
if (this.paddleCollision(this.leftPaddle, 'left')) {
|
if (this.paddleCollision(this.leftPaddle, 'left')) {
|
||||||
this.ball.collided(
|
this.ball.collided(
|
||||||
'left',
|
'left',
|
||||||
|
|
|
||||||
|
|
@ -74,14 +74,12 @@ class StateI {
|
||||||
// wait for ready up
|
// wait for ready up
|
||||||
// ---
|
// ---
|
||||||
g.tick();
|
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');
|
u1.socket.emit('rdyEnd');
|
||||||
u2.socket.emit('rdyEnd');
|
u2.socket.emit('rdyEnd');
|
||||||
g.sendSig = true;
|
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, u1.socket);
|
||||||
this.gameUpdate(gameId, u2.socket);
|
this.gameUpdate(gameId, u2.socket);
|
||||||
}
|
}
|
||||||
|
|
@ -228,7 +226,7 @@ class StateI {
|
||||||
socket.emit('queueEvent', 'unregistered');
|
socket.emit('queueEvent', 'unregistered');
|
||||||
}
|
}
|
||||||
|
|
||||||
private readydownUser(socket: SSocket) : void { //
|
private readydownUser(socket: SSocket) : void {
|
||||||
// do we know this user ?
|
// do we know this user ?
|
||||||
if (!this.users.has(socket.authUser.id)) return;
|
if (!this.users.has(socket.authUser.id)) return;
|
||||||
const user = this.users.get(socket.authUser.id)!;
|
const user = this.users.get(socket.authUser.id)!;
|
||||||
|
|
@ -239,7 +237,7 @@ class StateI {
|
||||||
if (game.local === true) return;
|
if (game.local === true) return;
|
||||||
game.readydown(user.id);
|
game.readydown(user.id);
|
||||||
}
|
}
|
||||||
private readyupUser(socket: SSocket) : void { //
|
private readyupUser(socket: SSocket) : void {
|
||||||
// do we know this user ?
|
// do we know this user ?
|
||||||
if (!this.users.has(socket.authUser.id)) return;
|
if (!this.users.has(socket.authUser.id)) return;
|
||||||
const user = this.users.get(socket.authUser.id)!;
|
const user = this.users.get(socket.authUser.id)!;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue