getDesc().category reimplemented

unit:getCategory() reports "Airplane" for Helicopters
This commit is contained in:
Pax1601 2023-11-17 22:02:32 +01:00
parent 5bc685182b
commit 017a89b945
2 changed files with 55 additions and 55 deletions

View File

@ -15,11 +15,11 @@ export const BLUE_COMMANDER = "Blue commander";
export const RED_COMMANDER = "Red commander";
export const VISUAL = 1;
export const OPTIC = 2;
export const RADAR = 4;
export const IRST = 8;
export const RWR = 16;
export const DLINK = 32;
export const OPTIC = 2;
export const RADAR = 4;
export const IRST = 8;
export const RWR = 16;
export const DLINK = 32;
export const states: string[] = ["none", "idle", "reach-destination", "attack", "follow", "land", "refuel", "AWACS", "tanker", "bomb-point", "carpet-bomb", "bomb-building", "fire-at-area", "simulate-fire-fight", "scenic-aaa", "miss-on-purpose", "land-at-point"];
export const ROEs: string[] = ["free", "designated", "", "return", "hold"];
@ -35,16 +35,16 @@ export const ROEDescriptions: string[] = [
];
export const reactionsToThreatDescriptions: string[] = [
"None (No reaction)",
"Manoeuvre (no countermeasures)",
"Passive (Countermeasures only, no manoeuvre)",
"None (No reaction)",
"Manoeuvre (no countermeasures)",
"Passive (Countermeasures only, no manoeuvre)",
"Evade (Countermeasures and manoeuvers)"
];
export const emissionsCountermeasuresDescriptions: string[] = [
"Silent (Radar OFF, no ECM)",
"Attack (Radar only for targeting, ECM only if locked)",
"Defend (Radar for searching, ECM if locked)",
"Silent (Radar OFF, no ECM)",
"Attack (Radar only for targeting, ECM only if locked)",
"Defend (Radar for searching, ECM if locked)",
"Always on (Radar and ECM always on)"
];
@ -118,25 +118,25 @@ export const mapLayers = {
"ArcGIS Satellite": {
urlTemplate: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
minZoom: 1,
maxZoom: 18,
maxZoom: 19,
attribution: "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, GetApp().getMap()ping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"
},
"USGS Topo": {
urlTemplate: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}',
minZoom: 1,
maxZoom: 18,
maxZoom: 14,
attribution: 'Tiles courtesy of the <a href="https://usgs.gov/">U.S. Geological Survey</a>'
},
"OpenStreetMap Mapnik": {
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
minZoom: 1,
maxZoom: 18,
maxZoom: 20,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
},
"OPENVKarte": {
urlTemplate: 'https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png',
minZoom: 1,
maxZoom: 18,
maxZoom: 20,
attribution: 'Map <a href="https://memomaps.de/">memomaps.de</a> <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
},
"Esri.DeLorme": {
@ -148,7 +148,7 @@ export const mapLayers = {
"CyclOSM": {
urlTemplate: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
minZoom: 1,
maxZoom: 18,
maxZoom: 20,
attribution: '<a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render">CyclOSM</a> | Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}
}
@ -160,62 +160,62 @@ export const COALITIONAREA_DRAW_POLYGON = "Draw Coalition Area";
export const visibilityControls: string[] = ["human", "dcs", "aircraft", "helicopter", "groundunit-sam", "groundunit-other", "navyunit", "airbase"];
export const visibilityControlsTypes: string[][] = [["human"], ["dcs"], ["aircraft"], ["helicopter"], ["groundunit-sam", "groundunit-sam-radar", "groundunit-sam-launcher"], ["groundunit-other", "groundunit-ewr"], ["navyunit"], ["airbase"]];
export const visibilityControlsTooltips: string[] = ["Toggle human players visibility", "Toggle DCS controlled units visibility", "Toggle aircrafts visibility", "Toggle helicopter visibility", "Toggle SAM units visibility", "Toggle ground units (not SAM) visibility", "Toggle navy units visibility", "Toggle airbases visibility"];
export const MAP_MARKER_CONTROLS:MapMarkerControl[] = [{
"name":"Human",
export const MAP_MARKER_CONTROLS: MapMarkerControl[] = [{
"name": "Human",
"image": "visibility/human.svg",
"toggles": [ "human" ],
"toggles": ["human"],
"tooltip": "Toggle human players' visibility"
}, {
"image": "visibility/dcs.svg",
"isProtected": true,
"name":"DCS",
"name": "DCS",
"protectable": true,
"toggles": [ "dcs" ],
"toggles": ["dcs"],
"tooltip": "Toggle DCS-controlled units' visibility"
}, {
"image": "visibility/aircraft.svg",
"name":"Aircraft",
"toggles": [ "aircraft" ],
"name": "Aircraft",
"toggles": ["aircraft"],
"tooltip": "Toggle aircraft's visibility"
}, {
"image": "visibility/helicopter.svg",
"name":"Helicopter",
"toggles": [ "helicopter" ],
"name": "Helicopter",
"toggles": ["helicopter"],
"tooltip": "Toggle helicopters' visibility"
}, {
"image": "visibility/groundunit-sam.svg",
"name":"Air defence",
"toggles": [ "groundunit-sam" ],
"name": "Air defence",
"toggles": ["groundunit-sam"],
"tooltip": "Toggle air defence units' visibility"
}, {
"image": "visibility/groundunit-other.svg",
"name":"Ground units",
"toggles": [ "groundunit-other" ],
"name": "Ground units",
"toggles": ["groundunit-other"],
"tooltip": "Toggle ground units' visibility"
}, {
"image": "visibility/navyunit.svg",
"name":"Naval",
"toggles": [ "navyunit" ],
"name": "Naval",
"toggles": ["navyunit"],
"tooltip": "Toggle naval units' visibility"
}, {
"image": "visibility/airbase.svg",
"name":"Airbase",
"toggles": [ "airbase" ],
"name": "Airbase",
"toggles": ["airbase"],
"tooltip": "Toggle airbase' visibility"
}];
export const IADSTypes = ["AAA", "MANPADS", "SAM Site", "Radar"];
export const IADSDensities: {[key: string]: number}= {"AAA": 0.8, "MANPADS": 0.3, "SAM Site": 0.1, "Radar": 0.05};
export const IADSDensities: { [key: string]: number } = { "AAA": 0.8, "MANPADS": 0.3, "SAM Site": 0.1, "Radar": 0.05 };
export const HIDE_GROUP_MEMBERS = "Hide group members when zoomed out";
export const SHOW_UNIT_LABELS = "Show unit labels (L)";
export const SHOW_UNITS_ENGAGEMENT_RINGS = "Show units threat range rings (Q)";
export const HIDE_UNITS_SHORT_RANGE_RINGS = "Hide short range units threat range rings (R)";
export const SHOW_UNITS_ACQUISITION_RINGS = "Show units detection range rings (E)";
export const FILL_SELECTED_RING = "Fill the threat range rings of selected units (F)";
export const SHOW_UNIT_CONTACTS = "Show selected units contact lines";
export const SHOW_UNIT_PATHS = "Show selected unit paths";
export const SHOW_UNIT_TARGETS = "Show selected unit targets";
export const HIDE_GROUP_MEMBERS = "Hide group members when zoomed out";
export const SHOW_UNIT_LABELS = "Show unit labels (L)";
export const SHOW_UNITS_ENGAGEMENT_RINGS = "Show units threat range rings (Q)";
export const HIDE_UNITS_SHORT_RANGE_RINGS = "Hide short range units threat range rings (R)";
export const SHOW_UNITS_ACQUISITION_RINGS = "Show units detection range rings (E)";
export const FILL_SELECTED_RING = "Fill the threat range rings of selected units (F)";
export const SHOW_UNIT_CONTACTS = "Show selected units contact lines";
export const SHOW_UNIT_PATHS = "Show selected unit paths";
export const SHOW_UNIT_TARGETS = "Show selected unit targets";
export enum DataIndexes {
startOfData = 0,
@ -267,12 +267,12 @@ export enum DataIndexes {
};
export const MGRS_PRECISION_10KM = 2;
export const MGRS_PRECISION_1KM = 3;
export const MGRS_PRECISION_1KM = 3;
export const MGRS_PRECISION_100M = 4;
export const MGRS_PRECISION_10M = 5;
export const MGRS_PRECISION_1M = 6;
export const MGRS_PRECISION_10M = 5;
export const MGRS_PRECISION_1M = 6;
export const DELETE_CYCLE_TIME = 0.05;
export const DELETE_CYCLE_TIME = 0.05;
export const DELETE_SLOW_THRESHOLD = 50;
export const GROUPING_ZOOM_TRANSITION = 13;

View File

@ -971,13 +971,13 @@ function Olympus.setUnitsData(arg, time)
-- Get the object category in Olympus name
local objectCategory = Object.getCategory(unit)
if objectCategory == Object.Category.UNIT then
if unit:getCategory() == Unit.Category.AIRPLANE then
if unit:getDesc().category == Unit.Category.AIRPLANE then
table["category"] = "Aircraft"
elseif unit:getCategory() == Unit.Category.HELICOPTER then
elseif unit:getDesc().category == Unit.Category.HELICOPTER then
table["category"] = "Helicopter"
elseif unit:getCategory() == Unit.Category.GROUND_UNIT then
elseif unit:getDesc().category == Unit.Category.GROUND_UNIT then
table["category"] = "GroundUnit"
elseif unit:getCategory() == Unit.Category.SHIP then
elseif unit:getDesc().category == Unit.Category.SHIP then
table["category"] = "NavyUnit"
end
else
@ -1039,7 +1039,7 @@ function Olympus.setUnitsData(arg, time)
local name = unit:getName()
if Olympus.cloneDatabase[name] ~= nil then
Olympus.cloneDatabase[name]["ID"] = ID
Olympus.cloneDatabase[name]["category"] = unit:getCategory()
Olympus.cloneDatabase[name]["category"] = unit:getDesc().category
Olympus.cloneDatabase[name]["heading"] = table["heading"]
Olympus.cloneDatabase[name]["alt"] = alt
Olympus.cloneDatabase[name]["country"] = unit:getCountry()
@ -1097,11 +1097,11 @@ function Olympus.setWeaponsData(arg, time)
-- Get the object category in Olympus name
local objectCategory = Object.getCategory(weapon)
if objectCategory == Object.Category.WEAPON then
if weapon:getCategory() == Weapon.Category.MISSILE then
if weapon:getDesc().category == Weapon.Category.MISSILE then
table["category"] = "Missile"
elseif weapon:getCategory() == Weapon.Category.ROCKET then
elseif weapon:getDesc().category == Weapon.Category.ROCKET then
table["category"] = "Missile"
elseif weapon:getCategory() == Weapon.Category.BOMB then
elseif weapon:getDesc().category == Weapon.Category.BOMB then
table["category"] = "Bomb"
end
else