Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Jan 20, 2025
1 parent 60528b5 commit 5508b61
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 31 deletions.
2 changes: 0 additions & 2 deletions src/entities/playable/worm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ export class Worm extends PlayableEntity<WormRecordedState> {
this.state.transition(InnerWormState.InactiveWaiting);
}


this.onFireWeapon(this, this.currentWeapon, opts).then((fireResult) => {
// Weapon has hit.
this.turnEndedReason = EndTurnReason.FiredWeapon;
Expand Down Expand Up @@ -681,7 +680,6 @@ export class Worm extends PlayableEntity<WormRecordedState> {
return;
}


const falling = !this.isSinking && this.body.linvel().y > 4;

this.targettingGfx.visible =
Expand Down
12 changes: 8 additions & 4 deletions src/frontend/components/menus/online-play.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -113,8 +114,11 @@ function LoggedInView({
</strong>
) : null}
</p>
<button onClick={createGameCallback} disabled={!localTeams?.length || gameCreationInProgress}>
{ gameCreationInProgress ? "Creating Lobby..." : "Create Lobby" }
<button
onClick={createGameCallback}
disabled={!localTeams?.length || gameCreationInProgress}
>
{gameCreationInProgress ? "Creating Lobby..." : "Create Lobby"}
</button>
</section>
</>
Expand Down
1 change: 0 additions & 1 deletion src/scenarios/netGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 5 additions & 7 deletions src/state/model.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
28 changes: 14 additions & 14 deletions src/state/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,22 @@ export class StateReplay extends EventEmitter<EventTypes> {
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",
Expand Down
10 changes: 7 additions & 3 deletions src/state/recorder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toNetObject, toNetworkFloat } from "../net/netfloat";
import { toNetworkFloat } from "../net/netfloat";
import { FireOpts, IWeaponCode } from "../weapons/weapon";
import {
StateRecordHeader,
Expand Down Expand Up @@ -42,7 +42,6 @@ export class StateRecorder {
} satisfies StateRecordWormAction);
}


public recordWormAim(worm: string, direction: "up" | "down", angle: number) {
this.store.writeLine({
index: ++this.recordIndex,
Expand All @@ -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,
},
Expand Down

0 comments on commit 5508b61

Please sign in to comment.