From bee35f9ee994c91103acdc6a29ef30db1442a2f5 Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Sun, 3 Sep 2023 16:34:11 +0200 Subject: [PATCH] v0.4.4 --- client/package-lock.json | 4 +- client/package.json | 2 +- client/public/stylesheets/style/style.css | 39 +- client/src/contextmenus/mapcontextmenu.ts | 3 + client/src/controls/mapcontextmenu.ts | 594 ---------------------- client/src/map/map.ts | 2 +- client/views/other/dialogs.ejs | 2 +- client/views/toolbars/primary.ejs | 2 +- installer/olympus.iss | 2 +- mod/entry.lua | 2 +- scripts/OlympusCommand.lua | 2 +- scripts/OlympusHook.lua | 2 +- src/shared/include/defines.h | 2 +- 13 files changed, 50 insertions(+), 608 deletions(-) delete mode 100644 client/src/controls/mapcontextmenu.ts diff --git a/client/package-lock.json b/client/package-lock.json index 4e85af36..780f7cd3 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,12 +1,12 @@ { "name": "DCSOlympus", - "version": "v0.4.3-alpha", + "version": "v0.4.4-alpha", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "DCSOlympus", - "version": "v0.4.3-alpha", + "version": "v0.4.4-alpha", "dependencies": { "cookie-parser": "~1.4.4", "debug": "~2.6.9", diff --git a/client/package.json b/client/package.json index 7c50e3d5..a8bf796f 100644 --- a/client/package.json +++ b/client/package.json @@ -2,7 +2,7 @@ "name": "DCSOlympus", "node-main": "./bin/www", "main": "http://localhost:3000", - "version": "v0.4.3-alpha", + "version": "v0.4.4-alpha", "private": true, "scripts": { "copy": "copy.bat", diff --git a/client/public/stylesheets/style/style.css b/client/public/stylesheets/style/style.css index 9158683a..76d71603 100644 --- a/client/public/stylesheets/style/style.css +++ b/client/public/stylesheets/style/style.css @@ -1,3 +1,4 @@ + * { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -175,8 +176,8 @@ form>div { padding-left: 20px; padding-right: 30px; text-overflow: ellipsis; - max-width: initial; - width: 100%; + + width: calc(100%); } .ol-select.narrow:not(.ol-select-image)>.ol-select-value { @@ -1015,13 +1016,41 @@ nav.ol-panel> :last-child { } .ol-target-icon { - background-image: url("/resources/theme/images/markers/target.svg"); height: 52px; pointer-events: none; width: 52px; z-index: 9999; } +.ol-smoke-icon { + background-image: url("/resources/theme/images/markers/smoke.svg"); + height: 52px; + pointer-events: none; + width: 52px; + z-index: 9999; + opacity: 0.8; +} + +.ol-smoke-icon[data-color="white"] { + fill: white; +} + +.ol-smoke-icon[data-color="blue"] { + fill: blue; +} + +.ol-smoke-icon[data-color="red"] { + fill: red; +} + +.ol-smoke-icon[data-color="green"] { + fill: green; +} + +.ol-smoke-icon[data-color="orange"] { + fill: orange; +} + .ol-draw-icon { background-image: url("/resources/theme/images/markers/draw.svg"); height: 24px; @@ -1304,6 +1333,10 @@ input[type=number]::-webkit-outer-spin-button { transform: translateX(calc((var(--width) - var(--height)) * 0.5)); } +.ol-contexmenu-panel { + padding: 20px; +} + .ol-coalition-switch[data-value="false"]>.ol-switch-fill { background-color: var(--primary-blue); } diff --git a/client/src/contextmenus/mapcontextmenu.ts b/client/src/contextmenus/mapcontextmenu.ts index 6fc86026..41e02388 100644 --- a/client/src/contextmenus/mapcontextmenu.ts +++ b/client/src/contextmenus/mapcontextmenu.ts @@ -7,6 +7,7 @@ import { GAME_MASTER } from "../constants/constants"; import { CoalitionArea } from "../map/coalitionarea"; import { AircraftSpawnMenu, GroundUnitSpawnMenu, HelicopterSpawnMenu, NavyUnitSpawnMenu } from "../controls/unitspawnmenu"; import { Airbase } from "../mission/airbase"; +import { SmokeMarker } from "../map/smokemarker"; /** The MapContextMenu is the main contextmenu shown to the user whenever it rightclicks on the map. It is the primary interaction method for the user. * It allows to spawn units, create explosions and smoke, and edit CoalitionAreas. @@ -48,6 +49,8 @@ export class MapContextMenu extends ContextMenu { document.addEventListener("contextMenuDeploySmoke", (e: any) => { this.hide(); spawnSmoke(e.detail.color, this.getLatLng()); + var marker = new SmokeMarker(this.getLatLng(), e.detail.color); + marker.addTo(getMap()); }); document.addEventListener("contextMenuExplosion", (e: any) => { diff --git a/client/src/controls/mapcontextmenu.ts b/client/src/controls/mapcontextmenu.ts deleted file mode 100644 index 1dd906ad..00000000 --- a/client/src/controls/mapcontextmenu.ts +++ /dev/null @@ -1,594 +0,0 @@ -import { LatLng } from "leaflet"; -import { getActiveCoalition, getMap, getMissionHandler, getUnitsManager, setActiveCoalition } from ".."; -import { spawnExplosion, spawnSmoke } from "../server/server"; -import { aircraftDatabase } from "../unit/aircraftdatabase"; -import { groundUnitDatabase } from "../unit/groundunitdatabase"; -import { helicopterDatabase } from "../unit/helicopterdatabase"; -import { ContextMenu } from "./contextmenu"; -import { Dropdown } from "./dropdown"; -import { Switch } from "./switch"; -import { Slider } from "./slider"; -import { ftToM } from "../other/utils"; -import { GAME_MASTER } from "../constants/constants"; -import { navyUnitDatabase } from "../unit/navyunitdatabase"; -import { CoalitionArea } from "../map/coalitionarea"; -import { SmokeMarker } from "../map/smokemarker"; - -export class MapContextMenu extends ContextMenu { - #coalitionSwitch: Switch; - #aircraftRoleDropdown: Dropdown; - #aircraftLabelDropdown: Dropdown; - #aircraftCountDropdown: Dropdown; - #aircraftLoadoutDropdown: Dropdown; - #aircraftSpawnAltitudeSlider: Slider; - #helicopterRoleDropdown: Dropdown; - #helicopterLabelDropdown: Dropdown; - #helicopterCountDropdown: Dropdown; - #helicopterLoadoutDropdown: Dropdown; - #helicopterSpawnAltitudeSlider: Slider; - #groundUnitTypeDropdown: Dropdown; - #groundUnitLabelDropdown: Dropdown; - #groundUnitCountDropdown: Dropdown; - #navyUnitTypeDropdown: Dropdown; - #navyUnitLabelDropdown: Dropdown; - #navyUnitCountDropdown: Dropdown; - #spawnOptions = { role: "", name: "", latlng: new LatLng(0, 0), coalition: "blue", loadout: "", airbaseName: "", altitude: 0, count: 1 }; - #coalitionArea: CoalitionArea | null = null; - - constructor(id: string) { - super(id); - - this.#coalitionSwitch = new Switch("coalition-switch", (value: boolean) => this.#onSwitchClick(value)); - this.#coalitionSwitch.setValue(false); - this.#coalitionSwitch.getContainer()?.addEventListener("contextmenu", (e) => this.#onSwitchRightClick(e)); - - /* Aircraft menu */ - this.#aircraftRoleDropdown = new Dropdown("aircraft-role-options", (role: string) => this.#setAircraftRole(role)); - this.#aircraftLabelDropdown = new Dropdown("aircraft-label-options", (type: string) => this.#setAircraftLabel(type)); - this.#aircraftCountDropdown = new Dropdown("aircraft-count-options", (type: string) => this.#setAircraftCount(type)); - this.#aircraftCountDropdown.setOptions(["1", "2", "3", "4"]); - this.#aircraftCountDropdown.setValue("1"); - this.#aircraftLoadoutDropdown = new Dropdown("aircraft-loadout-options", (loadout: string) => this.#setAircraftLoadout(loadout)); - this.#aircraftSpawnAltitudeSlider = new Slider("aircraft-spawn-altitude-slider", 0, 50000, "ft", (value: number) => {this.#spawnOptions.altitude = ftToM(value);}); - this.#aircraftSpawnAltitudeSlider.setIncrement(500); - this.#aircraftSpawnAltitudeSlider.setValue(20000); - this.#aircraftSpawnAltitudeSlider.setActive(true); - - /* Helicopter menu */ - this.#helicopterRoleDropdown = new Dropdown("helicopter-role-options", (role: string) => this.#setHelicopterRole(role)); - this.#helicopterLabelDropdown = new Dropdown("helicopter-label-options", (type: string) => this.#setHelicopterLabel(type)); - this.#helicopterCountDropdown = new Dropdown("helicopter-count-options", (type: string) => this.#setHelicopterCount(type)); - this.#helicopterCountDropdown.setOptions(["1", "2", "3", "4"]); - this.#helicopterCountDropdown.setValue("1"); - this.#helicopterLoadoutDropdown = new Dropdown("helicopter-loadout-options", (loadout: string) => this.#setHelicopterLoadout(loadout)); - this.#helicopterSpawnAltitudeSlider = new Slider("helicopter-spawn-altitude-slider", 0, 10000, "ft", (value: number) => {this.#spawnOptions.altitude = ftToM(value);}); - this.#helicopterSpawnAltitudeSlider.setIncrement(50); - this.#helicopterSpawnAltitudeSlider.setValue(5000); - this.#helicopterSpawnAltitudeSlider.setActive(true); - - var count = []; - for (let i = 1; i < 10; i++) count.push(String(i)); - - /* Ground unit menu */ - this.#groundUnitTypeDropdown = new Dropdown("groundunit-type-options", (type: string) => this.#setGroundUnitType(type)); - this.#groundUnitLabelDropdown = new Dropdown("groundunit-label-options", (name: string) => this.#setGroundUnitLabel(name)); - this.#groundUnitCountDropdown = new Dropdown("groundunit-count-options", (count: string) => this.#setGroundUnitCount(count)); - this.#groundUnitCountDropdown.setOptions(count); - this.#groundUnitCountDropdown.setValue("1"); - - /* Navy unit menu */ - this.#navyUnitTypeDropdown = new Dropdown("navyunit-type-options", (type: string) => this.#setNavyUnitType(type)); - this.#navyUnitLabelDropdown = new Dropdown("navyunit-label-options", (name: string) => this.#setNavyUnitLabel(name)); - this.#navyUnitCountDropdown = new Dropdown("navyunit-count-options", (count: string) => this.#setNavyUnitCount(count)); - this.#navyUnitCountDropdown.setOptions(count); - this.#navyUnitCountDropdown.setValue("1"); - - document.addEventListener("mapContextMenuShow", (e: any) => { - if (this.getVisibleSubMenu() !== e.detail.type) - this.showSubMenu(e.detail.type); - else - this.hideSubMenus(e.detail.type); - }); - - document.addEventListener("contextMenuDeployAircrafts", () => { - this.#spawnOptions.coalition = getActiveCoalition(); - if (this.#spawnOptions) { - const liveryID = aircraftDatabase.getByName(this.#spawnOptions.name)?.liveryID; - var unitTable = {unitType: this.#spawnOptions.name, location: this.#spawnOptions.latlng, altitude: this.#spawnOptions.altitude, loadout: this.#spawnOptions.loadout, liveryID: liveryID? liveryID: ""}; - var units = []; - for (let i = 1; i < parseInt(this.#aircraftCountDropdown.getValue()) + 1; i++) { - units.push(unitTable); - } - if (getUnitsManager().spawnUnits("Aircraft", units, getActiveCoalition(), false, this.#spawnOptions.airbaseName)) { - getMap().addTemporaryMarker(this.#spawnOptions.latlng, this.#spawnOptions.name, getActiveCoalition()); - this.hide(); - } - } - }); - - document.addEventListener("contextMenuDeployHelicopters", () => { - this.#spawnOptions.coalition = getActiveCoalition(); - if (this.#spawnOptions) { - const liveryID = aircraftDatabase.getByName(this.#spawnOptions.name)?.liveryID; - var unitTable = {unitType: this.#spawnOptions.name, location: this.#spawnOptions.latlng, altitude: this.#spawnOptions.altitude, loadout: this.#spawnOptions.loadout, liveryID: liveryID? liveryID: ""}; - var units = []; - for (let i = 1; i < parseInt(this.#helicopterCountDropdown.getValue()) + 1; i++) { - units.push(unitTable); - } - if (getUnitsManager().spawnUnits("Helicopter", units, getActiveCoalition(), false, this.#spawnOptions.airbaseName)) { - getMap().addTemporaryMarker(this.#spawnOptions.latlng, this.#spawnOptions.name, getActiveCoalition()); - this.hide(); - } - } - }); - - document.addEventListener("contextMenuDeployGroundUnits", () => { - this.#spawnOptions.coalition = getActiveCoalition(); - if (this.#spawnOptions) { - const liveryID = aircraftDatabase.getByName(this.#spawnOptions.name)?.liveryID; - var unitTable = {unitType: this.#spawnOptions.name, location: this.#spawnOptions.latlng, liveryID: liveryID? liveryID: ""}; - var units = []; - for (let i = 1; i < parseInt(this.#groundUnitCountDropdown.getValue()) + 1; i++) { - units.push(JSON.parse(JSON.stringify(unitTable))); - unitTable.location.lat += 0.0001; - } - if (getUnitsManager().spawnUnits("GroundUnit", units, getActiveCoalition(), false)) { - getMap().addTemporaryMarker(this.#spawnOptions.latlng, this.#spawnOptions.name, getActiveCoalition()); - this.hide(); - } - } - }); - - document.addEventListener("contextMenuDeployNavyUnits", () => { - this.#spawnOptions.coalition = getActiveCoalition(); - if (this.#spawnOptions) { - const liveryID = aircraftDatabase.getByName(this.#spawnOptions.name)?.liveryID; - var unitTable = {unitType: this.#spawnOptions.name, location: this.#spawnOptions.latlng, liveryID: liveryID? liveryID: ""}; - var units = []; - for (let i = 1; i < parseInt(this.#navyUnitCountDropdown.getValue()) + 1; i++) { - units.push(JSON.parse(JSON.stringify(unitTable))); - unitTable.location.lat += 0.0001; - } - if (getUnitsManager().spawnUnits("NavyUnit", units, getActiveCoalition(), false)) { - getMap().addTemporaryMarker(this.#spawnOptions.latlng, this.#spawnOptions.name, getActiveCoalition()); - this.hide(); - } - } - }); - - document.addEventListener("contextMenuDeploySmoke", (e: any) => { - this.hide(); - spawnSmoke(e.detail.color, this.getLatLng()); - var marker = new SmokeMarker(this.getLatLng(), e.detail.color); - marker.addTo(getMap()); - }); - - document.addEventListener("contextMenuExplosion", (e: any) => { - this.hide(); - spawnExplosion(e.detail.strength, this.getLatLng()); - }); - - document.addEventListener("editCoalitionArea", (e: any) => { - this.hide(); - if (this.#coalitionArea) { - getMap().deselectAllCoalitionAreas(); - this.#coalitionArea.setSelected(true); - } - }); - - document.addEventListener("commandModeOptionsChanged", (e: any) => { - this.#refreshOptions(); - }); - - this.hide(); - } - - show(x: number, y: number, latlng: LatLng) { - super.show(x, y, latlng); - this.showUpperBar(); - - this.showAltitudeSlider(); - - this.#spawnOptions.airbaseName = ""; - this.#spawnOptions.latlng = latlng; - - this.getContainer()?.querySelectorAll('[data-coalition]').forEach((element: any) => { element.setAttribute("data-coalition", getActiveCoalition()) }); - if (getActiveCoalition() == "blue") - this.#coalitionSwitch.setValue(false); - else if (getActiveCoalition() == "red") - this.#coalitionSwitch.setValue(true); - else - this.#coalitionSwitch.setValue(undefined); - - if (getMissionHandler().getCommandModeOptions().commandMode !== GAME_MASTER) - this.#coalitionSwitch.hide() - - this.getContainer()?.querySelector("#coalition-area-button")?.classList.toggle("hide", true); - } - - showSubMenu(type: string) { - if (type === "more") - this.getContainer()?.querySelector("#more-options-button-bar")?.classList.toggle("hide"); - else if (["aircraft", "groundunit"].includes(type)) - this.getContainer()?.querySelector("#more-options-button-bar")?.classList.toggle("hide", true); - - this.getContainer()?.querySelector("#aircraft-spawn-menu")?.classList.toggle("hide", type !== "aircraft"); - this.getContainer()?.querySelector("#aircraft-spawn-button")?.classList.toggle("is-open", type === "aircraft"); - this.getContainer()?.querySelector("#helicopter-spawn-menu")?.classList.toggle("hide", type !== "helicopter"); - this.getContainer()?.querySelector("#helicopter-spawn-button")?.classList.toggle("is-open", type === "helicopter"); - this.getContainer()?.querySelector("#groundunit-spawn-menu")?.classList.toggle("hide", type !== "groundunit"); - this.getContainer()?.querySelector("#groundunit-spawn-button")?.classList.toggle("is-open", type === "groundunit"); - this.getContainer()?.querySelector("#navyunit-spawn-menu")?.classList.toggle("hide", type !== "navyunit"); - this.getContainer()?.querySelector("#navyunit-spawn-button")?.classList.toggle("is-open", type === "navyunit"); - this.getContainer()?.querySelector("#smoke-spawn-menu")?.classList.toggle("hide", type !== "smoke"); - this.getContainer()?.querySelector("#smoke-spawn-button")?.classList.toggle("is-open", type === "smoke"); - this.getContainer()?.querySelector("#explosion-menu")?.classList.toggle("hide", type !== "explosion"); - this.getContainer()?.querySelector("#explosion-spawn-button")?.classList.toggle("is-open", type === "explosion"); - - (this.getContainer()?.querySelectorAll(".deploy-unit-button"))?.forEach((element: Node) => {(element as HTMLButtonElement).disabled = true;}) - - this.#resetAircraftRole(); - this.#resetAircraftLabel(); - this.#resetHelicopterRole(); - this.#resetHelicopterLabel(); - this.#resetGroundUnitType(); - this.#resetGroundUnitLabel(); - this.#resetNavyUnitType(); - this.#resetNavyUnitLabel(); - this.#aircraftCountDropdown.setValue("1"); - this.#helicopterCountDropdown.setValue("1"); - this.#groundUnitCountDropdown.setValue("1"); - this.clip(); - - if (type === "aircraft") { - this.#spawnOptions.altitude = ftToM(this.#aircraftSpawnAltitudeSlider.getValue()); - } - else if (type === "helicopter") { - this.#spawnOptions.altitude = ftToM(this.#helicopterSpawnAltitudeSlider.getValue()); - } - - this.setVisibleSubMenu(type); - } - - hideSubMenus(type: string) { - this.getContainer()?.querySelector("#more-options-button-bar")?.classList.toggle("hide", ["aircraft", "groundunit"].includes(type)); - this.getContainer()?.querySelector("#aircraft-spawn-menu")?.classList.toggle("hide", true); - this.getContainer()?.querySelector("#aircraft-spawn-button")?.classList.toggle("is-open", false); - this.getContainer()?.querySelector("#helicopter-spawn-menu")?.classList.toggle("hide", true); - this.getContainer()?.querySelector("#helicopter-spawn-button")?.classList.toggle("is-open", false); - this.getContainer()?.querySelector("#groundunit-spawn-menu")?.classList.toggle("hide", true); - this.getContainer()?.querySelector("#groundunit-spawn-button")?.classList.toggle("is-open", false); - this.getContainer()?.querySelector("#navyunit-spawn-menu")?.classList.toggle("hide", true); - this.getContainer()?.querySelector("#navyunit-spawn-button")?.classList.toggle("is-open", false); - this.getContainer()?.querySelector("#smoke-spawn-menu")?.classList.toggle("hide", true); - this.getContainer()?.querySelector("#smoke-spawn-button")?.classList.toggle("is-open", false); - this.getContainer()?.querySelector("#explosion-menu")?.classList.toggle("hide", true); - this.getContainer()?.querySelector("#explosion-spawn-button")?.classList.toggle("is-open", false); - - this.#resetAircraftRole(); - this.#resetAircraftLabel(); - this.#resetHelicopterRole(); - this.#resetHelicopterLabel(); - this.#resetHelicopterRole(); - this.#resetHelicopterLabel(); - this.#resetGroundUnitType(); - this.#resetGroundUnitLabel(); - this.#resetNavyUnitType(); - this.#resetNavyUnitLabel(); - this.clip(); - - this.setVisibleSubMenu(null); - } - - showUpperBar() { - this.getContainer()?.querySelector(".upper-bar")?.classList.toggle("hide", false); - } - - hideUpperBar() { - this.getContainer()?.querySelector(".upper-bar")?.classList.toggle("hide", true); - } - - showLowerBar() { - this.getContainer()?.querySelector("#more-options-button-bar")?.classList.toggle("hide", false); - } - - hideLowerBar() { - this.getContainer()?.querySelector("#more-optionsbutton-bar")?.classList.toggle("hide", true); - } - - showAltitudeSlider() { - this.getContainer()?.querySelector("#aircraft-spawn-altitude-slider")?.classList.toggle("hide", false); - } - - hideAltitudeSlider() { - this.getContainer()?.querySelector("#aircraft-spawn-altitude-slider")?.classList.toggle("hide", true); - } - - setAirbaseName(airbaseName: string) { - this.#spawnOptions.airbaseName = airbaseName; - } - - setLatLng(latlng: LatLng) { - this.#spawnOptions.latlng = latlng; - } - - setCoalitionArea(coalitionArea: CoalitionArea) { - this.#coalitionArea = coalitionArea; - this.getContainer()?.querySelector("#coalition-area-button")?.classList.toggle("hide", false); - } - - #onSwitchClick(value: boolean) { - value? setActiveCoalition("red"): setActiveCoalition("blue"); - this.getContainer()?.querySelectorAll('[data-coalition]').forEach((element: any) => { element.setAttribute("data-coalition", getActiveCoalition()) }); - } - - #onSwitchRightClick(e: any) { - this.#coalitionSwitch.setValue(undefined); - setActiveCoalition("neutral"); - this.getContainer()?.querySelectorAll('[data-coalition]').forEach((element: any) => { element.setAttribute("data-coalition", getActiveCoalition()) }); - } - - #refreshOptions() { - if (!aircraftDatabase.getRoles().includes(this.#aircraftRoleDropdown.getValue())) - this.#resetAircraftRole(); - if (!aircraftDatabase.getByRole(this.#aircraftRoleDropdown.getValue()).map((blueprint) => { return blueprint.label }).includes(this.#aircraftLabelDropdown.getValue())) - this.#resetAircraftLabel(); - - if (!helicopterDatabase.getRoles().includes(this.#helicopterRoleDropdown.getValue())) - this.#resetHelicopterRole(); - if (!helicopterDatabase.getByRole(this.#helicopterRoleDropdown.getValue()).map((blueprint) => { return blueprint.label }).includes(this.#helicopterLabelDropdown.getValue())) - this.#resetHelicopterLabel(); - - if (!groundUnitDatabase.getRoles().includes(this.#groundUnitTypeDropdown.getValue())) - this.#resetGroundUnitType(); - if (!groundUnitDatabase.getByType(this.#groundUnitTypeDropdown.getValue()).map((blueprint) => { return blueprint.label }).includes(this.#groundUnitLabelDropdown.getValue())) - this.#resetGroundUnitLabel(); - - if (!navyUnitDatabase.getRoles().includes(this.#navyUnitTypeDropdown.getValue())) - this.#resetNavyUnitType(); - if (!navyUnitDatabase.getByType(this.#navyUnitTypeDropdown.getValue()).map((blueprint) => { return blueprint.label }).includes(this.#aircraftLabelDropdown.getValue())) - this.#resetNavyUnitLabel(); - } - - /********* Aircraft spawn menu *********/ - #setAircraftRole(role: string) { - this.#spawnOptions.role = role; - this.#resetAircraftLabel(); - this.#aircraftLabelDropdown.setOptions(aircraftDatabase.getByRole(role).map((blueprint) => { return blueprint.label })); - this.#aircraftLabelDropdown.selectValue(0); - this.clip(); - this.#computeSpawnPoints(); - } - - #resetAircraftRole() { - (this.getContainer()?.querySelector("#aircraft-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = true; - (this.getContainer()?.querySelector("#aircraft-loadout-list")).replaceChildren(); - this.#aircraftRoleDropdown.reset(); - this.#aircraftLabelDropdown.reset(); - this.#aircraftRoleDropdown.setOptions(aircraftDatabase.getRoles()); - this.clip(); - } - - #setAircraftLabel(label: string) { - this.#resetAircraftLabel(); - var name = aircraftDatabase.getByLabel(label)?.name || null; - if (name != null) { - this.#spawnOptions.name = name; - this.#aircraftLoadoutDropdown.setOptions(aircraftDatabase.getLoadoutNamesByRole(name, this.#spawnOptions.role)); - this.#aircraftLoadoutDropdown.selectValue(0); - var image = (this.getContainer()?.querySelector("#aircraft-unit-image")); - image.src = `images/units/${aircraftDatabase.getByLabel(label)?.filename}`; - image.classList.toggle("hide", false); - } - this.clip(); - this.#computeSpawnPoints(); - } - - #resetAircraftLabel() { - (this.getContainer()?.querySelector("#aircraft-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = true; - (this.getContainer()?.querySelector("#aircraft-loadout-list")).replaceChildren(); - this.#aircraftLoadoutDropdown.reset(); - (this.getContainer()?.querySelector("#aircraft-unit-image")).classList.toggle("hide", true); - this.clip(); - } - - #setAircraftCount(count: string) { - this.#spawnOptions.count = parseInt(count); - this.clip(); - this.#computeSpawnPoints(); - } - - #setAircraftLoadout(loadoutName: string) { - var loadout = aircraftDatabase.getLoadoutByName(this.#spawnOptions.name, loadoutName); - if (loadout) { - this.#spawnOptions.loadout = loadout.code; - (this.getContainer()?.querySelector("#aircraft-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = false; - var items = loadout.items.map((item: any) => { return `${item.quantity}x ${item.name}`; }); - items.length == 0 ? items.push("Empty loadout") : ""; - (this.getContainer()?.querySelector("#aircraft-loadout-list")).replaceChildren( - ...items.map((item: any) => { - var div = document.createElement('div'); - div.innerText = item; - return div; - }) - ) - } - this.clip(); - } - - /********* Helicopter spawn menu *********/ - #setHelicopterRole(role: string) { - this.#spawnOptions.role = role; - this.#resetHelicopterLabel(); - this.#helicopterLabelDropdown.setOptions(helicopterDatabase.getByRole(role).map((blueprint) => { return blueprint.label })); - this.#helicopterLabelDropdown.selectValue(0); - this.clip(); - this.#computeSpawnPoints(); - } - - #resetHelicopterRole() { - (this.getContainer()?.querySelector("#helicopter-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = true; - (this.getContainer()?.querySelector("#helicopter-loadout-list")).replaceChildren(); - this.#helicopterRoleDropdown.reset(); - this.#helicopterLabelDropdown.reset(); - this.#helicopterRoleDropdown.setOptions(helicopterDatabase.getRoles()); - this.clip(); - } - - #setHelicopterLabel(label: string) { - this.#resetHelicopterLabel(); - var name = helicopterDatabase.getByLabel(label)?.name || null; - if (name != null) { - this.#spawnOptions.name = name; - this.#helicopterLoadoutDropdown.setOptions(helicopterDatabase.getLoadoutNamesByRole(name, this.#spawnOptions.role)); - this.#helicopterLoadoutDropdown.selectValue(0); - var image = (this.getContainer()?.querySelector("#helicopter-unit-image")); - image.src = `images/units/${helicopterDatabase.getByLabel(label)?.filename}`; - image.classList.toggle("hide", false); - } - this.clip(); - this.#computeSpawnPoints(); - } - - #resetHelicopterLabel() { - (this.getContainer()?.querySelector("#helicopter-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = true; - (this.getContainer()?.querySelector("#helicopter-loadout-list")).replaceChildren(); - this.#helicopterLoadoutDropdown.reset(); - (this.getContainer()?.querySelector("#helicopter-unit-image")).classList.toggle("hide", true); - this.clip(); - } - - #setHelicopterCount(count: string) { - this.#spawnOptions.count = parseInt(count); - this.clip(); - this.#computeSpawnPoints(); - } - - #setHelicopterLoadout(loadoutName: string) { - var loadout = helicopterDatabase.getLoadoutByName(this.#spawnOptions.name, loadoutName); - if (loadout) { - this.#spawnOptions.loadout = loadout.code; - (this.getContainer()?.querySelector("#helicopter-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = false; - var items = loadout.items.map((item: any) => { return `${item.quantity}x ${item.name}`; }); - items.length == 0 ? items.push("Empty loadout") : ""; - (this.getContainer()?.querySelector("#helicopter-loadout-list")).replaceChildren( - ...items.map((item: any) => { - var div = document.createElement('div'); - div.innerText = item; - return div; - }) - ) - } - this.clip(); - } - - /********* Groundunit spawn menu *********/ - #setGroundUnitType(role: string) { - this.#resetGroundUnitLabel(); - - const types = groundUnitDatabase.getByType(role).map((blueprint) => { return blueprint.label }); - this.#groundUnitLabelDropdown.setOptions(types); - this.#groundUnitLabelDropdown.selectValue(0); - this.clip(); - this.#computeSpawnPoints(); - } - - #resetGroundUnitType() { - (this.getContainer()?.querySelector("#groundunit-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = true; - this.#groundUnitTypeDropdown.reset(); - this.#groundUnitLabelDropdown.reset(); - - const types = groundUnitDatabase.getTypes(); - this.#groundUnitTypeDropdown.setOptions(types); - this.clip(); - } - - #setGroundUnitLabel(label: string) { - this.#resetGroundUnitLabel(); - var type = groundUnitDatabase.getByLabel(label)?.name || null; - if (type != null) { - this.#spawnOptions.name = type; - (this.getContainer()?.querySelector("#groundunit-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = false; - } - this.clip(); - this.#computeSpawnPoints(); - } - - #resetGroundUnitLabel() { - (this.getContainer()?.querySelector("#groundunit-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = true; - this.clip(); - } - - #setGroundUnitCount(count: string) { - this.#spawnOptions.count = parseInt(count); - this.clip(); - this.#computeSpawnPoints(); - } - - /********* Navyunit spawn menu *********/ - #setNavyUnitType(role: string) { - this.#resetNavyUnitLabel(); - - const types = navyUnitDatabase.getByType(role).map((blueprint) => { return blueprint.label }); - this.#navyUnitLabelDropdown.setOptions(types); - this.#navyUnitLabelDropdown.selectValue(0); - this.clip(); - this.#computeSpawnPoints(); - } - - #resetNavyUnitType() { - (this.getContainer()?.querySelector("#navyunit-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = true; - this.#navyUnitTypeDropdown.reset(); - this.#navyUnitLabelDropdown.reset(); - - const types = navyUnitDatabase.getTypes(); - this.#navyUnitTypeDropdown.setOptions(types); - this.clip(); - } - - #setNavyUnitLabel(label: string) { - this.#resetNavyUnitLabel(); - var type = navyUnitDatabase.getByLabel(label)?.name || null; - if (type != null) { - this.#spawnOptions.name = type; - (this.getContainer()?.querySelector("#navyunit-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = false; - } - this.clip(); - this.#computeSpawnPoints(); - } - - #resetNavyUnitLabel() { - (this.getContainer()?.querySelector("#navyunit-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = true; - this.clip(); - } - - #setNavyUnitCount(count: string) { - this.#spawnOptions.count = parseInt(count); - this.clip(); - this.#computeSpawnPoints(); - } - - #computeSpawnPoints() { - if (getMissionHandler() && getMissionHandler().getCommandModeOptions().commandMode !== GAME_MASTER){ - var aircraftCount = parseInt(this.#aircraftCountDropdown.getValue()); - var aircraftSpawnPoints = aircraftCount * aircraftDatabase.getSpawnPointsByLabel(this.#aircraftLabelDropdown.getValue()); - (this.getContainer()?.querySelector("#aircraft-spawn-menu")?.querySelector(".deploy-unit-button")).dataset.points = `${aircraftSpawnPoints}`; - (this.getContainer()?.querySelector("#aircraft-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = aircraftSpawnPoints >= getMissionHandler().getAvailableSpawnPoints(); - - var helicopterCount = parseInt(this.#helicopterCountDropdown.getValue()); - var helicopterSpawnPoints = helicopterCount * helicopterDatabase.getSpawnPointsByLabel(this.#helicopterLabelDropdown.getValue()); - (this.getContainer()?.querySelector("#helicopter-spawn-menu")?.querySelector(".deploy-unit-button")).dataset.points = `${helicopterSpawnPoints}`; - (this.getContainer()?.querySelector("#helicopter-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = helicopterSpawnPoints >= getMissionHandler().getAvailableSpawnPoints(); - - var groundUnitCount = parseInt(this.#groundUnitCountDropdown.getValue()); - var groundUnitSpawnPoints = groundUnitCount * groundUnitDatabase.getSpawnPointsByLabel(this.#groundUnitLabelDropdown.getValue()); - (this.getContainer()?.querySelector("#groundunit-spawn-menu")?.querySelector(".deploy-unit-button")).dataset.points = `${groundUnitSpawnPoints}`; - (this.getContainer()?.querySelector("#groundunit-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = groundUnitSpawnPoints >= getMissionHandler().getAvailableSpawnPoints(); - - var navyUnitCount = parseInt(this.#navyUnitCountDropdown.getValue()); - var navyUnitSpawnPoints = navyUnitCount * navyUnitDatabase.getSpawnPointsByLabel(this.#navyUnitLabelDropdown.getValue()); - (this.getContainer()?.querySelector("#navyunit-spawn-menu")?.querySelector(".deploy-unit-button")).dataset.points = `${navyUnitSpawnPoints}`; - (this.getContainer()?.querySelector("#navyunit-spawn-menu")?.querySelector(".deploy-unit-button")).disabled = navyUnitSpawnPoints >= getMissionHandler().getAvailableSpawnPoints(); - } - } -} \ No newline at end of file diff --git a/client/src/map/map.ts b/client/src/map/map.ts index 351b2cd2..6b5e8085 100644 --- a/client/src/map/map.ts +++ b/client/src/map/map.ts @@ -12,7 +12,7 @@ import { DestinationPreviewMarker } from "./destinationpreviewmarker"; import { TemporaryUnitMarker } from "./temporaryunitmarker"; import { ClickableMiniMap } from "./clickableminimap"; import { SVGInjector } from '@tanem/svg-injector' -import { layers as mapLayers, mapBounds, minimapBoundaries, IDLE, COALITIONAREA_DRAW_POLYGON, visibilityControls, visibilityControlsTootlips, MOVE_UNIT, SHOW_CONTACT_LINES, HIDE_GROUP_MEMBERS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, visibilityControlsTypes, SHOW_UNIT_LABELS } from "../constants/constants"; +import { layers as mapLayers, mapBounds, minimapBoundaries, IDLE, COALITIONAREA_DRAW_POLYGON, visibilityControls, visibilityControlsTooltips, MOVE_UNIT, SHOW_CONTACT_LINES, HIDE_GROUP_MEMBERS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, visibilityControlsTypes, SHOW_UNIT_LABELS } from "../constants/constants"; import { TargetMarker } from "./targetmarker"; import { CoalitionArea } from "./coalitionarea"; import { CoalitionAreaContextMenu } from "../contextmenus/coalitionareacontextmenu"; diff --git a/client/views/other/dialogs.ejs b/client/views/other/dialogs.ejs index 2ba6d3cf..3615be2d 100644 --- a/client/views/other/dialogs.ejs +++ b/client/views/other/dialogs.ejs @@ -3,7 +3,7 @@

DCS Olympus

Dynamic Unit Command

-
Version v0.4.3-alpha
+
Version v0.4.4-alpha
diff --git a/client/views/toolbars/primary.ejs b/client/views/toolbars/primary.ejs index a66879e3..a687a34b 100644 --- a/client/views/toolbars/primary.ejs +++ b/client/views/toolbars/primary.ejs @@ -6,7 +6,7 @@

DCS Olympus

-
version v0.4.3-alpha
+
version v0.4.4-alpha
Discord diff --git a/installer/olympus.iss b/installer/olympus.iss index 5b8f8426..126084aa 100644 --- a/installer/olympus.iss +++ b/installer/olympus.iss @@ -1,5 +1,5 @@ #define nwjsFolder "C:\Users\dpass\Documents\nwjs\" -#define version "v0.4.3-alpha" +#define version "v0.4.4-alpha" [Setup] AppName=DCS Olympus diff --git a/mod/entry.lua b/mod/entry.lua index cf1d6015..ee1afac1 100644 --- a/mod/entry.lua +++ b/mod/entry.lua @@ -15,7 +15,7 @@ declare_plugin(self_ID, shortName = "Olympus", fileMenuName = "Olympus", - version = "v0.4.3-alpha", + version = "v0.4.4-alpha", state = "installed", developerName= "DCS Refugees 767 squadron", info = _("DCS Olympus is a mod for DCS World. It allows users to spawn, control, task, group, and remove units from a DCS World server using a real-time map interface, similarly to Real Time Strategy games. The user interface also provides useful informations units, like loadouts, fuel, tasking, and so on. In the future, more features for DCS World GCI and JTAC will be available."), diff --git a/scripts/OlympusCommand.lua b/scripts/OlympusCommand.lua index 7717f307..000bf2a6 100644 --- a/scripts/OlympusCommand.lua +++ b/scripts/OlympusCommand.lua @@ -1,4 +1,4 @@ -local version = "v0.4.3-alpha" +local version = "v0.4.4-alpha" local debug = true diff --git a/scripts/OlympusHook.lua b/scripts/OlympusHook.lua index 959fc6a6..01217295 100644 --- a/scripts/OlympusHook.lua +++ b/scripts/OlympusHook.lua @@ -1,4 +1,4 @@ -local version = 'v0.4.3-alpha' +local version = 'v0.4.4-alpha' Olympus = {} Olympus.OlympusDLL = nil diff --git a/src/shared/include/defines.h b/src/shared/include/defines.h index 8b05b5f3..29d51209 100644 --- a/src/shared/include/defines.h +++ b/src/shared/include/defines.h @@ -1,6 +1,6 @@ #pragma once -#define VERSION "v0.4.3-alpha" +#define VERSION "v0.4.4-alpha" #define LOG_NAME "Olympus_log.txt" #define REST_ADDRESS "http://localhost:30000" #define REST_URI "olympus"