diff --git a/frontend/react/src/ui/components/olunitlistentry.tsx b/frontend/react/src/ui/components/olunitlistentry.tsx index d56e3440..748c7ba1 100644 --- a/frontend/react/src/ui/components/olunitlistentry.tsx +++ b/frontend/react/src/ui/components/olunitlistentry.tsx @@ -19,13 +19,17 @@ export function OlUnitListEntry(props: { if (["aircraft", "helicopter"].includes(props.blueprint.category)) { let roles = props.blueprint.loadouts?.flatMap((loadout) => loadout.roles).filter((role) => role !== "No task"); if (roles !== undefined) { - let uniqueRoles = roles?.reduce((acc, current) => {if (!acc.includes(current)) {acc.push(current)} return acc}, [] as string[]) + let uniqueRoles = roles?.reduce((acc, current) => { + if (!acc.includes(current)) { + acc.push(current); + } + return acc; + }, [] as string[]); let mainRole = mode(roles); pillString = uniqueRoles.length > 6 ? "Multirole" : mainRole; } } else { - if (props.blueprint.category) - pillString = props.blueprint.type; + if (props.blueprint.category) pillString = props.blueprint.type; } } return ( @@ -39,14 +43,15 @@ export function OlUnitListEntry(props: { > {props.icon && } {props.silhouette && ( -
- +
+
)}
{props.blueprint.label}
diff --git a/frontend/react/src/ui/components/olunitsummary.tsx b/frontend/react/src/ui/components/olunitsummary.tsx index e08649c2..3c366e57 100644 --- a/frontend/react/src/ui/components/olunitsummary.tsx +++ b/frontend/react/src/ui/components/olunitsummary.tsx @@ -81,18 +81,18 @@ export function OlUnitSummary(props: { blueprint: UnitBlueprint; coalition: Coal

- {props.blueprint.abilities?.split(" ").map((tag) => { - return ( + {props.blueprint.abilities?.split(" ").map((ability) => { + return <>{ ability.replaceAll(" ", "") !== "" &&
- {tag} + {ability}
- ); + } })}
unit.category === "navyunit"), }); + + setTags({ + aircraft: getApp() + ?.getUnitsManager() + .getDatabase() + .getTags((unit) => unit.category === "aircraft"), + helicopter: getApp() + ?.getUnitsManager() + .getDatabase() + .getTags((unit) => unit.category === "helicopter"), + groundunit: getApp() + ?.getUnitsManager() + .getDatabase() + .getTags((unit) => unit.category === "groundunit"), + navyunit: getApp() + ?.getUnitsManager() + .getDatabase() + .getTags((unit) => unit.category === "navyunit"), + }); }); CommandModeOptionsChangedEvent.on((commandModeOptions) => { @@ -314,15 +334,9 @@ export function SpawnContextMenu(props: {}) { /> ); })} - {blueprints?.length === 0 && ( - - No aircraft available - - )} + `}>No aircraft available}
)} @@ -370,15 +384,9 @@ export function SpawnContextMenu(props: {}) { /> ); })} - {blueprints?.length === 0 && ( - - No helicopter available - - )} + `}>No helicopter available}
)} @@ -429,15 +437,9 @@ export function SpawnContextMenu(props: {}) { /> ); })} - {blueprints?.length === 0 && ( - - No air defence unit available - - )} + `}>No air defence unit available} )} @@ -467,6 +469,29 @@ export function SpawnContextMenu(props: {}) { ); })} +
+ {tags.groundunit + .sort() + .map((type) => { + return ( +
{ + selectedType === type ? setSelectedType(null) : setSelectedType(type); + }} + > + {type} +
+ ); + })} +
); })} - {blueprints?.length === 0 && ( - - No ground unit available - - )} + `}>No ground unit available}
)} @@ -558,15 +577,9 @@ export function SpawnContextMenu(props: {}) { /> ); })} - {blueprints?.length === 0 && ( - - No navy unit available - - )} + `}>No navy unit available} )} diff --git a/frontend/react/src/unit/databases/unitdatabase.ts b/frontend/react/src/unit/databases/unitdatabase.ts index 711ca81e..f2bc0ffd 100644 --- a/frontend/react/src/unit/databases/unitdatabase.ts +++ b/frontend/react/src/unit/databases/unitdatabase.ts @@ -110,6 +110,22 @@ export class UnitDatabase { return types; } + /* Returns a list of all tags in a database */ + getTags(unitFilter?: (unit: UnitBlueprint) => boolean) { + var filteredBlueprints = this.getBlueprints(); + var tags: string[] = []; + for (let unit of filteredBlueprints) { + if (typeof unitFilter === "function" && !unitFilter(unit)) continue; + let unitTags = unit.tags?.split(" "); + if (unitTags) { + for (let tag of unitTags) { + if (tag.replaceAll(" ", "") !== "" && !tags.includes(tag)) tags.push(tag); + } + } + } + return tags; + } + /* Returns a list of all possible eras in a database */ getEras(unitFilter?: (unit: UnitBlueprint) => boolean) { var filteredBlueprints = this.getBlueprints(); diff --git a/manager/ejs/passwords.ejs b/manager/ejs/passwords.ejs index 15c8bd5b..491662a0 100644 --- a/manager/ejs/passwords.ejs +++ b/manager/ejs/passwords.ejs @@ -53,7 +53,7 @@
-
Autoconnect when local +
Autoconnect when local
diff --git a/manager/javascripts/dcsinstance.js b/manager/javascripts/dcsinstance.js index ca9ca63c..ccbd375a 100644 --- a/manager/javascripts/dcsinstance.js +++ b/manager/javascripts/dcsinstance.js @@ -192,7 +192,7 @@ class DCSInstance { /* Read the new configurations added in v2.0.0 */ if (config["frontend"]["autoconnectWhenLocal"] !== undefined) this.autoconnectWhenLocal = config["frontend"]["autoconnectWhenLocal"]; - if (config["frontend"]["audio"] !== undefined && config["frontend"]["audio"]["SRSPort"] !== undefined) + if (config["audio"] !== undefined && config["audio"]["SRSPort"] !== undefined) this.SRSPort = config["audio"]["SRSPort"]; this.gameMasterPasswordEdited = false; diff --git a/manager/javascripts/manager.js b/manager/javascripts/manager.js index 691bedc8..4e9a1493 100644 --- a/manager/javascripts/manager.js +++ b/manager/javascripts/manager.js @@ -175,8 +175,10 @@ class Manager { /* Reset default radio buttons */ this.typePage.options.onShow = () => { - if (this.getActiveInstance()) + if (this.getActiveInstance()) { this.getActiveInstance().installationType = 'singleplayer'; + this.getActiveInstance().autoconnectWhenLocal = true; + } else { showErrorPopup(`
A critical error occurred!
Check ${this.getLogLocation()} for more info.
`); } @@ -335,7 +337,7 @@ class Manager { this.typePage.getElement().querySelector(`.multiplayer`).classList.toggle("selected", type === 'multiplayer'); if (this.getActiveInstance()) { this.getActiveInstance().installationType = type; - this.getActiveInstance().autoconnectWhenLocal = type === 'singleplayer'; + this.getActiveInstance().autoconnectWhenLocal = (type === 'singleplayer'); } else { showErrorPopup(`
A critical error occurred!
Check ${this.getLogLocation()} for more info.
`); @@ -570,7 +572,11 @@ class Manager { } else { this.getActiveInstance().autoconnectWhenLocal = true; } - this.expertSettingsPage.getElement().querySelector(".autoconnect .checkbox").classList.toggle("checked", this.getActiveInstance().autoconnectWhenLocal) + if (this.getMode() === 'basic') { + this.passwordsPage.getElement().querySelector(".autoconnect .checkbox").classList.toggle("checked", this.getActiveInstance().autoconnectWhenLocal); + } else { + this.expertSettingsPage.getElement().querySelector(".autoconnect .checkbox").classList.toggle("checked", this.getActiveInstance().autoconnectWhenLocal); + } } else { showErrorPopup(`
A critical error occurred!
Check ${this.getLogLocation()} for more info.
`) } diff --git a/olympus.json b/olympus.json index 7fd166ea..c1e66362 100644 --- a/olympus.json +++ b/olympus.json @@ -13,7 +13,7 @@ "gameMasterPassword": "", "blueCommanderPassword": "", "redCommanderPassword": "", - "admin": "" + "adminPassword": "" }, "_comment6": "These are the settings for the frontend server, i.e. the server which hosts the Olympus GUI web interface.",