feat: added missing carriers data
@@ -1,172 +0,0 @@
|
||||
import json
|
||||
file_path = 'aircraftdatabase.json'
|
||||
|
||||
aircraft_lengths = {
|
||||
"A-10C Warthog 2": 53 ,
|
||||
"A-20G Havoc": 52 ,
|
||||
"A-50 Mainstay": 152 ,
|
||||
"KJ-2000": 152 ,
|
||||
"AJS37 Viggen": 52 ,
|
||||
"AV8BNA Harrier": 46 ,
|
||||
"An-26B Curl": 78 ,
|
||||
"An-30M Clank": 80 ,
|
||||
"B-1B Lancer": 146,
|
||||
"B-52H Stratofortress": 159 ,
|
||||
"Bf-109K-4": 29 ,
|
||||
"C-101CC": 42 ,
|
||||
"C-130 Hercules": 97 ,
|
||||
"C-17A Globemaster": 174,
|
||||
"E-2D Hawkeye": 57 ,
|
||||
"E-3A Sentry": 152 ,
|
||||
"F-117A Nighthawk": 65 ,
|
||||
"F-14A-135-GR Tomcat": 62 ,
|
||||
"F-14B Tomcat": 62 ,
|
||||
"F-15C Eagle": 63 ,
|
||||
"F-16C Viper": 49 ,
|
||||
"F-4E Phantom II": 63 ,
|
||||
"F-5E Tiger": 47 ,
|
||||
"F-86F Sabre": 37 ,
|
||||
"F/A-18C": 56 ,
|
||||
"FW-190A8 Würger": 29 ,
|
||||
"FW-190D9 Dora": 33 ,
|
||||
"H-6 J Badger": 114 ,
|
||||
"I-16": 20 ,
|
||||
"IL-76MD Candid": 152 ,
|
||||
"IL-78M Midas": 152 ,
|
||||
"J-11A Flaming Dragon": 71 ,
|
||||
"JF-17 Thunder": 49 ,
|
||||
"KC-135 Stratotanker": 136 ,
|
||||
"KC-135 MPRS Stratotanker": 136 ,
|
||||
"L-39ZA": 40 ,
|
||||
"M-2000C Mirage": 47 ,
|
||||
"MB-339A": 36 ,
|
||||
"MQ-9 Reaper": 36 ,
|
||||
"MiG-15 Fagot": 33 ,
|
||||
"MiG-19 Farmer": 41 ,
|
||||
"MiG-21 Fishbed": 51 ,
|
||||
"MiG-23 Flogger": 54 ,
|
||||
"MiG-25PD Foxbat": 64 ,
|
||||
"MiG-25RBT Foxbat": 64 ,
|
||||
"MiG-27K Flogger-D": 56 ,
|
||||
"MiG-29A Fulcrum": 56 ,
|
||||
"MiG-29S Fulcrum": 56 ,
|
||||
"MiG-31 Foxhound": 74 ,
|
||||
"Mirage-F1EE": 49 ,
|
||||
"Mosquito FB MkVI": 41 ,
|
||||
"P-47D Thunderbolt": 36 ,
|
||||
"P-51D Mustang": 32 ,
|
||||
"S-3B Tanker": 53 ,
|
||||
"Su-17M4 Fitter": 61 ,
|
||||
"Su-24M Fencer": 75 ,
|
||||
"Su-25T Frogfoot": 50 ,
|
||||
"Su-27 Flanker": 71 ,
|
||||
"Su-30 Super Flanker": 72 ,
|
||||
"Su-33 Navy Flanker": 72 ,
|
||||
"Su-34 Hellduck": 76 ,
|
||||
"Tornado GR4": 54 ,
|
||||
"Tornado IDS": 54 ,
|
||||
"Tu-142 Bear": 177 ,
|
||||
"Tu-160 Blackjack": 177 ,
|
||||
"Tu-22M3 Backfire": 139 ,
|
||||
"Tu-95MS Bear": 162 ,
|
||||
"F-15E Strike Eagle": 63 ,
|
||||
"F-14A Tomcat": 62 ,
|
||||
"Su-25TM": 50 ,
|
||||
"Su-24MR Fencer": 75 ,
|
||||
"S-3B": 53 ,
|
||||
"Mirage 2000-5": 47 ,
|
||||
"MiG-29G Fulcrum": 56 ,
|
||||
"F-16C Viper Block 50": 49 ,
|
||||
"F-16C BL.52D": 49 ,
|
||||
"F-16A Viper": 49 ,
|
||||
"F-16A Viper MLU": 49 ,
|
||||
"RQ-1A Predator": 27 ,
|
||||
"Yak-40": 64 ,
|
||||
"Spitfire Mk IX": 30 ,
|
||||
"Spitfire Mk IX CW": 30 ,
|
||||
"P-51D Mustang": 32 ,
|
||||
"P-47D-30": 36 ,
|
||||
"A-10A Warthog": 53 ,
|
||||
"A-10C Warthog": 53 ,
|
||||
"KC-130": 97 ,
|
||||
"C-101EB": 42 ,
|
||||
"MQ-9 Reaper": 36 ,
|
||||
"Christen Eagle II": 19 ,
|
||||
"F-5E": 47 ,
|
||||
"F/A-18A": 56 ,
|
||||
"F/A-18C": 56 ,
|
||||
"Hawk": 39 ,
|
||||
"L-39C": 40 ,
|
||||
"MB-339APAN": 36 ,
|
||||
"Mirage-F1C": 49 ,
|
||||
"Mirage-F1CE": 49 ,
|
||||
"Mirage-F1M-EE": 49 ,
|
||||
"Mirage-F1M-CE": 49 ,
|
||||
"Mirage-F1C-200": 49 ,
|
||||
"Mirage-F1EH": 49 ,
|
||||
"Mirage-F1CH": 49 ,
|
||||
"Mirage-F1JA": 49 ,
|
||||
"Mirage-F1CG": 49 ,
|
||||
"Mirage-F1CZ": 49 ,
|
||||
"Mirage-F1CJ": 49 ,
|
||||
"Mirage-F1CK": 49 ,
|
||||
"Mirage-F1EQ": 49 ,
|
||||
"Mirage-F1ED": 49 ,
|
||||
"Mirage-F1EDA": 49 ,
|
||||
"Mirage-F1CR": 49 ,
|
||||
"Mirage-F1CT": 49 ,
|
||||
"Mirage-F1B": 49 ,
|
||||
"Mirage-F1BE": 49 ,
|
||||
"Mirage-F1BQ": 49 ,
|
||||
"Mirage-F1BD": 49 ,
|
||||
"Mirage-F1DDA": 49 ,
|
||||
"SU-25TM": 49.5 ,
|
||||
"MIRAGE 2000-5": 47.1 ,
|
||||
"RQ-1A PREDATOR": 27.2 ,
|
||||
"YAK-40": 77.1 ,
|
||||
"Spitfire Mk 9": 29.9 ,
|
||||
"Spitfire Mk 9 CW": 29.9 ,
|
||||
"CHRISTEN EAGLE II": 20.5 ,
|
||||
"MIRAGE-F1C": 49.5 ,
|
||||
"MIRAGE-F1CE": 49.5 ,
|
||||
"MIRAGE-F1M-EE": 49.5 ,
|
||||
"MIRAGE-F1M-CE": 49.5 ,
|
||||
"MIRAGE-F1C-200": 49.5 ,
|
||||
"MIRAGE-F1EH": 49.5 ,
|
||||
"MIRAGE-F1CH": 49.5 ,
|
||||
"MIRAGE-F1JA": 49.5 ,
|
||||
"MIRAGE-F1CG": 49.5 ,
|
||||
"MIRAGE-F1CZ": 49.5 ,
|
||||
"MIRAGE-F1CJ": 49.5 ,
|
||||
"MIRAGE-F1CK": 49.5 ,
|
||||
"MIRAGE-F1EQ": 49.5 ,
|
||||
"MIRAGE-F1ED": 49.5 ,
|
||||
"MIRAGE-F1EDA": 49.5 ,
|
||||
"MIRAGE-F1CR": 49.5 ,
|
||||
"MIRAGE-F1CT": 49.5 ,
|
||||
"MIRAGE-F1B": 49.5 ,
|
||||
"MIRAGE-F1BE": 49.5 ,
|
||||
"MIRAGE-F1BQ": 49.5 ,
|
||||
"MIRAGE-F1BD": 49.5 ,
|
||||
"MIRAGE-F1DDA": 49.5 ,
|
||||
"YAK-52": 26.2 ,
|
||||
"B-17G Flying Fortress": 74.7 ,
|
||||
"JU-88 A4": 56.8 ,
|
||||
"C-47 Dakota": 63.5 ,
|
||||
"TF-51D": 32.8 ,
|
||||
"F-4E-45MC": 58.3
|
||||
}
|
||||
|
||||
with open(file_path, 'r', -1, 'utf-8') as f:
|
||||
aircraft_data = json.load(f)
|
||||
|
||||
|
||||
aircraft_labels = [entry.get("label", "") for entry in aircraft_data.values()]
|
||||
|
||||
for entry in aircraft_data.values():
|
||||
if entry.get("label", "") in aircraft_lengths:
|
||||
entry["length"] = aircraft_lengths[entry.get("label", "")]
|
||||
|
||||
|
||||
with open(file_path, 'w', -1, 'utf-8') as f:
|
||||
json.dump(aircraft_data, f, indent=4)
|
||||
@@ -17,8 +17,8 @@
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false,
|
||||
"carrierFilename": "nimitz.svg",
|
||||
"length": 300
|
||||
"carrierFilename": "nimitz.png",
|
||||
"length": 333
|
||||
},
|
||||
"CVN_72": {
|
||||
"name": "CVN_72",
|
||||
@@ -38,8 +38,8 @@
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false,
|
||||
"carrierFilename": "nimitz.svg",
|
||||
"length": 300
|
||||
"carrierFilename": "nimitz.png",
|
||||
"length": 333
|
||||
},
|
||||
"CVN_73": {
|
||||
"name": "CVN_73",
|
||||
@@ -59,8 +59,8 @@
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false,
|
||||
"carrierFilename": "nimitz.svg",
|
||||
"length": 300
|
||||
"carrierFilename": "nimitz.png",
|
||||
"length": 333
|
||||
},
|
||||
"CVN_75": {
|
||||
"name": "CVN_75",
|
||||
@@ -102,8 +102,8 @@
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false,
|
||||
"carrierFilename": "nimitz.svg",
|
||||
"length": 300
|
||||
"carrierFilename": "nimitz.png",
|
||||
"length": 333
|
||||
},
|
||||
"CV_1143_5": {
|
||||
"name": "CV_1143_5",
|
||||
@@ -122,7 +122,9 @@
|
||||
"description": "Admiral Kuznetsov. Conventional STOBAR carrier",
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
"canRearm": false,
|
||||
"carrierFilename": "kuznetsov.png",
|
||||
"length": 305
|
||||
},
|
||||
"CastleClass_01": {
|
||||
"name": "CastleClass_01",
|
||||
@@ -240,7 +242,9 @@
|
||||
"description": "",
|
||||
"abilities": "",
|
||||
"canTargetPoint": true,
|
||||
"canRearm": false
|
||||
"canRearm": false,
|
||||
"carrierFilename": "tarawa.png",
|
||||
"length": 270
|
||||
},
|
||||
"La_Combattante_II": {
|
||||
"name": "La_Combattante_II",
|
||||
@@ -474,7 +478,9 @@
|
||||
"description": "",
|
||||
"abilities": "",
|
||||
"canTargetPoint": true,
|
||||
"canRearm": false
|
||||
"canRearm": false,
|
||||
"carrierFilename": "nimitz.png",
|
||||
"length": 333
|
||||
},
|
||||
"TICONDEROG": {
|
||||
"name": "TICONDEROG",
|
||||
@@ -910,7 +916,9 @@
|
||||
"description": "",
|
||||
"abilities": "",
|
||||
"canTargetPoint": true,
|
||||
"canRearm": false
|
||||
"canRearm": false,
|
||||
"carrierFilename": "vienticincodemayo.png",
|
||||
"length": 210
|
||||
},
|
||||
"hms_invincible": {
|
||||
"name": "hms_invincible",
|
||||
@@ -929,7 +937,9 @@
|
||||
"description": "",
|
||||
"abilities": "",
|
||||
"canTargetPoint": true,
|
||||
"canRearm": false
|
||||
"canRearm": false,
|
||||
"carrierFilename": "invincible.png",
|
||||
"length": 206
|
||||
},
|
||||
"leander-gun-achilles": {
|
||||
"name": "leander-gun-achilles",
|
||||
@@ -1198,7 +1208,9 @@
|
||||
"description": "",
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
"canRearm": false,
|
||||
"carrierFilename": "kuznetsov.png",
|
||||
"length": 305
|
||||
},
|
||||
"MOLNIYA": {
|
||||
"name": "MOLNIYA",
|
||||
@@ -1485,7 +1497,9 @@
|
||||
"description": "",
|
||||
"abilities": "",
|
||||
"canTargetPoint": false,
|
||||
"canRearm": false
|
||||
"canRearm": false,
|
||||
"carrierFilename": "forrestal.png",
|
||||
"length": 326
|
||||
},
|
||||
"LST_Mk2": {
|
||||
"name": "LST_Mk2",
|
||||
|
||||
|
Before Width: | Height: | Size: 728 KiB |
BIN
frontend/react/public/images/carriers/forrestal.png
Normal file
|
After Width: | Height: | Size: 763 KiB |
BIN
frontend/react/public/images/carriers/invincible.png
Normal file
|
After Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 862 KiB After Width: | Height: | Size: 861 KiB |
BIN
frontend/react/public/images/carriers/tarawa.png
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
frontend/react/public/images/carriers/vienticincodemayo.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
@@ -299,6 +299,7 @@ export interface UnitBlueprint {
|
||||
unitWhenGrouped?: string;
|
||||
mainRole?: string;
|
||||
length?: number;
|
||||
carrierFilename?: string;
|
||||
}
|
||||
|
||||
export interface AirbaseOptions {
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import { DivIcon, Map } from "leaflet";
|
||||
import { Airbase } from "./airbase";
|
||||
import { AirbaseOptions } from "../interfaces";
|
||||
import { Unit } from "../unit/unit";
|
||||
|
||||
// TODO add more carrier types, currently works only for the Nimitz class
|
||||
export class Carrier extends Airbase {
|
||||
#unit: Unit;
|
||||
|
||||
constructor(unit: Unit, options: AirbaseOptions) {
|
||||
super(options);
|
||||
this.#unit = unit;
|
||||
}
|
||||
createIcon() {
|
||||
var icon = new DivIcon({
|
||||
className: "leaflet-airbase-marker",
|
||||
@@ -15,7 +22,7 @@ export class Carrier extends Airbase {
|
||||
el.classList.add("airbase-icon");
|
||||
el.setAttribute("data-object", "airbase");
|
||||
|
||||
this.getImg().src = "./images/carriers/nimitz.png";
|
||||
this.getImg().src = `./images/carriers/${this.#unit.getBlueprint()?.carrierFilename ?? ""}`;
|
||||
this.getImg().style.width = `0px`; // Make the image immediately small to avoid giant carriers
|
||||
el.appendChild(this.getImg());
|
||||
this.getElement()?.appendChild(el);
|
||||
@@ -44,7 +51,7 @@ export class Carrier extends Airbase {
|
||||
const x = this._map.getSize().x;
|
||||
const maxMeters = this._map.containerPointToLatLng([0, y]).distanceTo(this._map.containerPointToLatLng([x, y]));
|
||||
const meterPerPixel = maxMeters / x;
|
||||
this.getImg().style.width = `${Math.round(333 / meterPerPixel)}px`;
|
||||
this.getImg().style.width = `${Math.round((this.#unit.getBlueprint()?.length ?? 333) / meterPerPixel)}px`;
|
||||
this.setZIndexOffset(-10000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2058,7 +2058,7 @@ export class NavyUnit extends Unit {
|
||||
onAdd(map: Map): this {
|
||||
super.onAdd(map);
|
||||
if (this.getBlueprint()?.type === "Aircraft Carrier")
|
||||
this.#carrier = new Carrier({
|
||||
this.#carrier = new Carrier(this, {
|
||||
position: this.getPosition(),
|
||||
name: this.getUnitName(),
|
||||
}).addTo(getApp().getMap());
|
||||
|
||||