diff --git a/src/client/graphics/layers/NameLayer.ts b/src/client/graphics/layers/NameLayer.ts index 2a1863c12..6ff96d51c 100644 --- a/src/client/graphics/layers/NameLayer.ts +++ b/src/client/graphics/layers/NameLayer.ts @@ -14,7 +14,7 @@ import { renderPlayerFlag } from "../../../core/CustomFlag"; import { EventBus } from "../../../core/EventBus"; import { PseudoRandom } from "../../../core/PseudoRandom"; import { Theme } from "../../../core/configuration/Config"; -import { AllPlayers, Cell, nukeTypes } from "../../../core/game/Game"; +import { AllPlayers, Cell, isNukeType } from "../../../core/game/Game"; import { GameView, PlayerView } from "../../../core/game/GameView"; import { UserSettings } from "../../../core/game/UserSettings"; import { AlternateViewEvent } from "../../InputHandler"; @@ -561,7 +561,7 @@ export class NameLayer implements Layer { const isSendingNuke = render.player.id() === unit.owner().id(); const notMyPlayer = !myPlayer || unit.owner().id() !== myPlayer.id(); return ( - nukeTypes.includes(unit.type()) && + isNukeType(unit.type()) && isSendingNuke && notMyPlayer && unit.isActive() diff --git a/src/core/game/Game.ts b/src/core/game/Game.ts index bacbda749..9b7a5208f 100644 --- a/src/core/game/Game.ts +++ b/src/core/game/Game.ts @@ -1,5 +1,6 @@ import { Config } from "../configuration/Config"; import { AllPlayersStats, ClientID } from "../Schemas"; +import { NukeType } from "../StatsSchemas"; import { GameMap, TileRef } from "./GameMap"; import { GameUpdate, @@ -267,6 +268,10 @@ export const nukeTypes = [ UnitType.MIRV, ] as const satisfies UnitType[]; +export function isNukeType(type: UnitType): type is NukeType { + return (nukeTypes as readonly UnitType[]).includes(type); +} + export enum Relation { Hostile = 0, Distrustful = 1,