mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added livery ID
This commit is contained in:
1
client/src/@types/unitdatabase.d.ts
vendored
1
client/src/@types/unitdatabase.d.ts
vendored
@@ -22,4 +22,5 @@ interface UnitBlueprint {
|
||||
range?: string;
|
||||
loadouts?: LoadoutBlueprint[];
|
||||
filename?: string;
|
||||
liveryID?: string;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,8 @@ export class MapContextMenu extends ContextMenu {
|
||||
document.addEventListener("contextMenuDeployAircrafts", () => {
|
||||
this.#spawnOptions.coalition = getActiveCoalition();
|
||||
if (this.#spawnOptions) {
|
||||
var unitTable = {unitType: this.#spawnOptions.name, location: this.#spawnOptions.latlng, altitude: this.#spawnOptions.altitude, loadout: this.#spawnOptions.loadout};
|
||||
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);
|
||||
@@ -107,7 +108,8 @@ export class MapContextMenu extends ContextMenu {
|
||||
document.addEventListener("contextMenuDeployHelicopters", () => {
|
||||
this.#spawnOptions.coalition = getActiveCoalition();
|
||||
if (this.#spawnOptions) {
|
||||
var unitTable = {unitType: this.#spawnOptions.name, location: this.#spawnOptions.latlng, altitude: this.#spawnOptions.altitude, loadout: this.#spawnOptions.loadout};
|
||||
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);
|
||||
@@ -122,7 +124,8 @@ export class MapContextMenu extends ContextMenu {
|
||||
document.addEventListener("contextMenuDeployGroundUnits", () => {
|
||||
this.#spawnOptions.coalition = getActiveCoalition();
|
||||
if (this.#spawnOptions) {
|
||||
var unitTable = {unitType: this.#spawnOptions.name, location: this.#spawnOptions.latlng};
|
||||
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)));
|
||||
@@ -138,7 +141,8 @@ export class MapContextMenu extends ContextMenu {
|
||||
document.addEventListener("contextMenuDeployNavyUnits", () => {
|
||||
this.#spawnOptions.coalition = getActiveCoalition();
|
||||
if (this.#spawnOptions) {
|
||||
var unitTable = {unitType: this.#spawnOptions.name, location: this.#spawnOptions.latlng};
|
||||
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)));
|
||||
|
||||
@@ -77,7 +77,7 @@ export class MissionHandler {
|
||||
this.#dateAndTime = data.mission.dateAndTime;
|
||||
|
||||
/* Set the coalition countries */
|
||||
this.#coalitions = data.mission.coalitions;
|
||||
//this.#coalitions = data.mission.coalitions;
|
||||
|
||||
/* Set the command mode options */
|
||||
this.#setcommandModeOptions(data.mission.commandModeOptions);
|
||||
|
||||
@@ -311,6 +311,11 @@ export class Unit extends CustomMarker {
|
||||
}
|
||||
}
|
||||
|
||||
getLiveryID(): string {
|
||||
const liveryID = this.getDatabase()?.getByName(this.getName())?.liveryID;
|
||||
return liveryID? liveryID: "";
|
||||
}
|
||||
|
||||
setAlive(newAlive: boolean) {
|
||||
if (newAlive != this.#alive)
|
||||
document.dispatchEvent(new CustomEvent("unitDeath", { detail: this }));
|
||||
|
||||
@@ -555,7 +555,7 @@ export class UnitsManager {
|
||||
var unit = selectedUnits[idx];
|
||||
coalition = unit.getCoalition();
|
||||
deleteUnit(unit.ID, false, true);
|
||||
units.push({unitType: unit.getName(), location: unit.getPosition()});
|
||||
units.push({unitType: unit.getName(), location: unit.getPosition(), liveryID: unit.getLiveryID()});
|
||||
}
|
||||
const category = this.getSelectedUnitsTypes()[0];
|
||||
this.spawnUnits(category, units, coalition, true);
|
||||
@@ -593,7 +593,8 @@ export class UnitsManager {
|
||||
var units = groups[groupName].map((unit: any) => {
|
||||
var position = new LatLng(getMap().getMouseCoordinates().lat + unit.position.lat - avgLat, getMap().getMouseCoordinates().lng + unit.position.lng - avgLng);
|
||||
getMap().addTemporaryMarker(position, unit.name, unit.coalition);
|
||||
return {unitType: unit.name, location: position};
|
||||
const liveryID = unit.getDatabase()?.getByName(unit.getName())?.liveryID;
|
||||
return {unitType: unit.name, location: position, liveryID: liveryID? liveryID: ""};
|
||||
});
|
||||
this.spawnUnits(groups[groupName][0].category, units, groups[groupName][0].coalition, true);
|
||||
}
|
||||
@@ -629,7 +630,8 @@ export class UnitsManager {
|
||||
if (Math.random() < IADSDensities[type]) {
|
||||
const unitBlueprint = randomUnitBlueprint(groundUnitDatabase, {type: type, eras: activeEras, ranges: activeRanges});
|
||||
if (unitBlueprint) {
|
||||
this.spawnUnits("GroundUnit", [{unitType: unitBlueprint.name, location: latlng}], coalitionArea.getCoalition(), true);
|
||||
const liveryID = unitBlueprint.liveryID;
|
||||
this.spawnUnits("GroundUnit", [{unitType: unitBlueprint.name, location: latlng, liveryID: liveryID? liveryID: ""}], coalitionArea.getCoalition(), true);
|
||||
getMap().addTemporaryMarker(latlng, unitBlueprint.name, coalitionArea.getCoalition());
|
||||
}
|
||||
}
|
||||
@@ -673,7 +675,10 @@ export class UnitsManager {
|
||||
for (let groupName in groups) {
|
||||
if (groupName !== "" && groups[groupName].length > 0 && (groups[groupName].every((unit: any) => {return unit.category == "GroundUnit";}) || groups[groupName].every((unit: any) => {return unit.category == "NavyUnit";}))) {
|
||||
var aliveUnits = groups[groupName].filter((unit: any) => {return unit.alive});
|
||||
var units = aliveUnits.map((unit: any) => {return {unitType: unit.name, location: unit.position}});
|
||||
var units = aliveUnits.map((unit: any) => {
|
||||
const liveryID = unit.getDatabase()?.getByName(unit.getName())?.liveryID;
|
||||
return { unitType: unit.name, location: unit.position, liveryID: liveryID? liveryID: "" }
|
||||
});
|
||||
getUnitsManager().spawnUnits(groups[groupName][0].category, units, groups[groupName][0].coalition, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user