From 43aa7aca2694c8f201269d3fc940f509d1521ea3 Mon Sep 17 00:00:00 2001 From: "Nikolai V. Chr" Date: Sat, 23 Sep 2023 21:33:49 +0200 Subject: [PATCH] Radar: Give MP carriers RCS --- Nasal/radar/radar-system-database.nas | 24 ++++++++++++++++-------- Nasal/radar/rcs.nas | 7 ++++++- f16-base.xml | 1 + 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Nasal/radar/radar-system-database.nas b/Nasal/radar/radar-system-database.nas index af6c79af..e7cd7304 100644 --- a/Nasal/radar/radar-system-database.nas +++ b/Nasal/radar/radar-system-database.nas @@ -240,19 +240,27 @@ var Database = { "F-23C_BlackWidow-II": {}, }; -if (defined(rcs.rcs_database)) { - foreach(entry : keys(rcs.rcs_database)) { - Database[entry].rcsFrontal = rcs_database[entry]; +if (rcs["rcs_database"] != nil) { + foreach(entry ; keys(rcs.rcs_database)) { + if (Database[entry] == nil) { + Database[entry] = {}; + } + Database[entry].rcsFrontal = rcs.rcs_database[entry]; } } -foreach(entry : keys(rcs.rcs_oprf_database)) { +foreach(entry ; keys(rcs.rcs_oprf_database)) { + if (Database[entry] == nil) { + Database[entry] = {}; + } Database[entry].rcsFrontal = rcs.rcs_oprf_database[entry]; } -foreach (entry : keys(Database)) { - if (Database[entry].rcsFrontal == nil) { - print("Database: ",entry," is missing ",rcsFrontal); +foreach (entry ; keys(Database)) { + if (Database[entry]["rcsFrontal"] == nil) { + if (debugLevel > 0) print("Database: ",entry," is missing rcsFrontal, using default"); } Database[entry]["parents"] = [BaseEntry]; -} \ No newline at end of file +} + +var debugLevel = 1; \ No newline at end of file diff --git a/Nasal/radar/rcs.nas b/Nasal/radar/rcs.nas index ad55348d..f846b49a 100644 --- a/Nasal/radar/rcs.nas +++ b/Nasal/radar/rcs.nas @@ -107,6 +107,11 @@ var rcs_database = { "T-50": 0.5, #low end of sources "u-2s": 0.01, "U-2S-model": 0.01, + #Carriers + "mp-clemenceau": 500, + "mp-eisenhower": 500, + "mp-nimitz": 500, + "mp-vinson": 500, }; var prevVisible = {}; @@ -177,7 +182,7 @@ var targetRCSSignal = func(targetCoord, targetModel, targetHeading, targetPitch, target_front_rcs = rcs_database[targetModel]; } else { return 1; - target_front_rcs = rcs_database["default"]; + target_front_rcs = rcs_oprf_database["default"]; } #print(target_front_rcs," RCS from ", targetModel, " m:", myRadarDistance_m, " rcs:",myRadarStrength_rcs); var target_rcs = getRCS(targetCoord, targetHeading, targetPitch, targetRoll, myCoord, target_front_rcs); diff --git a/f16-base.xml b/f16-base.xml index b633a379..d11f78d6 100644 --- a/f16-base.xml +++ b/f16-base.xml @@ -1684,6 +1684,7 @@ Aircraft/f16/Nasal/help.nas + Aircraft/f16/Nasal/radar/radar-system-database.nas Aircraft/f16/Nasal/radar/radar-system.nas Aircraft/f16/Nasal/radar/apg-68.nas