Added abilities and description to spawn menu

This commit is contained in:
Pax1601
2023-10-10 14:34:19 +02:00
parent 746617deb0
commit 258164c285
18 changed files with 37987 additions and 36281 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"BDK-775": {
"name": "BDK-775",
"coalition": "blue",
"type": "Landing Craft",
"type": "Landing Ship",
"era": "Mid Cold War",
"label": "LS Ropucha",
"shortLabel": "LS Ropucha",
@@ -10,7 +10,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 25000,
"engagementRange": 6000
"engagementRange": 6000,
"description": "Landing ship Ropucha",
"abilities": ""
},
"CVN_71": {
"name": "CVN_71",
@@ -23,7 +25,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 50000,
"engagementRange": 25000
"engagementRange": 25000,
"description": "Ship",
"abilities": ""
},
"CVN_72": {
"name": "CVN_72",
@@ -36,7 +40,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 50000,
"engagementRange": 25000
"engagementRange": 25000,
"description": "Ship",
"abilities": ""
},
"CVN_73": {
"name": "CVN_73",
@@ -49,7 +55,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 50000,
"engagementRange": 25000
"engagementRange": 25000,
"description": "Ship",
"abilities": ""
},
"CVN_75": {
"name": "CVN_75",
@@ -84,7 +92,9 @@
}
},
"acquisitionRange": 50000,
"engagementRange": 25000
"engagementRange": 25000,
"description": "Ship",
"abilities": ""
},
"CV_1143_5": {
"name": "CV_1143_5",
@@ -97,7 +107,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 25000,
"engagementRange": 12000
"engagementRange": 12000,
"description": "Admiral Kuznetsov. Conventional STOBAR carrier",
"abilities": ""
},
"CastleClass_01": {
"name": "CastleClass_01",
@@ -116,7 +128,9 @@
}
},
"acquisitionRange": 25000,
"engagementRange": 3000
"engagementRange": 3000,
"description": "HMS Leeds Castle. Smaller. Patrol craft",
"abilities": ""
},
"HandyWind": {
"name": "HandyWind",
@@ -147,7 +161,9 @@
}
},
"acquisitionRange": 0,
"engagementRange": 0
"engagementRange": 0,
"description": "",
"abilities": ""
},
"HarborTug": {
"name": "HarborTug",
@@ -178,7 +194,9 @@
}
},
"acquisitionRange": 0,
"engagementRange": 0
"engagementRange": 0,
"description": "",
"abilities": ""
},
"LHA_Tarawa": {
"name": "LHA_Tarawa",
@@ -191,7 +209,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 150000,
"engagementRange": 20000
"engagementRange": 20000,
"description": "Ship",
"abilities": ""
},
"La_Combattante_II": {
"name": "La_Combattante_II",
@@ -440,7 +460,9 @@
}
},
"acquisitionRange": 19000,
"engagementRange": 4000
"engagementRange": 4000,
"description": "",
"abilities": ""
},
"Seawise_Giant": {
"name": "Seawise_Giant",
@@ -453,7 +475,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 0,
"engagementRange": 0
"engagementRange": 0,
"description": "",
"abilities": ""
},
"Ship_Tilde_Supply": {
"name": "Ship_Tilde_Supply",
@@ -466,7 +490,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 0,
"engagementRange": 0
"engagementRange": 0,
"description": "",
"abilities": ""
},
"Stennis": {
"name": "Stennis",
@@ -479,7 +505,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 50000,
"engagementRange": 25000
"engagementRange": 25000,
"description": "",
"abilities": ""
},
"TICONDEROG": {
"name": "TICONDEROG",
@@ -554,7 +582,9 @@
}
},
"acquisitionRange": 150000,
"engagementRange": 100000
"engagementRange": 100000,
"description": "Ship",
"abilities": ""
},
"Type_052B": {
"name": "Type_052B",
@@ -585,7 +615,9 @@
}
},
"acquisitionRange": 100000,
"engagementRange": 30000
"engagementRange": 30000,
"description": "Ship",
"abilities": ""
},
"Type_052C": {
"name": "Type_052C",
@@ -640,7 +672,9 @@
}
},
"acquisitionRange": 260000,
"engagementRange": 100000
"engagementRange": 100000,
"description": "Ship",
"abilities": ""
},
"Type_054A": {
"name": "",
@@ -803,7 +837,9 @@
}
},
"acquisitionRange": 160000,
"engagementRange": 45000
"engagementRange": 45000,
"description": "Ship",
"abilities": "35nm >50,000ft range"
},
"Type_071": {
"name": "Type_071",
@@ -854,7 +890,9 @@
}
},
"acquisitionRange": 300000,
"engagementRange": 150000
"engagementRange": 150000,
"description": "Ship",
"abilities": ""
},
"Type_093": {
"name": "Type_093",
@@ -873,7 +911,9 @@
}
},
"acquisitionRange": 40000,
"engagementRange": 40000
"engagementRange": 40000,
"description": "",
"abilities": ""
},
"USS_Arleigh_Burke_IIa": {
"name": "USS_Arleigh_Burke_IIa",
@@ -984,7 +1024,9 @@
}
},
"acquisitionRange": 150000,
"engagementRange": 100000
"engagementRange": 100000,
"abilities": "",
"description": ""
},
"ara_vdm": {
"name": "ara_vdm",
@@ -997,7 +1039,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 18000,
"engagementRange": 5000
"engagementRange": 5000,
"description": "ARA Vienticinco de Mayo. Conventional CATOBAR carrier",
"abilities": ""
},
"hms_invincible": {
"name": "hms_invincible",
@@ -1010,7 +1054,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 100000,
"engagementRange": 74000
"engagementRange": 74000,
"description": "Ship",
"abilities": ""
},
"leander-gun-achilles": {
"name": "leander-gun-achilles",
@@ -1023,7 +1069,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 180000,
"engagementRange": 8000
"engagementRange": 8000,
"description": "Ship",
"abilities": ""
},
"leander-gun-andromeda": {
"name": "leander-gun-andromeda",
@@ -1036,7 +1084,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 180000,
"engagementRange": 140000
"engagementRange": 140000,
"description": "Ship",
"abilities": ""
},
"leander-gun-ariadne": {
"name": "leander-gun-ariadne",
@@ -1049,7 +1099,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 150000,
"engagementRange": 100000
"engagementRange": 100000,
"description": "Ship",
"abilities": ""
},
"leander-gun-condell": {
"name": "leander-gun-condell",
@@ -1062,7 +1114,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 150000,
"engagementRange": 100000
"engagementRange": 100000,
"description": "Ship",
"abilities": ""
},
"leander-gun-lynch": {
"name": "leander-gun-lynch",
@@ -1075,7 +1129,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 180000,
"engagementRange": 140000
"engagementRange": 140000,
"description": "Ship",
"abilities": ""
},
"santafe": {
"name": "santafe",
@@ -1088,7 +1144,9 @@
"filename": "",
"enabled": true,
"acquisitionRange": 0,
"engagementRange": 0
"engagementRange": 0,
"description": "",
"abilities": ""
},
"speedboat": {
"name": "speedboat",
@@ -1100,7 +1158,9 @@
"enabled": true,
"liveries": {},
"acquisitionRange": 5000,
"engagementRange": 1000
"engagementRange": 1000,
"description": "",
"abilities": ""
},
"VINSON": {
"name": "VINSON",
@@ -1112,7 +1172,9 @@
"enabled": true,
"liveries": {},
"acquisitionRange": 30000,
"engagementRange": 15000
"engagementRange": 15000,
"description": "",
"abilities": ""
},
"PERRY": {
"name": "perry",
@@ -1314,7 +1376,9 @@
"enabled": true,
"liveries": {},
"acquisitionRange": 250000,
"engagementRange": 190000
"engagementRange": 190000,
"description": "",
"abilities": ""
},
"REZKY": {
"name": "Rezky (Krivak-2)",
@@ -1366,7 +1430,9 @@
"enabled": true,
"liveries": {},
"acquisitionRange": 0,
"engagementRange": 0
"engagementRange": 0,
"description": "",
"abilities": ""
},
"Dry-cargo ship-1": {
"name": "Dry-cargo ship-1",
@@ -1378,7 +1444,9 @@
"enabled": true,
"liveries": {},
"acquisitionRange": 0,
"engagementRange": 0
"engagementRange": 0,
"description": "",
"abilities": ""
},
"ZWEZDNY": {
"name": "zwezdny",
@@ -1416,7 +1484,9 @@
"enabled": true,
"liveries": {},
"acquisitionRange": 0,
"engagementRange": 0
"engagementRange": 0,
"description": "",
"abilities": ""
},
"SOM": {
"name": "SOM",
@@ -1424,11 +1494,13 @@
"era": "",
"label": "SSK 641B Tango",
"shortLabel": "SSK 641B Tango",
"type": "SOM",
"type": "Submarine",
"enabled": true,
"liveries": {},
"acquisitionRange": 0,
"engagementRange": 0
"engagementRange": 0,
"description": "",
"abilities": ""
},
"Forrestal": {
"name": "Forrestal",
@@ -1436,11 +1508,13 @@
"era": "",
"label": "CV-59 Forrestal",
"shortLabel": "CV-59 Forrestal",
"type": "Forrestal",
"type": "Aircraft Carrier",
"enabled": true,
"liveries": {},
"acquisitionRange": 50000,
"engagementRange": 25000
"engagementRange": 25000,
"description": "",
"abilities": ""
},
"LST_Mk2": {
"name": "LST_Mk2",
@@ -1448,11 +1522,13 @@
"era": "",
"label": "LST Mk.II",
"shortLabel": "LST Mk.II",
"type": "LST_Mk2",
"type": "Landing Ship",
"enabled": true,
"liveries": {},
"acquisitionRange": 0,
"engagementRange": 4000
"engagementRange": 4000,
"description": "",
"abilities": ""
},
"USS_Samuel_Chase": {
"name": "USS_Samuel_Chase",
@@ -1460,11 +1536,13 @@
"era": "",
"label": "LS Samuel Chase",
"shortLabel": "LS Samuel Chase",
"type": "USS_Samuel_Chase",
"type": "Landing SHip",
"enabled": true,
"liveries": {},
"acquisitionRange": 0,
"engagementRange": 7000
"engagementRange": 7000,
"description": "",
"abilities": ""
},
"Higgins_boat": {
"name": "Higgins_boat",
@@ -1472,11 +1550,13 @@
"era": "",
"label": "Boat LCVP Higgins",
"shortLabel": "Boat LCVP Higgins",
"type": "Higgins_boat",
"type": "Landing Ship",
"enabled": true,
"liveries": {},
"acquisitionRange": 3000,
"engagementRange": 1000
"engagementRange": 1000,
"description": "",
"abilities": ""
},
"Uboat_VIIC": {
"name": "Uboat_VIIC",
@@ -1484,11 +1564,13 @@
"era": "",
"label": "U-boat VIIC U-flak",
"shortLabel": "U-boat VIIC U-flak",
"type": "Uboat_VIIC",
"type": "Submarine",
"enabled": true,
"liveries": {},
"acquisitionRange": 20000,
"engagementRange": 4000
"engagementRange": 4000,
"description": "",
"abilities": ""
},
"Schnellboot_type_S130": {
"name": "Schnellboot_type_S130",
@@ -1496,10 +1578,12 @@
"era": "",
"label": "Boat Schnellboot type S130",
"shortLabel": "Boat Schnellboot type S130",
"type": "Schnellboot_type_S130",
"type": "Torpedo Boat",
"enabled": true,
"liveries": {},
"acquisitionRange": 10000,
"engagementRange": 4000
"engagementRange": 4000,
"description": "",
"abilities": ""
}
}

