From 5508b614ce38404151addddc8779e7f9c006c955 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Mon, 20 Jan 2025 22:27:20 +0000 Subject: [PATCH] lint --- src/entities/playable/worm.ts | 2 -- src/frontend/components/menus/online-play.tsx | 12 +++++--- src/scenarios/netGame.ts | 1 - src/state/model.ts | 12 ++++---- src/state/player.ts | 28 +++++++++---------- src/state/recorder.ts | 10 +++++-- 6 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/entities/playable/worm.ts b/src/entities/playable/worm.ts index 4e69537..6b76181 100644 --- a/src/entities/playable/worm.ts +++ b/src/entities/playable/worm.ts @@ -529,7 +529,6 @@ export class Worm extends PlayableEntity { this.state.transition(InnerWormState.InactiveWaiting); } - this.onFireWeapon(this, this.currentWeapon, opts).then((fireResult) => { // Weapon has hit. this.turnEndedReason = EndTurnReason.FiredWeapon; @@ -681,7 +680,6 @@ export class Worm extends PlayableEntity { return; } - const falling = !this.isSinking && this.body.linvel().y > 4; this.targettingGfx.visible = diff --git a/src/frontend/components/menus/online-play.tsx b/src/frontend/components/menus/online-play.tsx index 03885b1..962637b 100644 --- a/src/frontend/components/menus/online-play.tsx +++ b/src/frontend/components/menus/online-play.tsx @@ -48,9 +48,10 @@ function LoggedInView({ .catch((ex) => { // TODO: Bubble up error. logger.info("Failed to create game", ex); - }).finally(() => { - setInProgress(false); }) + .finally(() => { + setInProgress(false); + }); }, [client]); useEffect(() => { @@ -113,8 +114,11 @@ function LoggedInView({ ) : null}

- diff --git a/src/scenarios/netGame.ts b/src/scenarios/netGame.ts index 930ff94..7841d7c 100644 --- a/src/scenarios/netGame.ts +++ b/src/scenarios/netGame.ts @@ -83,7 +83,6 @@ export default async function runScenario(game: Game) { wormInst.replayAim(dir, parseFloat(angle)); }); - player.on("wormActionFire", ({ id, opts }) => { const wormInst = wormInstances.get(id); if (!wormInst) { diff --git a/src/state/model.ts b/src/state/model.ts index bbd3fb6..0bc95be 100644 --- a/src/state/model.ts +++ b/src/state/model.ts @@ -1,7 +1,6 @@ import { RoundState } from "../logic/gamestate"; import { Team } from "../logic/teams"; import { NetworkFloat } from "../net/netfloat"; -import { Coordinate } from "../utils"; import { FireOpts, IWeaponCode } from "../weapons/weapon"; export interface RecordedEntityState { @@ -57,14 +56,13 @@ export type StateRecordWormActionFire = StateRecordLine<{ id: string; action: StateWormAction; opts?: { - duration?: number; - timer?: number; - angle?: number; - target?: { x: NetworkFloat, y: NetworkFloat} - } + duration?: number; + timer?: number; + angle?: number; + target?: { x: NetworkFloat; y: NetworkFloat }; + }; }>; - export type StateRecordWormActionFireParsed = StateRecordLine<{ id: string; action: StateWormAction; diff --git a/src/state/player.ts b/src/state/player.ts index 3434383..73e4260 100644 --- a/src/state/player.ts +++ b/src/state/player.ts @@ -113,22 +113,22 @@ export class StateReplay extends EventEmitter { processedData as StateRecordWormActionAim["data"], ); break; - case StateRecordKind.WormActionFire: + case StateRecordKind.WormActionFire: { const fireData = processedData as StateRecordWormActionFire["data"]; - this.emit( - "wormActionFire", - { - ...fireData, - opts: { - ...fireData.opts, - target: fireData.opts?.target ? Coordinate.fromWorld( - fromNetworkFloat(fireData.opts.target.x), - fromNetworkFloat(fireData.opts.target.y), - ) : undefined, - } - } - ); + this.emit("wormActionFire", { + ...fireData, + opts: { + ...fireData.opts, + target: fireData.opts?.target + ? Coordinate.fromWorld( + fromNetworkFloat(fireData.opts.target.x), + fromNetworkFloat(fireData.opts.target.y), + ) + : undefined, + }, + }); break; + } case StateRecordKind.WormSelectWeapon: this.emit( "wormSelectWeapon", diff --git a/src/state/recorder.ts b/src/state/recorder.ts index 6e53d9f..a3469bf 100644 --- a/src/state/recorder.ts +++ b/src/state/recorder.ts @@ -1,4 +1,4 @@ -import { toNetObject, toNetworkFloat } from "../net/netfloat"; +import { toNetworkFloat } from "../net/netfloat"; import { FireOpts, IWeaponCode } from "../weapons/weapon"; import { StateRecordHeader, @@ -42,7 +42,6 @@ export class StateRecorder { } satisfies StateRecordWormAction); } - public recordWormAim(worm: string, direction: "up" | "down", angle: number) { this.store.writeLine({ index: ++this.recordIndex, @@ -64,7 +63,12 @@ export class StateRecorder { id: worm, opts: { ...opts, - target: opts.target ? { x: toNetworkFloat(opts.target.worldX), y: toNetworkFloat(opts.target.worldY)} : undefined, + target: opts.target + ? { + x: toNetworkFloat(opts.target.worldX), + y: toNetworkFloat(opts.target.worldY), + } + : undefined, }, action: StateWormAction.Fire, },