From e36c62b30e295e14611b50b5f3c272c2717f049b Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Mon, 7 Mar 2022 21:45:33 -0800 Subject: [PATCH] Identify aircraft types based on their mission. It would probably be more accurate to have the icon based on the aircraft type and use the modifier to indicate the mission, but this will do for now (I also might have that backwards, I can't find the guidance because it's in STANAG 1241 which isn't free). I also increased the icon size a bit in the UI because the longest icon text ("SEAD") was hard to read. --- client/src/components/aircraft/Aircraft.tsx | 2 +- game/ato/flight.py | 3 +-- game/ato/flighttype.py | 25 +++++++++++++++++++++ game/sidc.py | 19 ++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/client/src/components/aircraft/Aircraft.tsx b/client/src/components/aircraft/Aircraft.tsx index d8f3a1a7..c9bdb184 100644 --- a/client/src/components/aircraft/Aircraft.tsx +++ b/client/src/components/aircraft/Aircraft.tsx @@ -5,7 +5,7 @@ import { Marker } from "react-leaflet"; function iconForFlight(flight: Flight) { const symbol = new Symbol(flight.sidc, { - size: 16, + size: 20, }); return new Icon({ diff --git a/game/ato/flight.py b/game/ato/flight.py index 67fec518..e7d1934e 100644 --- a/game/ato/flight.py +++ b/game/ato/flight.py @@ -13,7 +13,6 @@ from .flightstate import FlightState, Uninitialized from .flightstate.killed import Killed from .loadouts import Loadout from ..sidc import ( - AirEntity, Entity, SidcDescribable, StandardIdentity, @@ -122,7 +121,7 @@ class Flight(SidcDescribable): @property def symbol_set_and_entity(self) -> tuple[SymbolSet, Entity]: - return SymbolSet.AIR, AirEntity.UNSPECIFIED + return SymbolSet.AIR, self.flight_type.entity_type @property def departure(self) -> ControlPoint: diff --git a/game/ato/flighttype.py b/game/ato/flighttype.py index de38f9bf..87c080d7 100644 --- a/game/ato/flighttype.py +++ b/game/ato/flighttype.py @@ -2,6 +2,8 @@ from __future__ import annotations from enum import Enum +from game.sidc import AirEntity + class FlightType(Enum): """Enumeration of mission types. @@ -88,3 +90,26 @@ class FlightType(Enum): FlightType.OCA_AIRCRAFT, FlightType.SEAD_ESCORT, } + + @property + def entity_type(self) -> AirEntity: + return { + FlightType.AEWC: AirEntity.AIRBORNE_EARLY_WARNING, + FlightType.ANTISHIP: AirEntity.ANTISURFACE_WARFARE, + FlightType.BAI: AirEntity.ATTACK_STRIKE, + FlightType.BARCAP: AirEntity.FIGHTER, + FlightType.CAS: AirEntity.ATTACK_STRIKE, + FlightType.DEAD: AirEntity.ATTACK_STRIKE, + FlightType.ESCORT: AirEntity.ESCORT, + FlightType.FERRY: AirEntity.UNSPECIFIED, + FlightType.INTERCEPTION: AirEntity.FIGHTER, + FlightType.OCA_AIRCRAFT: AirEntity.ATTACK_STRIKE, + FlightType.OCA_RUNWAY: AirEntity.ATTACK_STRIKE, + FlightType.REFUELING: AirEntity.TANKER, + FlightType.SEAD: AirEntity.SUPPRESSION_OF_ENEMY_AIR_DEFENCE, + FlightType.SEAD_ESCORT: AirEntity.SUPPRESSION_OF_ENEMY_AIR_DEFENCE, + FlightType.STRIKE: AirEntity.ATTACK_STRIKE, + FlightType.SWEEP: AirEntity.FIGHTER, + FlightType.TARCAP: AirEntity.FIGHTER, + FlightType.TRANSPORT: AirEntity.UTILITY, + }.get(self, AirEntity.UNSPECIFIED) diff --git a/game/sidc.py b/game/sidc.py index 9a6761ff..41438e01 100644 --- a/game/sidc.py +++ b/game/sidc.py @@ -207,6 +207,25 @@ class AirEntity(Entity): """Air Entity/Entity Type/Entity Subtype defined by table A-10.""" UNSPECIFIED = 0 + ATTACK_STRIKE = 110102 + BOMBER = 110103 + FIGHTER = 110104 + FIGHTER_BOMBER = 110105 + CARGO = 110107 + ELECTRONIC_COMBAT_JAMMER = 110108 + TANKER = 110109 + PATROL = 110110 + RECONNAISSANCE = 110111 + UTILITY = 110113 + VSTOL = 110114 + AIRBORNE_EARLY_WARNING = 110116 + ANTISURFACE_WARFARE = 110117 + ANTISUBMARINE_WARFARE = 110118 + COMBAT_SEARCH_AND_RESCUE = 110120 + SUPPRESSION_OF_ENEMY_AIR_DEFENCE = 110130 + ESCORT = 110132 + ELECTRONIC_ATTACK = 110133 + ROTARY_WING = 110200 @unique