diff --git a/src/client/graphics/layers/GameRightSidebar.ts b/src/client/graphics/layers/GameRightSidebar.ts index fb316db37..3a207d325 100644 --- a/src/client/graphics/layers/GameRightSidebar.ts +++ b/src/client/graphics/layers/GameRightSidebar.ts @@ -1,7 +1,11 @@ import { html, LitElement } from "lit"; import { customElement, state } from "lit/decorators.js"; import { EventBus } from "../../../core/EventBus"; -import { GameMode, GameType } from "../../../core/game/Game"; +import { + GameMode, + GameType, + MIN_GAME_TICKS_FOR_SURRENDER, +} from "../../../core/game/Game"; import { GameUpdateType } from "../../../core/game/GameUpdates"; import { GameView } from "../../../core/game/GameView"; import { crazyGamesSDK } from "../../CrazyGamesSDK"; @@ -16,8 +20,6 @@ import pauseIcon from "/images/PauseIconWhite.svg?url"; import playIcon from "/images/PlayIconWhite.svg?url"; import settingsIcon from "/images/SettingIconWhite.svg?url"; -const MIN_GAME_TICKS_FOR_SURRENDER = 3000; - @customElement("game-right-sidebar") export class GameRightSidebar extends LitElement implements Layer { public game: GameView; diff --git a/src/core/execution/SurrenderExecution.ts b/src/core/execution/SurrenderExecution.ts index 61a3e9c37..234632f08 100644 --- a/src/core/execution/SurrenderExecution.ts +++ b/src/core/execution/SurrenderExecution.ts @@ -1,8 +1,11 @@ -import { Execution, Game, GameMode, Player, PlayerType } from "../game/Game"; - -// Minimum game time (after spawn phase) before surrender is allowed: 5 minutes -// Game runs at 10 ticks/second, so 5 minutes = 5 * 60 * 10 = 3000 ticks -const MIN_GAME_TICKS_FOR_SURRENDER = 3000; +import { + Execution, + Game, + GameMode, + MIN_GAME_TICKS_FOR_SURRENDER, + Player, + PlayerType, +} from "../game/Game"; export class SurrenderExecution implements Execution { private mg: Game | null = null; diff --git a/src/core/game/Game.ts b/src/core/game/Game.ts index 0d38c15ec..1f3e65eee 100644 --- a/src/core/game/Game.ts +++ b/src/core/game/Game.ts @@ -25,6 +25,8 @@ export type Gold = bigint; export const AllPlayers = "AllPlayers" as const; +export const MIN_GAME_TICKS_FOR_SURRENDER = 3000; + // export type GameUpdates = Record; // Create a type that maps GameUpdateType to its corresponding update type type UpdateTypeMap = Extract;