isNukeType

This commit is contained in:
Scott Anderson
2025-08-08 05:27:56 -04:00
parent df536ed089
commit 239046d3a4
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -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()
+5
View File
@@ -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,