Merge pull request #635 from Pax1601/633-unable-to-hide-olympus-controlled-units

633 unable to hide olympus controlled units
This commit is contained in:
Pax1601 2023-12-02 18:32:40 +01:00 committed by GitHub
commit c8bb041887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 8 deletions

View File

@ -854,17 +854,20 @@ declare module "controls/unitspawnmenu" {
import { UnitDatabase } from "unit/databases/unitdatabase";
import { Airbase } from "mission/airbase";
import { UnitSpawnOptions } from "interfaces";
export class UnitSpawnMenu {
/** This is the common code for all the unit spawn menus. It is shown both when right clicking on the map and when spawning from airbase.
*
*/
export abstract class UnitSpawnMenu {
#private;
protected showRangeCircles: boolean;
protected spawnOptions: UnitSpawnOptions;
protected unitTypeFilter: (unit: any) => boolean;
protected spawnOptions: UnitSpawnOptions;
constructor(ID: string, unitDatabase: UnitDatabase, orderByRole: boolean);
abstract deployUnits(spawnOptions: UnitSpawnOptions, unitsCount: number): void;
getContainer(): HTMLElement;
getVisible(): boolean;
reset(): void;
setCountries(): void;
refreshOptions(): void;
showCirclesPreviews(): void;
clearCirclesPreviews(): void;
setAirbase(airbase: Airbase | undefined): void;
@ -878,7 +881,8 @@ declare module "controls/unitspawnmenu" {
getLiveryDropdown(): Dropdown;
getLoadoutPreview(): HTMLDivElement;
getAltitudeSlider(): Slider;
deployUnits(spawnOptions: UnitSpawnOptions, unitsCount: number): void;
setShowLoadout(showLoadout: boolean): void;
setShowAltitudeSlider(showAltitudeSlider: boolean): void;
}
export class AircraftSpawnMenu extends UnitSpawnMenu {
/**
@ -1265,6 +1269,8 @@ declare module "unit/unit" {
setGroup(group: Group | null): void;
drawLines(): void;
checkZoomRedraw(): boolean;
isControlledByDCS(): boolean;
isControlledByOlympus(): boolean;
/********************** Icon *************************/
createIcon(): void;
/********************** Visibility *************************/

View File

@ -68,7 +68,7 @@
display: none;
}
#unit-visibility-control > div:nth-child(3) {
#unit-visibility-control > div:nth-child(4) {
border-left: 2px solid white;
padding-left: 12px;
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M0 224.2C0 100.6 100.2 0 224 0h24c95.2 0 181.2 69.3 197.3 160.2c2.3 13 6.8 25.7 15.1 36l42 52.6c6.2 7.8 9.6 17.4 9.6 27.4c0 24.2-19.6 43.8-43.8 43.8H448v64c0 35.3-28.7 64-64 64H320v32c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V407.3c0-16.7-6.9-32.5-17.1-45.8C16.6 322.4 0 274.1 0 224.2zM224 64c-8.8 0-16 7.2-16 16c0 33-39.9 49.5-63.2 26.2c-6.2-6.2-16.4-6.2-22.6 0s-6.2 16.4 0 22.6C145.5 152.1 129 192 96 192c-8.8 0-16 7.2-16 16s7.2 16 16 16c33 0 49.5 39.9 26.2 63.2c-6.2 6.2-6.2 16.4 0 22.6s16.4 6.2 22.6 0C168.1 286.5 208 303 208 336c0 8.8 7.2 16 16 16s16-7.2 16-16c0-33 39.9-49.5 63.2-26.2c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6C302.5 263.9 319 224 352 224c8.8 0 16-7.2 16-16s-7.2-16-16-16c-33 0-49.5-39.9-26.2-63.2c6.2-6.2 6.2-16.4 0-22.6s-16.4-6.2-22.6 0C279.9 129.5 240 113 240 80c0-8.8-7.2-16-16-16zm-24 96a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm40 80a16 16 0 1 1 32 0 16 16 0 1 1 -32 0z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -181,6 +181,13 @@ export const MAP_MARKER_CONTROLS: MapMarkerVisibilityControl[] = [{
"image": "visibility/human.svg",
"toggles": ["human"],
"tooltip": "Toggle human players' visibility"
}, {
"image": "visibility/head-side-virus-solid.svg",
"isProtected": false,
"name": "Olympus",
"protectable": false,
"toggles": ["olympus"],
"tooltip": "Toggle Olympus-controlled units' visibility"
}, {
"image": "visibility/dcs.svg",
"isProtected": true,

View File

@ -565,6 +565,14 @@ export abstract class Unit extends CustomMarker {
return false;
}
isControlledByDCS() {
return this.getControlled() === false && this.getHuman() === false;
}
isControlledByOlympus() {
return this.getControlled() === true;
}
/********************** Icon *************************/
createIcon(): void {
/* Set the icon */
@ -691,9 +699,11 @@ export abstract class Unit extends CustomMarker {
const hiddenTypes = getApp().getMap().getHiddenTypes();
var hidden = (
/* Hide the unit if it is a human and humans are hidden */
(this.#human && hiddenTypes.includes("human")) ||
/* Hide the unit if it is DCS controlled and DCS controlled units are hidden */
(this.#controlled == false && hiddenTypes.includes("dcs")) ||
(this.getHuman() && hiddenTypes.includes("human")) ||
/* Hide the unit if it is DCS-controlled and DCS controlled units are hidden */
(this.isControlledByDCS() && hiddenTypes.includes("dcs")) ||
/* Hide the unit if it is Olympus-controlled and Olympus-controlled units are hidden */
(this.isControlledByOlympus() && hiddenTypes.includes("olympus")) ||
/* Hide the unit if this specific category is hidden */
(hiddenTypes.includes(this.getMarkerCategory())) ||
/* Hide the unit if this coalition is hidden */