diff --git a/game/ato/flight.py b/game/ato/flight.py index 09cfda30..f35da57d 100644 --- a/game/ato/flight.py +++ b/game/ato/flight.py @@ -11,6 +11,14 @@ from game.savecompat import has_save_compat_for from .flightroster import FlightRoster from .flightstate import FlightState, Uninitialized from .loadouts import Loadout +from ..sidc import ( + AirEntity, + Entity, + SidcDescribable, + StandardIdentity, + Status, + SymbolSet, +) if TYPE_CHECKING: from game.dcs.aircrafttype import AircraftType @@ -25,7 +33,7 @@ if TYPE_CHECKING: from .starttype import StartType -class Flight: +class Flight(SidcDescribable): def __init__( self, package: Package, @@ -103,6 +111,18 @@ class Flight: def blue(self) -> bool: return self.squadron.player + @property + def standard_identity(self) -> StandardIdentity: + return StandardIdentity.FRIEND if self.blue else StandardIdentity.HOSTILE_FAKER + + @property + def sidc_status(self) -> Status: + return Status.PRESENT + + @property + def symbol_set_and_entity(self) -> tuple[SymbolSet, Entity]: + return SymbolSet.AIR, AirEntity.UNSPECIFIED + @property def departure(self) -> ControlPoint: return self.squadron.location diff --git a/game/server/flights/models.py b/game/server/flights/models.py index fa7a2df7..0d05a68a 100644 --- a/game/server/flights/models.py +++ b/game/server/flights/models.py @@ -13,6 +13,7 @@ class FlightJs(BaseModel): id: UUID blue: bool position: LeafletPoint | None + sidc: str @staticmethod def for_flight(flight: Flight) -> FlightJs: @@ -23,4 +24,6 @@ class FlightJs(BaseModel): position = None if isinstance(flight.state, InFlight): position = flight.position().latlng() - return FlightJs(id=flight.id, blue=flight.blue, position=position) + return FlightJs( + id=flight.id, blue=flight.blue, position=position, sidc=str(flight.sidc()) + ) diff --git a/resources/ui/air_assets/unspecified_blue.svg b/resources/ui/air_assets/unspecified_blue.svg deleted file mode 100644 index f735dd46..00000000 --- a/resources/ui/air_assets/unspecified_blue.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/ui/air_assets/unspecified_red.svg b/resources/ui/air_assets/unspecified_red.svg deleted file mode 100644 index 4a7befcb..00000000 --- a/resources/ui/air_assets/unspecified_red.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/ui/air_assets/unspecified_selected.svg b/resources/ui/air_assets/unspecified_selected.svg deleted file mode 100644 index 373cf7f1..00000000 --- a/resources/ui/air_assets/unspecified_selected.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/ui/map/map.js b/resources/ui/map/map.js index fab0395d..34eff9c1 100644 --- a/resources/ui/map/map.js +++ b/resources/ui/map/map.js @@ -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); } }