mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Migrate air icons to milsymbol.
All NATO icons are now generated by the milsymbol library based on their SIDC.
This commit is contained in:
@@ -34,66 +34,6 @@ const Colors = Object.freeze({
|
||||
Highlight: "#ffff00",
|
||||
});
|
||||
|
||||
const Categories = Object.freeze([
|
||||
"aa",
|
||||
"allycamp",
|
||||
"ammo",
|
||||
"armor",
|
||||
"coastal",
|
||||
"comms",
|
||||
"derrick",
|
||||
"ewr",
|
||||
"factory",
|
||||
"farp",
|
||||
"fuel",
|
||||
"missile",
|
||||
"oil",
|
||||
"power",
|
||||
"ship",
|
||||
"village",
|
||||
"ware",
|
||||
"ww2bunker",
|
||||
]);
|
||||
|
||||
const UnitState = Object.freeze({
|
||||
Alive: "alive",
|
||||
Damaged: "damaged",
|
||||
Destroyed: "destroyed",
|
||||
});
|
||||
|
||||
class AirIcons {
|
||||
constructor() {
|
||||
this.icons = {};
|
||||
for (const player of [true, false]) {
|
||||
this.icons[player] = {};
|
||||
for (const selected of [true, false]) {
|
||||
this.icons[player][selected] = this.loadIcon(
|
||||
"unspecified",
|
||||
player,
|
||||
selected
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
icon(_category, player, selected) {
|
||||
return this.icons[player][selected];
|
||||
}
|
||||
|
||||
loadIcon(category, player, selected) {
|
||||
var color;
|
||||
if (selected) {
|
||||
color = "selected";
|
||||
} else {
|
||||
color = player ? "blue" : "red";
|
||||
}
|
||||
return new L.Icon({
|
||||
iconUrl: `../air_assets/${category}_${color}.svg`,
|
||||
iconSize: [24, 24],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function milSymbolIcon(sidc, options = {}) {
|
||||
const symbol = new ms.Symbol(sidc, options);
|
||||
return L.icon({
|
||||
@@ -102,10 +42,6 @@ function milSymbolIcon(sidc, options = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
const Icons = Object.freeze({
|
||||
AirIcons: new AirIcons(),
|
||||
});
|
||||
|
||||
function metersToNauticalMiles(meters) {
|
||||
return meters * 0.000539957;
|
||||
}
|
||||
@@ -923,7 +859,7 @@ class Flight {
|
||||
this.clearAircraftLocation();
|
||||
if (this.position != null) {
|
||||
this.aircraft = L.marker(this.position, {
|
||||
icon: Icons.AirIcons.icon("fighter", this.flight.blue, this.selected),
|
||||
icon: milSymbolIcon(this.flight.sidc, { size: 16 }),
|
||||
}).addTo(aircraftLayer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user