View File

@@ -37,7 +37,8 @@
width: 100%;
}
.contextmenu-advanced-options {
.contextmenu-advanced-options,
.contextmenu-metadata {
align-items: center;
display: flex;
flex-direction: column;
@@ -46,7 +47,8 @@
width: 100%;
}
.contextmenu-advanced-options-toggle {
.contextmenu-advanced-options-toggle,
.contextmenu-metadata-toggle {
display: flex;
align-content: center;
text-align: left;
@@ -56,20 +58,45 @@
cursor: pointer;
}
.contextmenu-advanced-options-toggle:after {
.contextmenu-advanced-options-toggle:after,
.contextmenu-metadata-toggle:after {
content: url(/resources/theme/images/icons/chevron-down.svg);
margin: auto;
}
.contextmenu-advanced-options-toggle div:first-child {
.contextmenu-advanced-options-toggle div:first-child,
.contextmenu-metadata-toggle div:first-child {
width: fit-content;
white-space: nowrap;
}
.contextmenu-advanced-options>* {
.contextmenu-advanced-options>*,
.contextmenu-metadata>* {
width: 100%;
}
.contextmenu-metadata {
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding: 0px 10px 10px 10px;
}
.contextmenu-metadata>div:nth-child(1) {
margin-bottom: 5px;
width: 100%;
}
.contextmenu-metadata>div:nth-child(2) {
display: flex;
flex-direction: row;
flex-wrap: wrap;
row-gap: 5px;
column-gap: 5px;
width: 100%;
margin-top: 10px;
}
.unit-spawn-menu {
height: fit-content;
}
@@ -221,14 +248,14 @@
display: flex;
flex-direction: column;
height: 100%;
padding: 5px;
}
.unit-image {
filter: invert(100%);
width: 25%;
margin-bottom: 10px;
margin-top: 10px;
aspect-ratio: 1/1;
margin: 5px 0px;
}
#smoke-spawn-menu {

View File

@@ -77,10 +77,18 @@ form>div {
}
.pill {
background-color: var(--background-dark-steel);
border-radius: var(--border-radius-sm);
background-color: var(--background-steel);
border-radius: 999px;
padding: 4px 8px;
width: fit-content;
font-weight: bold;
}
.pill-light {
background-color: var(--background-grey);
border-radius: var(--border-radius-md);
padding: 3px 6px;
width: fit-content;
}
.ol-scrollable {

View File

@@ -156,6 +156,7 @@ export const SHOW_UNIT_LABELS = "Show unit labels (L)";
export const SHOW_UNITS_ENGAGEMENT_RINGS = "Show units threat range rings (Q)";
export const HIDE_UNITS_SHORT_RANGE_RINGS = "Hide short range units threat range rings (R)";
export const SHOW_UNITS_ACQUISITION_RINGS = "Show units detection range rings (E)";
export const FILL_SELECTED_RING = "Fill the threat range rings of selected units (F)";
export const SHOW_UNIT_CONTACTS = "Show selected units contact lines";
export const SHOW_UNIT_PATHS = "Show selected unit paths";
export const SHOW_UNIT_TARGETS = "Show selected unit targets";

View File

@@ -44,6 +44,8 @@ export class UnitSpawnMenu {
#unitLoadoutPreviewEl: HTMLDivElement;
#unitImageEl: HTMLImageElement;
#unitLoadoutListEl: HTMLDivElement;
#descriptionDiv: HTMLDivElement;
#abilitiesDiv: HTMLDivElement;
/* Range circle previews */
#engagementCircle: Circle;
@@ -69,12 +71,12 @@ export class UnitSpawnMenu {
var divider = document.createElement("div");
divider.innerText = "x";
unitLabelCountContainerEl.append(this.#unitLabelDropdown.getContainer(), divider, this.#unitCountDropdown.getContainer());
/* Create the unit image and loadout elements */
this.#unitLoadoutPreviewEl = document.createElement("div");
this.#unitLoadoutPreviewEl.classList.add("unit-loadout-preview");
this.#unitImageEl = document.createElement("img");
this.#unitImageEl.classList.add("unit-image", "hide");
this.#unitLoadoutPreviewEl = document.createElement("div");
this.#unitLoadoutPreviewEl.classList.add("unit-loadout-preview");
this.#unitLoadoutListEl = document.createElement("div");
this.#unitLoadoutListEl.classList.add("unit-loadout-list");
this.#unitLoadoutPreviewEl.append(this.#unitImageEl, this.#unitLoadoutListEl);
@@ -93,7 +95,24 @@ export class UnitSpawnMenu {
this.#container.dispatchEvent(new Event("resize"));
});
advancedOptionsDiv.append(this.#unitCountryDropdown.getContainer(), this.#unitLiveryDropdown.getContainer(),
this.#unitLoadoutPreviewEl, this.#unitSpawnAltitudeSlider.getContainer() as HTMLElement);
this.#unitSpawnAltitudeSlider.getContainer() as HTMLElement);
/* Create the divider and the metadata collapsible div */
var metadataDiv = document.createElement("div");
metadataDiv.classList.add("contextmenu-metadata", "hide");
var metadataToggle = document.createElement("div");
metadataToggle.classList.add("contextmenu-metadata-toggle");
var metadataText = document.createElement("div");
metadataText.innerText = "Info";
var metadataHr = document.createElement("hr");
metadataToggle.append(metadataText, metadataHr);
metadataToggle.addEventListener("click", () => {
metadataDiv.classList.toggle("hide");
this.#container.dispatchEvent(new Event("resize"));
});
this.#descriptionDiv = document.createElement("div");
this.#abilitiesDiv = document.createElement("div");
metadataDiv.append(this.#descriptionDiv, this.#abilitiesDiv);
/* Create the unit deploy button */
this.#deployUnitButtonEl = document.createElement("button");
@@ -107,7 +126,7 @@ export class UnitSpawnMenu {
/* Assemble all components */
this.#container.append(this.#unitRoleTypeDropdown.getContainer(), unitLabelCountContainerEl, this.#unitLoadoutDropdown.getContainer(),
advancedOptionsToggle, advancedOptionsDiv, this.#deployUnitButtonEl);
this.#unitLoadoutPreviewEl, advancedOptionsToggle, advancedOptionsDiv, metadataToggle, metadataDiv, this.#deployUnitButtonEl);
/* Load the country codes from the public folder */
var xhr = new XMLHttpRequest();
@@ -151,14 +170,37 @@ export class UnitSpawnMenu {
this.#unitLoadoutDropdown.selectValue(0);
}
this.#unitImageEl.src = `images/units/${this.#unitDatabase.getByName(this.spawnOptions.name)?.filename}`;
this.#unitImageEl.classList.toggle("hide", false);
var blueprint = this.#unitDatabase.getByName(this.spawnOptions.name);
this.#unitImageEl.src = `images/units/${blueprint?.filename}`;
this.#unitImageEl.classList.toggle("hide", !(blueprint?.filename !== undefined));
this.#setUnitLiveryOptions();
this.#container.dispatchEvent(new Event("resize"));
this.#computeSpawnPoints();
this.#descriptionDiv.replaceChildren();
this.#abilitiesDiv.replaceChildren();
if (blueprint?.description)
this.#descriptionDiv.textContent = blueprint.description;
if (blueprint?.abilities) {
var abilities = blueprint.abilities.split(",");
this.#abilitiesDiv.replaceChildren();
for (let ability of abilities) {
if (ability !== "") {
ability = ability.trimStart();
var div = document.createElement("div");
div.textContent = ability.charAt(0).toUpperCase() + ability.slice(1);
this.#abilitiesDiv.append(div);
div.classList.add("pill-light");
}
}
}
this.showCirclesPreviews();
})
@@ -215,6 +257,8 @@ export class UnitSpawnMenu {
this.#unitLoadoutListEl.replaceChildren();
this.#unitLoadoutDropdown.reset();
this.#unitImageEl.classList.toggle("hide", true);
this.#descriptionDiv.replaceChildren();
this.#abilitiesDiv.replaceChildren();
this.setCountries();
this.#container.dispatchEvent(new Event("resize"));

View File

@@ -195,6 +195,7 @@ export interface LoadoutBlueprint {
export interface UnitBlueprint {
name: string;
enabled: boolean;
coalition: string;
era: string;
label: string;

View File

@@ -12,7 +12,7 @@ import { DestinationPreviewMarker } from "./markers/destinationpreviewmarker";
import { TemporaryUnitMarker } from "./markers/temporaryunitmarker";
import { ClickableMiniMap } from "./clickableminimap";
import { SVGInjector } from '@tanem/svg-injector'
import { mapLayers, mapBounds, minimapBoundaries, IDLE, COALITIONAREA_DRAW_POLYGON, visibilityControls, visibilityControlsTooltips, MOVE_UNIT, SHOW_UNIT_CONTACTS, HIDE_GROUP_MEMBERS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, visibilityControlsTypes, SHOW_UNIT_LABELS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNITS_ACQUISITION_RINGS, HIDE_UNITS_SHORT_RANGE_RINGS } from "../constants/constants";
import { mapLayers, mapBounds, minimapBoundaries, IDLE, COALITIONAREA_DRAW_POLYGON, visibilityControls, visibilityControlsTooltips, MOVE_UNIT, SHOW_UNIT_CONTACTS, HIDE_GROUP_MEMBERS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, visibilityControlsTypes, SHOW_UNIT_LABELS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNITS_ACQUISITION_RINGS, HIDE_UNITS_SHORT_RANGE_RINGS, FILL_SELECTED_RING } from "../constants/constants";
import { TargetMarker } from "./markers/targetmarker";
import { CoalitionArea } from "./coalitionarea/coalitionarea";
import { CoalitionAreaContextMenu } from "../contextmenus/coalitionareacontextmenu";
@@ -217,6 +217,7 @@ export class Map extends L.Map {
this.addVisibilityOption(SHOW_UNITS_ENGAGEMENT_RINGS, true);
this.addVisibilityOption(SHOW_UNITS_ACQUISITION_RINGS, true);
this.addVisibilityOption(HIDE_UNITS_SHORT_RANGE_RINGS, true);
this.addVisibilityOption(FILL_SELECTED_RING, false);
}
addVisibilityOption(option: string, defaultValue: boolean) {

View File

@@ -18,7 +18,7 @@ import { Manager } from "./other/manager";
import { SVGInjector } from "@tanem/svg-injector";
import { ServerManager } from "./server/servermanager";
import { BLUE_COMMANDER, GAME_MASTER, HIDE_UNITS_SHORT_RANGE_RINGS, RED_COMMANDER, SHOW_UNITS_ACQUISITION_RINGS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNIT_LABELS } from "./constants/constants";
import { BLUE_COMMANDER, FILL_SELECTED_RING, GAME_MASTER, HIDE_UNITS_SHORT_RANGE_RINGS, RED_COMMANDER, SHOW_UNITS_ACQUISITION_RINGS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNIT_LABELS } from "./constants/constants";
import { aircraftDatabase } from "./unit/databases/aircraftdatabase";
import { helicopterDatabase } from "./unit/databases/helicopterdatabase";
import { groundUnitDatabase } from "./unit/databases/groundunitdatabase";
@@ -300,6 +300,17 @@ export class OlympusApp {
"code": "KeyR",
"ctrlKey": false,
"shiftKey": false
}).addKeyboardShortcut("toggleFillEngagementRings", {
"altKey": false,
"callback": () => {
const chk = document.querySelector(`label[title="${FILL_SELECTED_RING}"] input[type="checkbox"]`);
if (chk instanceof HTMLElement) {
chk.click();
}
},
"code": "KeyF",
"ctrlKey": false,
"shiftKey": false
});
["KeyW", "KeyA", "KeyS", "KeyD", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].forEach(code => {

View File

@@ -51,14 +51,21 @@ export class UnitDatabase {
return null;
}
getBlueprints() {
if (getApp().getMissionManager().getCommandModeOptions().commandMode == GAME_MASTER || !getApp().getMissionManager().getCommandModeOptions().restrictSpawns)
return this.blueprints;
getBlueprints(includeDisabled: boolean = false) {
if (getApp().getMissionManager().getCommandModeOptions().commandMode == GAME_MASTER || !getApp().getMissionManager().getCommandModeOptions().restrictSpawns) {
var filteredBlueprints: { [key: string]: UnitBlueprint } = {};
for (let unit in this.blueprints) {
const blueprint = this.blueprints[unit];
if (blueprint.enabled || includeDisabled)
filteredBlueprints[unit] = blueprint;
}
return filteredBlueprints;
}
else {
var filteredBlueprints: { [key: string]: UnitBlueprint } = {};
for (let unit in this.blueprints) {
const blueprint = this.blueprints[unit];
if (this.getSpawnPointsByName(blueprint.name) <= getApp().getMissionManager().getAvailableSpawnPoints() &&
if ((blueprint.enabled || includeDisabled) && this.getSpawnPointsByName(blueprint.name) <= getApp().getMissionManager().getAvailableSpawnPoints() &&
getApp().getMissionManager().getCommandModeOptions().eras.includes(blueprint.era) &&
(!getApp().getMissionManager().getCommandModeOptions().restrictToCoalition || blueprint.coalition === getApp().getMissionManager().getCommandedCoalition() || blueprint.coalition === undefined)) {
filteredBlueprints[unit] = blueprint;

View File

@@ -5,7 +5,7 @@ import { CustomMarker } from '../map/markers/custommarker';
import { SVGInjector } from '@tanem/svg-injector';
import { UnitDatabase } from './databases/unitdatabase';
import { TargetMarker } from '../map/markers/targetmarker';
import { DLINK, DataIndexes, GAME_MASTER, HIDE_GROUP_MEMBERS, IDLE, IRST, MOVE_UNIT, OPTIC, RADAR, ROEs, RWR, SHOW_UNIT_CONTACTS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, VISUAL, emissionsCountermeasures, reactionsToThreat, states, SHOW_UNITS_ACQUISITION_RINGS, HIDE_UNITS_SHORT_RANGE_RINGS } from '../constants/constants';
import { DLINK, DataIndexes, GAME_MASTER, HIDE_GROUP_MEMBERS, IDLE, IRST, MOVE_UNIT, OPTIC, RADAR, ROEs, RWR, SHOW_UNIT_CONTACTS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, VISUAL, emissionsCountermeasures, reactionsToThreat, states, SHOW_UNITS_ACQUISITION_RINGS, HIDE_UNITS_SHORT_RANGE_RINGS, FILL_SELECTED_RING } from '../constants/constants';
import { DataExtractor } from '../server/dataextractor';
import { groundUnitDatabase } from './databases/groundunitdatabase';
import { navyUnitDatabase } from './databases/navyunitdatabase';
@@ -342,6 +342,11 @@ export class Unit extends CustomMarker {
if ((this.#alive || !selected) && this.getSelectable() && this.getSelected() != selected && this.belongsToCommandedCoalition()) {
this.#selected = selected;
/* Circles don't like to be updated when the map is zooming */
if (!getApp().getMap().isZooming()) {
this.#drawRanges();
}
if (selected) {
this.#updateMarker();
}
@@ -1055,11 +1060,6 @@ export class Unit extends CustomMarker {
/* Set vertical offset for altitude stacking */
var pos = getApp().getMap().latLngToLayerPoint(this.getLatLng()).round();
this.setZIndexOffset(1000 + Math.floor(this.#position.alt as number) - pos.y + (this.#highlighted || this.#selected ? 5000 : 0));
/* Circles don't like to be updated when the map is zooming */
if (!getApp().getMap().isZooming()) {
this.#drawRanges();
}
}
}
@@ -1180,12 +1180,12 @@ export class Unit extends CustomMarker {
if (engagementRange !== this.#engagementCircle.getRadius())
this.#engagementCircle.setRadius(engagementRange);
this.#engagementCircle.options.fillOpacity = this.getSelected()? 0.3: 0;
this.#engagementCircle.options.fillOpacity = this.getSelected() && getApp().getMap().getVisibilityOptions()[FILL_SELECTED_RING]? 0.3: 0;
/* Acquisition circles */
var shortRangeCheck = (engagementRange > nmToM(3) && acquisitionRange > nmToM(3) || !getApp().getMap().getVisibilityOptions()[HIDE_UNITS_SHORT_RANGE_RINGS]);
var shortAcquisitionRangeCheck = (acquisitionRange > nmToM(3) || !getApp().getMap().getVisibilityOptions()[HIDE_UNITS_SHORT_RANGE_RINGS]);
if (getApp().getMap().getVisibilityOptions()[SHOW_UNITS_ACQUISITION_RINGS] && shortRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
if (getApp().getMap().getVisibilityOptions()[SHOW_UNITS_ACQUISITION_RINGS] && shortAcquisitionRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
if (!getApp().getMap().hasLayer(this.#acquisitionCircle)) {
this.#acquisitionCircle.addTo(getApp().getMap());
switch (this.getCoalition()) {
@@ -1208,7 +1208,8 @@ export class Unit extends CustomMarker {
}
/* Engagement circles */
if (getApp().getMap().getVisibilityOptions()[SHOW_UNITS_ENGAGEMENT_RINGS] && shortRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
var shortEngagementRangeCheck = (engagementRange > nmToM(3) || !getApp().getMap().getVisibilityOptions()[HIDE_UNITS_SHORT_RANGE_RINGS]);
if (getApp().getMap().getVisibilityOptions()[SHOW_UNITS_ENGAGEMENT_RINGS] && shortEngagementRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
if (!getApp().getMap().hasLayer(this.#engagementCircle)) {
this.#engagementCircle.addTo(getApp().getMap());
switch (this.getCoalition()) {