Fix linting
This commit is contained in:
parent
e5e928d99a
commit
e6376ad059
23 changed files with 33 additions and 58 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Command, GameObject } from 'shared';
|
||||
import { Command } from 'shared';
|
||||
|
||||
export class GeneratePointsCommand extends Command {
|
||||
public constructor(public readonly decla: number, public readonly red: number) {
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ export class GameServer extends CommandReceiver {
|
|||
private timeSinceLastPointUpdate = 0;
|
||||
|
||||
private handlePhysics() {
|
||||
let delta = this.deltaTimeCalculator.getNextDeltaTimeInSeconds();
|
||||
const delta = this.deltaTimeCalculator.getNextDeltaTimeInSeconds();
|
||||
if (delta > settings.targetPhysicsDeltaTimeInSeconds) {
|
||||
this.deltaTimeCalculator.getNextDeltaTimeInSeconds(true);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
export const interpolateAngles = (from: number, to: number, q: number) => {
|
||||
const max = Math.PI * 2;
|
||||
const possibleDistance = (to - from) % max;
|
||||
const shortedDistance = ((2 * possibleDistance) % max) - possibleDistance;
|
||||
return from + shortedDistance * q;
|
||||
const shorterDistance = ((2 * possibleDistance) % max) - possibleDistance;
|
||||
return from + shorterDistance * q;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import {
|
|||
MoveActionCommand,
|
||||
serializesTo,
|
||||
last,
|
||||
GameObject,
|
||||
Circle,
|
||||
CharacterBase,
|
||||
CharacterTeam,
|
||||
|
|
@ -370,10 +369,7 @@ export class CharacterPhysical extends CharacterBase implements DynamicPhysical
|
|||
|
||||
const sumForce = vec2.subtract(vec2.create(), leftFootGravity, movementForce);
|
||||
|
||||
this.setDirection(
|
||||
vec2.length(sumForce) === 0 ? vec2.fromValues(0, -1) : sumForce,
|
||||
deltaTimeInSeconds,
|
||||
);
|
||||
this.setDirection(vec2.length(sumForce) === 0 ? vec2.fromValues(0, -1) : sumForce);
|
||||
} else {
|
||||
const leftFootGravity = this.currentPlanet!.getForce(this.leftFoot.center);
|
||||
const rightFootGravity = this.currentPlanet!.getForce(this.rightFoot.center);
|
||||
|
|
@ -403,7 +399,7 @@ export class CharacterPhysical extends CharacterBase implements DynamicPhysical
|
|||
if (vec2.length(gravity) <= 100) {
|
||||
this.currentPlanet = undefined;
|
||||
}
|
||||
this.setDirection(gravity, deltaTimeInSeconds);
|
||||
this.setDirection(gravity);
|
||||
}
|
||||
|
||||
this.keepPosture(deltaTimeInSeconds);
|
||||
|
|
@ -414,7 +410,7 @@ export class CharacterPhysical extends CharacterBase implements DynamicPhysical
|
|||
this.setPropertyUpdates(oldHead, oldLeftFoot, oldRightFoot, deltaTimeInSeconds);
|
||||
}
|
||||
|
||||
private setDirection(direction: vec2, deltaTime: number) {
|
||||
private setDirection(direction: vec2) {
|
||||
this.direction = interpolateAngles(
|
||||
this.direction,
|
||||
Math.atan2(direction.y, direction.x) + Math.PI / 2,
|
||||
|
|
@ -423,7 +419,7 @@ export class CharacterPhysical extends CharacterBase implements DynamicPhysical
|
|||
}
|
||||
|
||||
private keepPosture(deltaTime: number) {
|
||||
let center = this.center;
|
||||
const center = this.center;
|
||||
this.springMove(
|
||||
this.leftFoot,
|
||||
center,
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export class CirclePhysical extends CommandReceiver implements Circle, DynamicPh
|
|||
.filter((b) => b.gameObject !== this.gameObject && b.canCollide);
|
||||
this.radius -= vec2.length(delta);
|
||||
|
||||
let { normal, hitSurface, hitObject } = moveCircle(this, delta, intersecting);
|
||||
const { normal, hitSurface, hitObject } = moveCircle(this, delta, intersecting);
|
||||
|
||||
if (hitSurface) {
|
||||
vec2.copy(this.lastNormal, normal!);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import {
|
|||
settings,
|
||||
serializesTo,
|
||||
ProjectileBase,
|
||||
GameObject,
|
||||
CharacterTeam,
|
||||
PropertyUpdatesForObject,
|
||||
UpdatePropertyCommand,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Circle, GameObject, rotate90Deg } from 'shared';
|
||||
import { GameObject } from 'shared';
|
||||
import { CirclePhysical } from '../../objects/circle-physical';
|
||||
import { evaluateSdf } from './evaluate-sdf';
|
||||
import { Physical } from '../physicals/physical';
|
||||
|
|
@ -23,7 +23,7 @@ export const moveCircle = (
|
|||
|
||||
const deltaLength = vec2.length(delta);
|
||||
let travelled = 0;
|
||||
let rayEnd = vec2.create();
|
||||
const rayEnd = vec2.create();
|
||||
let prevMinDistance = 0;
|
||||
while (travelled < deltaLength) {
|
||||
travelled += prevMinDistance;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue