diff --git a/frontend/react/src/constants/constants.ts b/frontend/react/src/constants/constants.ts
index e7c0e8da..0ee4da18 100644
--- a/frontend/react/src/constants/constants.ts
+++ b/frontend/react/src/constants/constants.ts
@@ -68,28 +68,13 @@ export const ROEs: string[] = ["free", "designated", "", "return", "hold"];
export const reactionsToThreat: string[] = ["none", "manoeuvre", "passive", "evade"];
export const emissionsCountermeasures: string[] = ["silent", "attack", "defend", "free"];
-export const ERAS = [
- {
- name: "Early Cold War",
- chronologicalOrder: 2,
- },
- {
- name: "Late Cold War",
- chronologicalOrder: 4,
- },
- {
- name: "Mid Cold War",
- chronologicalOrder: 3,
- },
- {
- name: "Modern",
- chronologicalOrder: 5,
- },
- {
- name: "WW2",
- chronologicalOrder: 1,
- },
-];
+export enum ERAS_ORDER {
+ "WW2",
+ "Early Cold War",
+ "Mid Cold War",
+ "Late Cold War",
+ "Modern"
+};
export const ROEDescriptions: string[] = [
"Free (Attack anyone)",
@@ -227,6 +212,14 @@ export const minimapBoundaries = {
new LatLng(34.312222, 36.897778),
new LatLng(34.312222, 28.523333),
],
+ Afghanistan: [
+ // Sinai
+ new LatLng(36.22, 61.21),
+ new LatLng(30.42, 61.21),
+ new LatLng(30.42, 68.05),
+ new LatLng(36.22, 68.05),
+ new LatLng(36.22, 61.21),
+ ],
};
export const mapBounds = {
@@ -259,6 +252,7 @@ export const mapBounds = {
bounds: new LatLngBounds([34.312222, 28.523333], [25.946944, 36.897778]),
zoom: 4,
},
+ Afghanistan: { bounds: new LatLngBounds([36.22, 61.21], [30.42, 68.05]), zoom: 5 },
};
export const defaultMapMirrors = {};
@@ -277,7 +271,7 @@ export enum OlympusState {
OPTIONS = "Options",
AUDIO = "Audio",
AIRBASE = "Airbase",
- GAME_MASTER = "Game master"
+ GAME_MASTER = "Game master",
}
export const NO_SUBSTATE = "No substate";
@@ -308,12 +302,12 @@ export enum JTACSubState {
export enum SpawnSubState {
NO_SUBSTATE = "No substate",
SPAWN_UNIT = "Unit",
- SPAWN_EFFECT = "Effect"
+ SPAWN_EFFECT = "Effect",
}
export enum OptionsSubstate {
NO_SUBSTATE = "No substate",
- KEYBIND = "Keybind"
+ KEYBIND = "Keybind",
}
export type OlympusSubState = DrawSubState | JTACSubState | SpawnSubState | OptionsSubstate | string;
@@ -341,7 +335,7 @@ export const MAP_OPTIONS_DEFAULTS: MapOptions = {
cameraPluginPort: 3003,
cameraPluginRatio: 1,
cameraPluginEnabled: false,
- cameraPluginMode: 'map'
+ cameraPluginMode: "map",
};
export const MAP_HIDDEN_TYPES_DEFAULTS = {
diff --git a/frontend/react/src/events.ts b/frontend/react/src/events.ts
index 891eba29..0f8265cd 100644
--- a/frontend/react/src/events.ts
+++ b/frontend/react/src/events.ts
@@ -380,7 +380,7 @@ export class MouseMovedEvent {
static dispatch(latlng: LatLng, elevation?: number) {
document.dispatchEvent(new CustomEvent(this.name, { detail: { latlng, elevation } }));
- console.log(`Event ${this.name} dispatched`);
+ // Logging disabled since periodic
}
}
@@ -463,6 +463,6 @@ export class BullseyesDataChanged {
static dispatch(bullseyes: { [name: string]: Bullseye } ) {
document.dispatchEvent(new CustomEvent(this.name, { detail: { bullseyes } }));
- console.log(`Event ${this.name} dispatched`);
+ // Logging disabled since periodic
}
}
diff --git a/frontend/react/src/interfaces.ts b/frontend/react/src/interfaces.ts
index 2121b235..34758ceb 100644
--- a/frontend/react/src/interfaces.ts
+++ b/frontend/react/src/interfaces.ts
@@ -99,6 +99,7 @@ export interface SpawnRequestTable {
category: string;
coalition: string;
unit: UnitSpawnTable;
+ amount: number;
quickAccessName?: string
}
diff --git a/frontend/react/src/map/coalitionarea/coalitionpolygon.ts b/frontend/react/src/map/coalitionarea/coalitionpolygon.ts
index 5d51c39f..c24d5a47 100644
--- a/frontend/react/src/map/coalitionarea/coalitionpolygon.ts
+++ b/frontend/react/src/map/coalitionarea/coalitionpolygon.ts
@@ -44,7 +44,7 @@ export class CoalitionPolygon extends Polygon {
});
this.on("remove", () => {
- this.#label.removeFrom(this._map);
+ this.#label?.removeFrom(this._map);
});
}
diff --git a/frontend/react/src/map/map.ts b/frontend/react/src/map/map.ts
index ce1abb35..7b01e166 100644
--- a/frontend/react/src/map/map.ts
+++ b/frontend/react/src/map/map.ts
@@ -1048,7 +1048,7 @@ export class Map extends L.Map {
.getUnitsManager()
.spawnUnits(
this.#spawnRequestTable.category,
- [this.#spawnRequestTable.unit],
+ Array(this.#spawnRequestTable.amount).fill(this.#spawnRequestTable.unit),
this.#spawnRequestTable.coalition,
false,
undefined,
diff --git a/frontend/react/public/images/countries/codes.json b/frontend/react/src/ui/data/codes.ts
similarity index 98%
rename from frontend/react/public/images/countries/codes.json
rename to frontend/react/src/ui/data/codes.ts
index 250ad473..dcefa132 100644
--- a/frontend/react/public/images/countries/codes.json
+++ b/frontend/react/src/ui/data/codes.ts
@@ -1,4 +1,4 @@
-{
+export const countryCodes = {
"AGGRESSORS": {
"flagCode": "RED",
"liveryCodes": ["RSO"]
@@ -250,7 +250,7 @@
"SOUTH_AFRICA": {
"displayName": "South Africa",
"flagCode": "ZA",
- "liveryCodes": []
+ "liveryCodes": null
},
"SPAIN": {
"flagCode": "ES",
@@ -323,7 +323,7 @@
"SOUTH_OSETIA": {
"displayName": "South Ossetia",
"flagCode": "UNK",
- "liveryCodes": []
+ "liveryCodes": null
},
"NORTH_KOREA": {
"displayName": "Democratic People's Republic of Korea",
@@ -347,7 +347,7 @@
"USSR": {
"displayName": "USSR",
"flagCode": "USSR",
- "liveryCodes": []
+ "liveryCodes": null
},
"ECUADOR": {
"flagCode": "EC",
@@ -373,6 +373,6 @@
"THIRDREICH": {
"displayName": "Third Reich",
"flagCode": "THIRD",
- "liveryCodes": []
+ "liveryCodes": null
}
}
diff --git a/frontend/react/src/ui/panels/drawingmenu.tsx b/frontend/react/src/ui/panels/drawingmenu.tsx
index 55b339ca..52f9e92b 100644
--- a/frontend/react/src/ui/panels/drawingmenu.tsx
+++ b/frontend/react/src/ui/panels/drawingmenu.tsx
@@ -12,7 +12,7 @@ import { OlCheckbox } from "../components/olcheckbox";
import { Coalition } from "../../types/types";
import { OlRangeSlider } from "../components/olrangeslider";
import { CoalitionCircle } from "../../map/coalitionarea/coalitioncircle";
-import { DrawSubState, NO_SUBSTATE, OlympusState, OlympusSubState } from "../../constants/constants";
+import { DrawSubState, ERAS_ORDER, IADSTypes, NO_SUBSTATE, OlympusState, OlympusSubState } from "../../constants/constants";
import { AppStateChangedEvent, CoalitionAreaSelectedEvent } from "../../events";
import { UnitBlueprint } from "../../interfaces";
@@ -37,20 +37,8 @@ export function DrawingMenu(props: { open: boolean; onClose: () => void }) {
}, []);
/* Get all the unique types and eras for groundunits */
- /* TODO move in effect */
- const blueprints = getApp()?.getUnitsManager().getDatabase().getBlueprints();
- let types: string[] = [];
- let eras: string[] = [];
- if (blueprints) {
- types = blueprints
- .filter((blueprint) => blueprint.category === "groundunit")
- .map((blueprint) => blueprint.type)
- .filter((type) => type !== undefined);
- eras = blueprints
- .filter((blueprint) => blueprint.category === "groundunit")
- .map((blueprint) => blueprint.era)
- .filter((era) => era !== undefined);
- }
+ let types = IADSTypes;
+ let eras = getApp()?.getUnitsManager().getDatabase().getEras().sort((era1, era2) => ERAS_ORDER[era1] > ERAS_ORDER[era2] ? 1: -1 );
useEffect(() => {
if (getApp()) {
@@ -105,7 +93,7 @@ export function DrawingMenu(props: { open: boolean; onClose: () => void }) {
tooltip={"Add a new circle"}
checked={appSubState === DrawSubState.DRAW_CIRCLE}
onClick={() => {
- if (appSubState === DrawSubState.DRAW_CIRCLE) getApp().setState(OlympusState.DRAW, DrawSubState.EDIT);
+ if (appSubState === DrawSubState.DRAW_CIRCLE) getApp().setState(OlympusState.DRAW);
else getApp().setState(OlympusState.DRAW, DrawSubState.DRAW_CIRCLE);
}}
>
diff --git a/frontend/react/src/ui/panels/gamemastermenu.tsx b/frontend/react/src/ui/panels/gamemastermenu.tsx
index ba186156..e14f6bdb 100644
--- a/frontend/react/src/ui/panels/gamemastermenu.tsx
+++ b/frontend/react/src/ui/panels/gamemastermenu.tsx
@@ -1,13 +1,11 @@
import React, { useEffect, useState } from "react";
import { Menu } from "./components/menu";
import { OlCheckbox } from "../components/olcheckbox";
-import { OlRangeSlider } from "../components/olrangeslider";
import { OlNumberInput } from "../components/olnumberinput";
-import { MapOptions } from "../../types/types";
import { getApp } from "../../olympusapp";
-import { CommandModeOptions, ServerStatus } from "../../interfaces";
+import { ServerStatus } from "../../interfaces";
import { CommandModeOptionsChangedEvent, ServerStatusUpdatedEvent } from "../../events";
-import { BLUE_COMMANDER, COMMAND_MODE_OPTIONS_DEFAULTS, ERAS, GAME_MASTER, RED_COMMANDER } from "../../constants/constants";
+import { BLUE_COMMANDER, COMMAND_MODE_OPTIONS_DEFAULTS, ERAS_ORDER, GAME_MASTER, RED_COMMANDER } from "../../constants/constants";
export function GameMasterMenu(props: { open: boolean; onClose: () => void; children?: JSX.Element | JSX.Element[] }) {
const [commandModeOptions, setCommandModeOptions] = useState(COMMAND_MODE_OPTIONS_DEFAULTS);
@@ -40,12 +38,20 @@ export function GameMasterMenu(props: { open: boolean; onClose: () => void; chil
GAME MASTER
)}
- {commandModeOptions.commandMode === BLUE_COMMANDER &&
BLUE COMMANDER
}
- {commandModeOptions.commandMode === RED_COMMANDER && RED COMMANDER
}
+ {commandModeOptions.commandMode === BLUE_COMMANDER && (
+
+ BLUE COMMANDER
+
+ )}
+ {commandModeOptions.commandMode === RED_COMMANDER && (
+
+ RED COMMANDER
+
+ )}
{serverStatus.elapsedTime > currentSetupTime && (
void; chil
Restrict spawns to coalition
- {ERAS.sort((a, b) => (a.chronologicalOrder > b.chronologicalOrder ? 1 : -1)).map((era) => {
- return (
- {
- if (!commandModeOptions.restrictSpawns || commandModeOptions.commandMode !== GAME_MASTER) return;
- const newCommandModeOptions = { ...commandModeOptions };
- if (commandModeOptions.eras.includes(era.name)) newCommandModeOptions.eras.splice(newCommandModeOptions.eras.indexOf(era.name));
- else newCommandModeOptions.eras.push(era.name);
- setCommandModeOptions(newCommandModeOptions);
- }}
- >
-
{}}
- disabled={!commandModeOptions.restrictSpawns || commandModeOptions.commandMode !== GAME_MASTER}
- />
- {
+ return isNaN(Number(item));
+ })
+ .map((era) => {
+ return (
+ {
+ if (!commandModeOptions.restrictSpawns || commandModeOptions.commandMode !== GAME_MASTER) return;
+ const newCommandModeOptions = { ...commandModeOptions };
+ if (commandModeOptions.eras.includes(era)) newCommandModeOptions.eras.splice(newCommandModeOptions.eras.indexOf(era));
+ else newCommandModeOptions.eras.push(era);
+ setCommandModeOptions(newCommandModeOptions);
+ }}
>
- Allow {era.name} units
-
-
- );
- })}
+ {}}
+ disabled={!commandModeOptions.restrictSpawns || commandModeOptions.commandMode !== GAME_MASTER}
+ />
+
+ Allow {era} units
+
+
+ );
+ })}
void; chil
group flex flex-row rounded-md justify-content gap-4 px-4 py-2
`}
>
- Elapsed time (seconds){" "}
-
- {serverStatus.elapsedTime?.toFixed()}
-
+ Elapsed time (seconds) {serverStatus.elapsedTime?.toFixed()}
{commandModeOptions.commandMode === GAME_MASTER && (