mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-12 20:46:01 +00:00
Enable the sort-imports eslint rule (#1849)
## Description: Enable the `sort-imports` eslint rule. Fixes #1784 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// This file contains schemas for api.openfront.io
|
||||
import { z } from "zod";
|
||||
import { base64urlToUuid } from "./Base64";
|
||||
import { z } from "zod";
|
||||
|
||||
export const RefreshResponseSchema = z.object({
|
||||
token: z.string(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { RequiredPatternSchema } from "./Schemas";
|
||||
import { z } from "zod";
|
||||
|
||||
export const ProductSchema = z.object({
|
||||
productId: z.string(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This file contians schemas for the primary openfront express server
|
||||
import { z } from "zod";
|
||||
import { GameInfoSchema } from "./Schemas";
|
||||
import { z } from "zod";
|
||||
|
||||
export const ApiEnvResponseSchema = z.object({
|
||||
game_env: z.string(),
|
||||
|
||||
+11
-11
@@ -1,7 +1,3 @@
|
||||
import { placeName } from "../client/graphics/NameBoxCalculator";
|
||||
import { getConfig } from "./configuration/ConfigLoader";
|
||||
import { Executor } from "./execution/ExecutionManager";
|
||||
import { WinCheckExecution } from "./execution/WinCheckExecution";
|
||||
import {
|
||||
AllPlayers,
|
||||
Attack,
|
||||
@@ -18,19 +14,23 @@ import {
|
||||
PlayerProfile,
|
||||
PlayerType,
|
||||
} from "./game/Game";
|
||||
import { createGame } from "./game/GameImpl";
|
||||
import { TileRef } from "./game/GameMap";
|
||||
import { GameMapLoader } from "./game/GameMapLoader";
|
||||
import { ClientID, GameStartInfo, Turn } from "./Schemas";
|
||||
import {
|
||||
ErrorUpdate,
|
||||
GameUpdateType,
|
||||
GameUpdateViewData,
|
||||
} from "./game/GameUpdates";
|
||||
import { loadTerrainMap as loadGameMap } from "./game/TerrainMapLoader";
|
||||
import { PseudoRandom } from "./PseudoRandom";
|
||||
import { ClientID, GameStartInfo, Turn } from "./Schemas";
|
||||
import { sanitize, simpleHash } from "./Util";
|
||||
import { Executor } from "./execution/ExecutionManager";
|
||||
import { GameMapLoader } from "./game/GameMapLoader";
|
||||
import { PseudoRandom } from "./PseudoRandom";
|
||||
import { TileRef } from "./game/GameMap";
|
||||
import { WinCheckExecution } from "./execution/WinCheckExecution";
|
||||
import { createGame } from "./game/GameImpl";
|
||||
import { fixProfaneUsername } from "./validations/username";
|
||||
import { getConfig } from "./configuration/ConfigLoader";
|
||||
import { loadTerrainMap } from "./game/TerrainMapLoader";
|
||||
import { placeName } from "../client/graphics/NameBoxCalculator";
|
||||
|
||||
export async function createGameRunner(
|
||||
gameStart: GameStartInfo,
|
||||
@@ -39,7 +39,7 @@ export async function createGameRunner(
|
||||
callBack: (gu: GameUpdateViewData | ErrorUpdate) => void,
|
||||
): Promise<GameRunner> {
|
||||
const config = await getConfig(gameStart.config, null);
|
||||
const gameMap = await loadGameMap(gameStart.config.gameMap, mapLoader);
|
||||
const gameMap = await loadTerrainMap(gameStart.config.gameMap, mapLoader);
|
||||
const random = new PseudoRandom(simpleHash(gameStart.gameID));
|
||||
|
||||
const humans = gameStart.players.map(
|
||||
|
||||
+4
-4
@@ -1,7 +1,3 @@
|
||||
import { base64url } from "jose";
|
||||
import { z } from "zod";
|
||||
import quickChatData from "../../resources/QuickChat.json" with { type: "json" };
|
||||
import countries from "../client/data/countries.json" with { type: "json" };
|
||||
import {
|
||||
AllPlayers,
|
||||
Difficulty,
|
||||
@@ -16,7 +12,11 @@ import {
|
||||
} from "./game/Game";
|
||||
import { PatternDecoder } from "./PatternDecoder";
|
||||
import { PlayerStatsSchema } from "./StatsSchemas";
|
||||
import { base64url } from "jose";
|
||||
import countries from "../client/data/countries.json" with { type: "json" };
|
||||
import { flattenedEmojiTable } from "./Util";
|
||||
import quickChatData from "../../resources/QuickChat.json" with { type: "json" };
|
||||
import { z } from "zod";
|
||||
|
||||
export type GameID = string;
|
||||
export type ClientID = string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { UnitType } from "./game/Game";
|
||||
import { z } from "zod";
|
||||
|
||||
export const BombUnitSchema = z.union([
|
||||
z.literal("abomb"),
|
||||
|
||||
+7
-8
@@ -1,7 +1,8 @@
|
||||
import DOMPurify from "dompurify";
|
||||
import { customAlphabet } from "nanoid";
|
||||
import {
|
||||
BOT_NAME_PREFIXES,
|
||||
BOT_NAME_SUFFIXES,
|
||||
} from "./execution/utils/BotNames";
|
||||
import { Cell, Unit } from "./game/Game";
|
||||
import { GameMap, TileRef } from "./game/GameMap";
|
||||
import {
|
||||
GameConfig,
|
||||
GameID,
|
||||
@@ -10,12 +11,10 @@ import {
|
||||
Turn,
|
||||
Winner,
|
||||
} from "./Schemas";
|
||||
|
||||
import { GameMap, TileRef } from "./game/GameMap";
|
||||
import DOMPurify from "dompurify";
|
||||
import { ServerConfig } from "./configuration/Config";
|
||||
import {
|
||||
BOT_NAME_PREFIXES,
|
||||
BOT_NAME_SUFFIXES,
|
||||
} from "./execution/utils/BotNames";
|
||||
import { customAlphabet } from "nanoid";
|
||||
|
||||
export function manhattanDistWrapped(
|
||||
c1: Cell,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This file contians schemas for the openfront worker express server
|
||||
import { z } from "zod";
|
||||
import { GameConfigSchema, GameRecordSchema } from "./Schemas";
|
||||
import { z } from "zod";
|
||||
|
||||
export const CreateGameInputSchema = GameConfigSchema.or(
|
||||
z
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { Colord, extend } from "colord";
|
||||
import labPlugin from "colord/plugins/lab";
|
||||
import lchPlugin from "colord/plugins/lch";
|
||||
import Color from "colorjs.io";
|
||||
import { ColoredTeams, Team } from "../game/Game";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { simpleHash } from "../Util";
|
||||
import {
|
||||
blueTeamColors,
|
||||
botTeamColors,
|
||||
@@ -15,6 +10,11 @@ import {
|
||||
tealTeamColors,
|
||||
yellowTeamColors,
|
||||
} from "./Colors";
|
||||
import Color from "colorjs.io";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import labPlugin from "colord/plugins/lab";
|
||||
import lchPlugin from "colord/plugins/lch";
|
||||
import { simpleHash } from "../Util";
|
||||
extend([lchPlugin]);
|
||||
extend([labPlugin]);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { colord, Colord, extend } from "colord";
|
||||
import { Colord, colord, extend } from "colord";
|
||||
import labPlugin from "colord/plugins/lab";
|
||||
import lchPlugin from "colord/plugins/lch";
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { Colord } from "colord";
|
||||
import { JWK } from "jose";
|
||||
import {
|
||||
Difficulty,
|
||||
Game,
|
||||
@@ -14,11 +12,13 @@ import {
|
||||
UnitInfo,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { GameConfig, GameID, TeamCountConfig } from "../Schemas";
|
||||
import { GameMap, TileRef } from "../game/GameMap";
|
||||
import { Colord } from "colord";
|
||||
import { JWK } from "jose";
|
||||
import { NukeType } from "../StatsSchemas";
|
||||
import { PlayerView } from "../game/GameView";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
import { GameConfig, GameID, TeamCountConfig } from "../Schemas";
|
||||
import { NukeType } from "../StatsSchemas";
|
||||
|
||||
export enum GameEnv {
|
||||
Dev,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ApiEnvResponseSchema } from "../ExpressSchemas";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
import { GameConfig } from "../Schemas";
|
||||
import { Config, GameEnv, ServerConfig } from "./Config";
|
||||
import { DefaultConfig } from "./DefaultConfig";
|
||||
import { DevConfig, DevServerConfig } from "./DevConfig";
|
||||
import { ApiEnvResponseSchema } from "../ExpressSchemas";
|
||||
import { DefaultConfig } from "./DefaultConfig";
|
||||
import { GameConfig } from "../Schemas";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
import { preprodConfig } from "./PreprodConfig";
|
||||
import { prodConfig } from "./ProdConfig";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable max-lines */
|
||||
import { JWK } from "jose";
|
||||
import { z } from "zod";
|
||||
import { Config, GameEnv, NukeMagnitude, ServerConfig, Theme } from "./Config";
|
||||
import {
|
||||
Difficulty,
|
||||
Duos,
|
||||
@@ -13,22 +12,23 @@ import {
|
||||
PlayerInfo,
|
||||
PlayerType,
|
||||
Quads,
|
||||
TerrainType,
|
||||
TerraNullius,
|
||||
TerrainType,
|
||||
Tick,
|
||||
Trios,
|
||||
UnitInfo,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { PlayerView } from "../game/GameView";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
import { GameConfig, GameID, TeamCountConfig } from "../Schemas";
|
||||
import { NukeType } from "../StatsSchemas";
|
||||
import { assertNever, simpleHash, within } from "../Util";
|
||||
import { Config, GameEnv, NukeMagnitude, ServerConfig, Theme } from "./Config";
|
||||
import { JWK } from "jose";
|
||||
import { NukeType } from "../StatsSchemas";
|
||||
import { PastelTheme } from "./PastelTheme";
|
||||
import { PastelThemeDark } from "./PastelThemeDark";
|
||||
import { PlayerView } from "../game/GameView";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
import { z } from "zod";
|
||||
|
||||
const JwksSchema = z.object({
|
||||
keys: z
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { UnitInfo, UnitType } from "../game/Game";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
import { GameConfig } from "../Schemas";
|
||||
import { GameEnv, ServerConfig } from "./Config";
|
||||
import { DefaultConfig, DefaultServerConfig } from "./DefaultConfig";
|
||||
import { GameEnv, ServerConfig } from "./Config";
|
||||
import { UnitInfo, UnitType } from "../game/Game";
|
||||
import { GameConfig } from "../Schemas";
|
||||
import { UserSettings } from "../game/UserSettings";
|
||||
|
||||
export class DevServerConfig extends DefaultServerConfig {
|
||||
adminToken(): string {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Colord, colord } from "colord";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { PlayerType, Team, TerrainType } from "../game/Game";
|
||||
import { GameMap, TileRef } from "../game/GameMap";
|
||||
import { PlayerView } from "../game/GameView";
|
||||
import { ColorAllocator } from "./ColorAllocator";
|
||||
import { PlayerType, Team, TerrainType } from "../game/Game";
|
||||
import { botColors, fallbackColors, humanColors, nationColors } from "./Colors";
|
||||
import { ColorAllocator } from "./ColorAllocator";
|
||||
import { PlayerView } from "../game/GameView";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { Theme } from "./Config";
|
||||
|
||||
type ColorCache = Map<string, Colord>;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Colord, colord } from "colord";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { PlayerType, Team, TerrainType } from "../game/Game";
|
||||
import { GameMap, TileRef } from "../game/GameMap";
|
||||
import { PlayerView } from "../game/GameView";
|
||||
import { ColorAllocator } from "./ColorAllocator";
|
||||
import { PlayerType, Team, TerrainType } from "../game/Game";
|
||||
import { botColors, fallbackColors, humanColors, nationColors } from "./Colors";
|
||||
import { ColorAllocator } from "./ColorAllocator";
|
||||
import { PlayerView } from "../game/GameView";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { Theme } from "./Config";
|
||||
|
||||
type ColorCache = Map<string, Colord>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GameEnv } from "./Config";
|
||||
import { DefaultServerConfig } from "./DefaultConfig";
|
||||
import { GameEnv } from "./Config";
|
||||
|
||||
export const preprodConfig = new (class extends DefaultServerConfig {
|
||||
env(): GameEnv {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GameEnv } from "./Config";
|
||||
import { DefaultServerConfig } from "./DefaultConfig";
|
||||
import { GameEnv } from "./Config";
|
||||
|
||||
export const prodConfig = new (class extends DefaultServerConfig {
|
||||
numWorkers(): number {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { renderTroops } from "../../client/Utils";
|
||||
import {
|
||||
Attack,
|
||||
Execution,
|
||||
@@ -7,12 +6,13 @@ import {
|
||||
Player,
|
||||
PlayerID,
|
||||
PlayerType,
|
||||
TerrainType,
|
||||
TerraNullius,
|
||||
TerrainType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { FlatBinaryHeap } from "./utils/FlatBinaryHeap"; // adjust path if needed
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { renderTroops } from "../../client/Utils";
|
||||
|
||||
const malusForRetreat = 25;
|
||||
export class AttackExecution implements Execution {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Execution, Game, Player } from "../game/Game";
|
||||
import { BotBehavior } from "./utils/BotBehavior";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { simpleHash } from "../Util";
|
||||
import { BotBehavior } from "./utils/BotBehavior";
|
||||
|
||||
export class BotExecution implements Execution {
|
||||
private active = true;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Game, PlayerInfo, PlayerType } from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { GameID } from "../Schemas";
|
||||
import { simpleHash } from "../Util";
|
||||
import { SpawnExecution } from "./SpawnExecution";
|
||||
import { BOT_NAME_PREFIXES, BOT_NAME_SUFFIXES } from "./utils/BotNames";
|
||||
import { Game, PlayerInfo, PlayerType } from "../game/Game";
|
||||
import { GameID } from "../Schemas";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { SpawnExecution } from "./SpawnExecution";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { simpleHash } from "../Util";
|
||||
|
||||
export class BotSpawner {
|
||||
private random: PseudoRandom;
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
Unit,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { CityExecution } from "./CityExecution";
|
||||
import { DefensePostExecution } from "./DefensePostExecution";
|
||||
import { FactoryExecution } from "./FactoryExecution";
|
||||
@@ -16,6 +15,7 @@ import { MissileSiloExecution } from "./MissileSiloExecution";
|
||||
import { NukeExecution } from "./NukeExecution";
|
||||
import { PortExecution } from "./PortExecution";
|
||||
import { SAMLauncherExecution } from "./SAMLauncherExecution";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { WarshipExecution } from "./WarshipExecution";
|
||||
|
||||
export class ConstructionExecution implements Execution {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Execution, Game, Player, Unit, UnitType } from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { ShellExecution } from "./ShellExecution";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
|
||||
export class DefensePostExecution implements Execution {
|
||||
private mg: Game;
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { Execution, Game } from "../game/Game";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { ClientID, GameID, Intent, Turn } from "../Schemas";
|
||||
import { simpleHash } from "../Util";
|
||||
import { Execution, Game } from "../game/Game";
|
||||
import { AllianceExtensionExecution } from "./alliance/AllianceExtensionExecution";
|
||||
import { AllianceRequestExecution } from "./alliance/AllianceRequestExecution";
|
||||
import { AllianceRequestReplyExecution } from "./alliance/AllianceRequestReplyExecution";
|
||||
import { BreakAllianceExecution } from "./alliance/BreakAllianceExecution";
|
||||
import { AttackExecution } from "./AttackExecution";
|
||||
import { BoatRetreatExecution } from "./BoatRetreatExecution";
|
||||
import { BotSpawner } from "./BotSpawner";
|
||||
import { BreakAllianceExecution } from "./alliance/BreakAllianceExecution";
|
||||
import { ConstructionExecution } from "./ConstructionExecution";
|
||||
import { DeleteUnitExecution } from "./DeleteUnitExecution";
|
||||
import { DonateGoldExecution } from "./DonateGoldExecution";
|
||||
@@ -19,12 +17,14 @@ import { FakeHumanExecution } from "./FakeHumanExecution";
|
||||
import { MarkDisconnectedExecution } from "./MarkDisconnectedExecution";
|
||||
import { MoveWarshipExecution } from "./MoveWarshipExecution";
|
||||
import { NoOpExecution } from "./NoOpExecution";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { QuickChatExecution } from "./QuickChatExecution";
|
||||
import { RetreatExecution } from "./RetreatExecution";
|
||||
import { SpawnExecution } from "./SpawnExecution";
|
||||
import { TargetPlayerExecution } from "./TargetPlayerExecution";
|
||||
import { TransportShipExecution } from "./TransportShipExecution";
|
||||
import { UpgradeStructureExecution } from "./UpgradeStructureExecution";
|
||||
import { simpleHash } from "../Util";
|
||||
|
||||
export class Executor {
|
||||
// private random = new PseudoRandom(999)
|
||||
|
||||
@@ -14,17 +14,17 @@ import {
|
||||
Unit,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { euclDistFN, manhattanDistFN, TileRef } from "../game/GameMap";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { GameID } from "../Schemas";
|
||||
import { TileRef, euclDistFN, manhattanDistFN } from "../game/GameMap";
|
||||
import { calculateBoundingBox, flattenedEmojiTable, simpleHash } from "../Util";
|
||||
import { BotBehavior } from "./utils/BotBehavior";
|
||||
import { ConstructionExecution } from "./ConstructionExecution";
|
||||
import { EmojiExecution } from "./EmojiExecution";
|
||||
import { GameID } from "../Schemas";
|
||||
import { NukeExecution } from "./NukeExecution";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { SpawnExecution } from "./SpawnExecution";
|
||||
import { TransportShipExecution } from "./TransportShipExecution";
|
||||
import { closestTwoTiles } from "./Util";
|
||||
import { BotBehavior } from "./utils/BotBehavior";
|
||||
|
||||
export class FakeHumanExecution implements Execution {
|
||||
private active = true;
|
||||
|
||||
@@ -7,11 +7,11 @@ import {
|
||||
Unit,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { NukeExecution } from "./NukeExecution";
|
||||
import { ParabolaPathFinder } from "../pathfinding/PathFinding";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { simpleHash } from "../Util";
|
||||
import { NukeExecution } from "./NukeExecution";
|
||||
|
||||
export class MirvExecution implements Execution {
|
||||
private active = true;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import {
|
||||
Execution,
|
||||
Game,
|
||||
isStructureType,
|
||||
MessageType,
|
||||
Player,
|
||||
TerraNullius,
|
||||
TrajectoryTile,
|
||||
Unit,
|
||||
UnitType,
|
||||
isStructureType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { NukeType } from "../StatsSchemas";
|
||||
import { ParabolaPathFinder } from "../pathfinding/PathFinding";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { NukeType } from "../StatsSchemas";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
|
||||
const SPRITE_RADIUS = 16;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Config } from "../configuration/Config";
|
||||
import { Execution, Game, Player, UnitType } from "../game/Game";
|
||||
import { GameImpl } from "../game/GameImpl";
|
||||
import { GameMap, TileRef } from "../game/GameMap";
|
||||
import { calculateBoundingBox, getMode, inscribed, simpleHash } from "../Util";
|
||||
import { Config } from "../configuration/Config";
|
||||
import { GameImpl } from "../game/GameImpl";
|
||||
|
||||
export class PlayerExecution implements Execution {
|
||||
private readonly ticksPerClusterCalc = 20;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Execution, Game, Player, Unit, UnitType } from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { TradeShipExecution } from "./TradeShipExecution";
|
||||
import { TrainStationExecution } from "./TrainStationExecution";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Execution, Game } from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { GameUpdateType, RailTile, RailType } from "../game/GameUpdates";
|
||||
import { Railroad } from "../game/Railroad";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
|
||||
export class RailroadExecution implements Execution {
|
||||
private mg: Game;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import {
|
||||
Execution,
|
||||
Game,
|
||||
isUnit,
|
||||
MessageType,
|
||||
Player,
|
||||
Unit,
|
||||
UnitType,
|
||||
isUnit,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { SAMMissileExecution } from "./SAMMissileExecution";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
|
||||
type Target = {
|
||||
unit: Unit;
|
||||
|
||||
@@ -6,10 +6,10 @@ import {
|
||||
Unit,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { AirPathFinder } from "../pathfinding/PathFinding";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { NukeType } from "../StatsSchemas";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
|
||||
export class SAMMissileExecution implements Execution {
|
||||
private active = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Execution, Game, Player, Unit, UnitType } from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { AirPathFinder } from "../pathfinding/PathFinding";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
|
||||
export class ShellExecution implements Execution {
|
||||
private active = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Execution, Game, Player, PlayerInfo, PlayerType } from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { BotExecution } from "./BotExecution";
|
||||
import { PlayerExecution } from "./PlayerExecution";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { getSpawnTiles } from "./Util";
|
||||
|
||||
export class SpawnExecution implements Execution {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { renderNumber } from "../../client/Utils";
|
||||
import {
|
||||
Execution,
|
||||
Game,
|
||||
@@ -7,10 +6,11 @@ import {
|
||||
Unit,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { PathFindResultType } from "../pathfinding/AStar";
|
||||
import { PathFinder } from "../pathfinding/PathFinding";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { distSortUnit } from "../Util";
|
||||
import { renderNumber } from "../../client/Utils";
|
||||
|
||||
export class TradeShipExecution implements Execution {
|
||||
private active = true;
|
||||
|
||||
@@ -6,9 +6,9 @@ import {
|
||||
Unit,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { OrientedRailroad, getOrientedRailroad } from "../game/Railroad";
|
||||
import { RailNetwork } from "../game/RailNetwork";
|
||||
import { getOrientedRailroad, OrientedRailroad } from "../game/Railroad";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { TrainStation } from "../game/TrainStation";
|
||||
|
||||
export class TrainExecution implements Execution {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Execution, Game, Unit } from "../game/Game";
|
||||
import { TrainStation } from "../game/TrainStation";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { TrainExecution } from "./TrainExecution";
|
||||
import { TrainStation } from "../game/TrainStation";
|
||||
|
||||
export class TrainStationExecution implements Execution {
|
||||
private mg: Game;
|
||||
|
||||
@@ -8,11 +8,11 @@ import {
|
||||
Unit,
|
||||
UnitType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { targetTransportTile } from "../game/TransportShipUtils";
|
||||
import { AttackExecution } from "./AttackExecution";
|
||||
import { PathFindResultType } from "../pathfinding/AStar";
|
||||
import { PathFinder } from "../pathfinding/PathFinding";
|
||||
import { AttackExecution } from "./AttackExecution";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { targetTransportTile } from "../game/TransportShipUtils";
|
||||
|
||||
export class TransportShipExecution implements Execution {
|
||||
private lastMove: number;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { euclDistFN, GameMap, TileRef } from "../game/GameMap";
|
||||
import { GameMap, TileRef, euclDistFN } from "../game/GameMap";
|
||||
|
||||
export function getSpawnTiles(gm: GameMap, tile: TileRef): TileRef[] {
|
||||
return Array.from(gm.bfs(tile, euclDistFN(tile, 4, true))).filter(
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import {
|
||||
Execution,
|
||||
Game,
|
||||
isUnit,
|
||||
OwnerComp,
|
||||
Unit,
|
||||
UnitParams,
|
||||
UnitType,
|
||||
isUnit,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { PathFindResultType } from "../pathfinding/AStar";
|
||||
import { PathFinder } from "../pathfinding/PathFinding";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { ShellExecution } from "./ShellExecution";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
|
||||
export class WarshipExecution implements Execution {
|
||||
private random: PseudoRandom;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { GameEvent } from "../EventBus";
|
||||
import {
|
||||
ColoredTeams,
|
||||
Execution,
|
||||
@@ -7,6 +6,7 @@ import {
|
||||
Player,
|
||||
Team,
|
||||
} from "../game/Game";
|
||||
import { GameEvent } from "../EventBus";
|
||||
|
||||
export class WinEvent implements GameEvent {
|
||||
constructor(public readonly winner: Player) {}
|
||||
|
||||
@@ -7,11 +7,11 @@ import {
|
||||
TerraNullius,
|
||||
Tick,
|
||||
} from "../../game/Game";
|
||||
import { PseudoRandom } from "../../PseudoRandom";
|
||||
import { flattenedEmojiTable } from "../../Util";
|
||||
import { AllianceExtensionExecution } from "../alliance/AllianceExtensionExecution";
|
||||
import { AttackExecution } from "../AttackExecution";
|
||||
import { EmojiExecution } from "../EmojiExecution";
|
||||
import { PseudoRandom } from "../../PseudoRandom";
|
||||
import { flattenedEmojiTable } from "../../Util";
|
||||
|
||||
export class BotBehavior {
|
||||
private enemy: Player | null = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AllianceRequest, Player, Tick } from "./Game";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
import { AllianceRequestUpdate, GameUpdateType } from "./GameUpdates";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
|
||||
export class AllianceRequestImpl implements AllianceRequest {
|
||||
constructor(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Attack, Cell, Player, TerraNullius } from "./Game";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
import { TileRef } from "./GameMap";
|
||||
import { PlayerImpl } from "./PlayerImpl";
|
||||
import { TileRef } from "./GameMap";
|
||||
|
||||
export class AttackImpl implements Attack {
|
||||
private _isActive = true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GameMapType } from "./Game";
|
||||
import { GameMapLoader, MapData } from "./GameMapLoader";
|
||||
import { GameMapType } from "./Game";
|
||||
import { MapManifest } from "./TerrainMapLoader";
|
||||
|
||||
export type BinModule = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GameMapType } from "./Game";
|
||||
import { GameMapLoader, MapData } from "./GameMapLoader";
|
||||
import { GameMapType } from "./Game";
|
||||
import { MapManifestSchema } from "./TerrainMapLoader";
|
||||
|
||||
export class FetchGameMapLoader implements GameMapLoader {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Config } from "../configuration/Config";
|
||||
import { AllPlayersStats, ClientID } from "../Schemas";
|
||||
import { GameMap, TileRef } from "./GameMap";
|
||||
import {
|
||||
@@ -7,6 +6,7 @@ import {
|
||||
PlayerUpdate,
|
||||
UnitUpdate,
|
||||
} from "./GameUpdates";
|
||||
import { Config } from "../configuration/Config";
|
||||
import { RailNetwork } from "./RailNetwork";
|
||||
import { Stats } from "./Stats";
|
||||
import { UnitPredicate } from "./UnitGrid";
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
/* eslint-disable max-lines */
|
||||
import { renderNumber } from "../../client/Utils";
|
||||
import { Config } from "../configuration/Config";
|
||||
import { AllPlayersStats, ClientID, Winner } from "../Schemas";
|
||||
import { simpleHash } from "../Util";
|
||||
import { AllianceImpl } from "./AllianceImpl";
|
||||
import { AllianceRequestImpl } from "./AllianceRequestImpl";
|
||||
import {
|
||||
Alliance,
|
||||
AllianceRequest,
|
||||
@@ -25,8 +20,8 @@ import {
|
||||
PlayerType,
|
||||
Quads,
|
||||
Team,
|
||||
TerrainType,
|
||||
TerraNullius,
|
||||
TerrainType,
|
||||
Trios,
|
||||
Unit,
|
||||
UnitInfo,
|
||||
@@ -34,14 +29,19 @@ import {
|
||||
} from "./Game";
|
||||
import { GameMap, TileRef, TileUpdate } from "./GameMap";
|
||||
import { GameUpdate, GameUpdateType } from "./GameUpdates";
|
||||
import { UnitGrid, UnitPredicate } from "./UnitGrid";
|
||||
import { AllianceImpl } from "./AllianceImpl";
|
||||
import { AllianceRequestImpl } from "./AllianceRequestImpl";
|
||||
import { Config } from "../configuration/Config";
|
||||
import { PlayerImpl } from "./PlayerImpl";
|
||||
import { RailNetwork } from "./RailNetwork";
|
||||
import { createRailNetwork } from "./RailNetworkImpl";
|
||||
import { Stats } from "./Stats";
|
||||
import { StatsImpl } from "./StatsImpl";
|
||||
import { assignTeams } from "./TeamAssignment";
|
||||
import { TerraNulliusImpl } from "./TerraNulliusImpl";
|
||||
import { UnitGrid, UnitPredicate } from "./UnitGrid";
|
||||
import { assignTeams } from "./TeamAssignment";
|
||||
import { createRailNetwork } from "./RailNetworkImpl";
|
||||
import { renderNumber } from "../../client/Utils";
|
||||
import { simpleHash } from "../Util";
|
||||
|
||||
export function createGame(
|
||||
humans: PlayerInfo[],
|
||||
|
||||
+17
-17
@@ -1,9 +1,11 @@
|
||||
import { base64url } from "jose";
|
||||
import { Config } from "../configuration/Config";
|
||||
import { PatternDecoder } from "../PatternDecoder";
|
||||
import { ClientID, GameID, Player } from "../Schemas";
|
||||
import { createRandomName } from "../Util";
|
||||
import { WorkerClient } from "../worker/WorkerClient";
|
||||
import {
|
||||
AllianceView,
|
||||
AttackUpdate,
|
||||
GameUpdateType,
|
||||
GameUpdateViewData,
|
||||
PlayerUpdate,
|
||||
UnitUpdate,
|
||||
} from "./GameUpdates";
|
||||
import {
|
||||
Cell,
|
||||
EmojiMessage,
|
||||
@@ -16,26 +18,24 @@ import {
|
||||
PlayerProfile,
|
||||
PlayerType,
|
||||
Team,
|
||||
TerrainType,
|
||||
TerraNullius,
|
||||
TerrainType,
|
||||
Tick,
|
||||
TrainType,
|
||||
UnitInfo,
|
||||
UnitType,
|
||||
} from "./Game";
|
||||
import { ClientID, GameID, Player } from "../Schemas";
|
||||
import { GameMap, TileRef, TileUpdate } from "./GameMap";
|
||||
import {
|
||||
AllianceView,
|
||||
AttackUpdate,
|
||||
GameUpdateType,
|
||||
GameUpdateViewData,
|
||||
PlayerUpdate,
|
||||
UnitUpdate,
|
||||
} from "./GameUpdates";
|
||||
import { TerrainMapData } from "./TerrainMapLoader";
|
||||
import { TerraNulliusImpl } from "./TerraNulliusImpl";
|
||||
import { UnitGrid, UnitPredicate } from "./UnitGrid";
|
||||
import { Config } from "../configuration/Config";
|
||||
import { PatternDecoder } from "../PatternDecoder";
|
||||
import { TerraNulliusImpl } from "./TerraNulliusImpl";
|
||||
import { TerrainMapData } from "./TerrainMapLoader";
|
||||
import { UserSettings } from "./UserSettings";
|
||||
import { WorkerClient } from "../worker/WorkerClient";
|
||||
import { base64url } from "jose";
|
||||
import { createRandomName } from "../Util";
|
||||
|
||||
const userSettings: UserSettings = new UserSettings();
|
||||
|
||||
|
||||
+16
-16
@@ -1,21 +1,8 @@
|
||||
/* eslint-disable max-lines */
|
||||
import { renderNumber, renderTroops } from "../../client/Utils";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { ClientID } from "../Schemas";
|
||||
import {
|
||||
assertNever,
|
||||
distSortUnit,
|
||||
minInt,
|
||||
simpleHash,
|
||||
toInt,
|
||||
within,
|
||||
} from "../Util";
|
||||
import { sanitizeUsername } from "../validations/username";
|
||||
import { AttackImpl } from "./AttackImpl";
|
||||
import {
|
||||
AllPlayers,
|
||||
Alliance,
|
||||
AllianceRequest,
|
||||
AllPlayers,
|
||||
Attack,
|
||||
BuildableUnit,
|
||||
Cell,
|
||||
@@ -40,19 +27,32 @@ import {
|
||||
UnitParams,
|
||||
UnitType,
|
||||
} from "./Game";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
import { andFN, manhattanDistFN, TileRef } from "./GameMap";
|
||||
import {
|
||||
AllianceView,
|
||||
AttackUpdate,
|
||||
GameUpdateType,
|
||||
PlayerUpdate,
|
||||
} from "./GameUpdates";
|
||||
import { TileRef, andFN, manhattanDistFN } from "./GameMap";
|
||||
import {
|
||||
assertNever,
|
||||
distSortUnit,
|
||||
minInt,
|
||||
simpleHash,
|
||||
toInt,
|
||||
within,
|
||||
} from "../Util";
|
||||
import {
|
||||
bestShoreDeploymentSource,
|
||||
canBuildTransportShip,
|
||||
} from "./TransportShipUtils";
|
||||
import { renderNumber, renderTroops } from "../../client/Utils";
|
||||
import { AttackImpl } from "./AttackImpl";
|
||||
import { ClientID } from "../Schemas";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { UnitImpl } from "./UnitImpl";
|
||||
import { sanitizeUsername } from "../validations/username";
|
||||
|
||||
type Target = {
|
||||
tick: Tick;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Unit } from "./Game";
|
||||
import { TrainStation } from "./TrainStation";
|
||||
import { Unit } from "./Game";
|
||||
|
||||
export type RailNetwork = {
|
||||
connectStation(station: TrainStation): void;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { RailroadExecution } from "../execution/RailroadExecution";
|
||||
import { PathFindResultType } from "../pathfinding/AStar";
|
||||
import { MiniAStar } from "../pathfinding/MiniAStar";
|
||||
import { SerialAStar } from "../pathfinding/SerialAStar";
|
||||
import { Cluster, TrainStation, TrainStationMapAdapter } from "./TrainStation";
|
||||
import { Game, Unit, UnitType } from "./Game";
|
||||
import { TileRef } from "./GameMap";
|
||||
import { MiniAStar } from "../pathfinding/MiniAStar";
|
||||
import { PathFindResultType } from "../pathfinding/AStar";
|
||||
import { RailNetwork } from "./RailNetwork";
|
||||
import { Railroad } from "./Railroad";
|
||||
import { Cluster, TrainStation, TrainStationMapAdapter } from "./TrainStation";
|
||||
import { RailroadExecution } from "../execution/RailroadExecution";
|
||||
import { SerialAStar } from "../pathfinding/SerialAStar";
|
||||
import { TileRef } from "./GameMap";
|
||||
|
||||
/**
|
||||
* The Stations handle their own neighbors so the graph is naturally traversable,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GameUpdateType, RailTile, RailType } from "./GameUpdates";
|
||||
import { Game } from "./Game";
|
||||
import { TileRef } from "./GameMap";
|
||||
import { GameUpdateType, RailTile, RailType } from "./GameUpdates";
|
||||
import { TrainStation } from "./TrainStation";
|
||||
|
||||
export class Railroad {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AllPlayersStats } from "../Schemas";
|
||||
import { NukeType, OtherUnitType, PlayerStats } from "../StatsSchemas";
|
||||
import { Player, TerraNullius } from "./Game";
|
||||
import { AllPlayersStats } from "../Schemas";
|
||||
|
||||
export type Stats = {
|
||||
getPlayerStats(player: Player): PlayerStats | null;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { AllPlayersStats } from "../Schemas";
|
||||
import {
|
||||
ATTACK_INDEX_CANCEL,
|
||||
ATTACK_INDEX_RECV,
|
||||
@@ -7,10 +6,10 @@ import {
|
||||
BOAT_INDEX_CAPTURE,
|
||||
BOAT_INDEX_DESTROY,
|
||||
BOAT_INDEX_SENT,
|
||||
BoatUnit,
|
||||
BOMB_INDEX_INTERCEPT,
|
||||
BOMB_INDEX_LAND,
|
||||
BOMB_INDEX_LAUNCH,
|
||||
BoatUnit,
|
||||
GOLD_INDEX_STEAL,
|
||||
GOLD_INDEX_TRADE,
|
||||
GOLD_INDEX_WAR,
|
||||
@@ -27,6 +26,7 @@ import {
|
||||
unitTypeToOtherUnit,
|
||||
} from "../StatsSchemas";
|
||||
import { Player, TerraNullius } from "./Game";
|
||||
import { AllPlayersStats } from "../Schemas";
|
||||
import { Stats } from "./Stats";
|
||||
|
||||
type BigIntLike = bigint | number;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PlayerInfo, PlayerType, Team } from "./Game";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { simpleHash } from "../Util";
|
||||
import { PlayerInfo, PlayerType, Team } from "./Game";
|
||||
|
||||
export function assignTeams(
|
||||
players: PlayerInfo[],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import { GameMapType } from "./Game";
|
||||
import { GameMap, GameMapImpl } from "./GameMap";
|
||||
import { GameMapLoader } from "./GameMapLoader";
|
||||
import { GameMapType } from "./Game";
|
||||
import { z } from "zod";
|
||||
|
||||
export type TerrainMapData = {
|
||||
manifest: MapManifest;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { TrainExecution } from "../execution/TrainExecution";
|
||||
import { Game, Player, Unit, UnitType } from "./Game";
|
||||
import { GameUpdateType, RailTile, RailType } from "./GameUpdates";
|
||||
import { GraphAdapter } from "../pathfinding/SerialAStar";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { Game, Player, Unit, UnitType } from "./Game";
|
||||
import { TileRef } from "./GameMap";
|
||||
import { GameUpdateType, RailTile, RailType } from "./GameUpdates";
|
||||
import { Railroad } from "./Railroad";
|
||||
import { TileRef } from "./GameMap";
|
||||
import { TrainExecution } from "../execution/TrainExecution";
|
||||
|
||||
/**
|
||||
* Handle train stops at various station types
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PathFindResultType } from "../pathfinding/AStar";
|
||||
import { MiniAStar } from "../pathfinding/MiniAStar";
|
||||
import { Game, Player, UnitType } from "./Game";
|
||||
import { andFN, GameMap, manhattanDistFN, TileRef } from "./GameMap";
|
||||
import { GameMap, TileRef, andFN, manhattanDistFN } from "./GameMap";
|
||||
import { MiniAStar } from "../pathfinding/MiniAStar";
|
||||
import { PathFindResultType } from "../pathfinding/AStar";
|
||||
|
||||
export function canBuildTransportShip(
|
||||
game: Game,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PlayerID, Unit, UnitType } from "./Game";
|
||||
import { GameMap, TileRef } from "./GameMap";
|
||||
import { PlayerID, Unit, UnitType } from "./Game";
|
||||
import { UnitView } from "./GameView";
|
||||
|
||||
export type UnitPredicate = (value: {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { simpleHash, toInt, withinInt } from "../Util";
|
||||
import {
|
||||
AllUnitParams,
|
||||
MessageType,
|
||||
@@ -10,10 +9,11 @@ import {
|
||||
UnitInfo,
|
||||
UnitType,
|
||||
} from "./Game";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
import { TileRef } from "./GameMap";
|
||||
import { GameUpdateType, UnitUpdate } from "./GameUpdates";
|
||||
import { simpleHash, toInt, withinInt } from "../Util";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
import { PlayerImpl } from "./PlayerImpl";
|
||||
import { TileRef } from "./GameMap";
|
||||
|
||||
export class UnitImpl implements Unit {
|
||||
private _active = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Cell } from "../game/Game";
|
||||
import { GameMap, TileRef } from "../game/GameMap";
|
||||
import { AStar, PathFindResultType } from "./AStar";
|
||||
import { GameMap, TileRef } from "../game/GameMap";
|
||||
import { GraphAdapter, SerialAStar } from "./SerialAStar";
|
||||
import { Cell } from "../game/Game";
|
||||
|
||||
export class GameMapAdapter implements GraphAdapter<TileRef> {
|
||||
constructor(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Game } from "../game/Game";
|
||||
import { GameMap, TileRef } from "../game/GameMap";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { DistanceBasedBezierCurve } from "../utilities/Line";
|
||||
import { AStar, AStarResult, PathFindResultType } from "./AStar";
|
||||
import { GameMap, TileRef } from "../game/GameMap";
|
||||
import { DistanceBasedBezierCurve } from "../utilities/Line";
|
||||
import { Game } from "../game/Game";
|
||||
import { MiniAStar } from "./MiniAStar";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
|
||||
const parabolaMinHeight = 50;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import FastPriorityQueue from "fastpriorityqueue";
|
||||
import { AStar, PathFindResultType } from "./AStar";
|
||||
import FastPriorityQueue from "fastpriorityqueue";
|
||||
|
||||
/**
|
||||
* Implement this interface with your graph to find paths with A*
|
||||
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
resolveLeetSpeakTransformer,
|
||||
skipNonAlphabeticTransformer,
|
||||
} from "obscenity";
|
||||
import { translateText } from "../../client/Utils";
|
||||
import { simpleHash } from "../Util";
|
||||
import { translateText } from "../../client/Utils";
|
||||
|
||||
const matcher = new RegExpMatcher({
|
||||
...englishDataset.build(),
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import version from "../../../resources/version.txt";
|
||||
import { createGameRunner, GameRunner } from "../GameRunner";
|
||||
import { FetchGameMapLoader } from "../game/FetchGameMapLoader";
|
||||
import { ErrorUpdate, GameUpdateViewData } from "../game/GameUpdates";
|
||||
import {
|
||||
AttackAveragePositionResultMessage,
|
||||
InitializedMessage,
|
||||
@@ -12,6 +8,10 @@ import {
|
||||
TransportShipSpawnResultMessage,
|
||||
WorkerMessage,
|
||||
} from "./WorkerMessages";
|
||||
import { ErrorUpdate, GameUpdateViewData } from "../game/GameUpdates";
|
||||
import { GameRunner, createGameRunner } from "../GameRunner";
|
||||
import { FetchGameMapLoader } from "../game/FetchGameMapLoader";
|
||||
import version from "../../../resources/version.txt";
|
||||
|
||||
const ctx: Worker = self as unknown as Worker;
|
||||
let gameRunner: Promise<GameRunner> | null = null;
|
||||
|
||||
@@ -5,11 +5,11 @@ import {
|
||||
PlayerID,
|
||||
PlayerProfile,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { ErrorUpdate, GameUpdateViewData } from "../game/GameUpdates";
|
||||
import { ClientID, GameStartInfo, Turn } from "../Schemas";
|
||||
import { generateID } from "../Util";
|
||||
import { ErrorUpdate, GameUpdateViewData } from "../game/GameUpdates";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { WorkerMessage } from "./WorkerMessages";
|
||||
import { generateID } from "../Util";
|
||||
|
||||
export class WorkerClient {
|
||||
private worker: Worker;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { ClientID, GameStartInfo, Turn } from "../Schemas";
|
||||
import {
|
||||
PlayerActions,
|
||||
PlayerBorderTiles,
|
||||
PlayerID,
|
||||
PlayerProfile,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { GameUpdateViewData } from "../game/GameUpdates";
|
||||
import { ClientID, GameStartInfo, Turn } from "../Schemas";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
|
||||
export type WorkerMessageType =
|
||||
| "heartbeat"
|
||||
|
||||
Reference in New Issue
Block a user