diff --git a/client/src/map/map.ts b/client/src/map/map.ts index d350327d..06a95d15 100644 --- a/client/src/map/map.ts +++ b/client/src/map/map.ts @@ -613,16 +613,16 @@ export class Map extends L.Map { const selectedUnitTypes = getApp().getUnitsManager().getSelectedUnitsCategories(); if (selectedUnitTypes.length === 1 && ["Aircraft", "Helicopter"].includes(selectedUnitTypes[0])) { - if (selectedUnitTypes[0] === "Helicopter") { + if (selectedUnits.every((unit: Unit) => { return unit.canLandAtPoint()})) options["land-at-point"] = { text: "Land here", tooltip: "Land at this precise location" }; - } if (selectedUnits.every((unit: Unit) => { return unit.canTargetPoint()})) { options["bomb"] = { text: "Precision bombing", tooltip: "Precision bombing of a specific point" }; options["carpet-bomb"] = { text: "Carpet bombing", tooltip: "Carpet bombing close to a point" }; - } else if (selectedUnitTypes[0] !== "Helicopter") { + } + + if (Object.keys(options).length === 0) (getApp().getPopupsManager().get("infoPopup") as Popup).setText(`Selected units can not perform point actions.`); - } } else if (selectedUnitTypes.length === 1 && ["GroundUnit", "NavyUnit"].includes(selectedUnitTypes[0])) { if (selectedUnits.every((unit: Unit) => { return unit.canTargetPoint() })) { diff --git a/client/src/unit/unit.ts b/client/src/unit/unit.ts index 87e9a2f1..c79c0c18 100644 --- a/client/src/unit/unit.ts +++ b/client/src/unit/unit.ts @@ -636,6 +636,10 @@ export class Unit extends CustomMarker { return getApp().getMap().getBounds().contains(this.getPosition()); } + canLandAtPoint() { + return this.getCategory() === "Helicopter"; // Only choppers can do this currently + } + canTargetPoint() { return this.getDatabase()?.getByName(this.#name)?.canTargetPoint === true; }