diff --git a/client/src/@types/unit.d.ts b/client/src/@types/unit.d.ts index 6a114825..d2f0d109 100644 --- a/client/src/@types/unit.d.ts +++ b/client/src/@types/unit.d.ts @@ -40,14 +40,12 @@ interface TaskData { targetAltitude: number; isTanker: boolean; isAWACS: boolean; - TACANOn: boolean; TACANChannel: number; TACANXY: string; TACANCallsign: string; radioFrequency: number; radioCallsign: number; radioCallsignNumber: number; - radioAMFM: string; } interface OptionsData { diff --git a/client/src/panels/unitcontrolpanel.ts b/client/src/panels/unitcontrolpanel.ts index 4fe1de17..38b964ab 100644 --- a/client/src/panels/unitcontrolpanel.ts +++ b/client/src/panels/unitcontrolpanel.ts @@ -271,9 +271,11 @@ export class UnitControlPanel extends Panel { { const isTanker = this.#advancedSettingsDialog.querySelector("#tanker-checkbox")?.querySelector("input")?.checked? true: false; const isAWACS = this.#advancedSettingsDialog.querySelector("#AWACS-checkbox")?.querySelector("input")?.checked? true: false; + const TACANChannel = Number(this.#advancedSettingsDialog.querySelector("#TACAN-channel")?.querySelector("input")?.value); const TACANXY = this.#TACANXYDropdown.getValue(); const TACANCallsign = this.#advancedSettingsDialog.querySelector("#tacan-callsign")?.querySelector("input")?.value + const radioMHz = Number(this.#advancedSettingsDialog.querySelector("#radio-mhz")?.querySelector("input")?.value); const radioDecimals = this.#radioDecimalsDropdown.getValue(); const radioCallsign = this.#radioCallsignDropdown.getIndex() + 1; diff --git a/client/src/server/server.ts b/client/src/server/server.ts index 80e10563..92c5b2d2 100644 --- a/client/src/server/server.ts +++ b/client/src/server/server.ts @@ -52,10 +52,6 @@ export function GET(callback: CallableFunction, uri: string, options?: string) { setConnected(false); } }; - xmlHttp.onreadystatechange = function (res) { - console.error("An error occurred during the XMLHttpRequest"); - setConnected(false); - }; xmlHttp.onerror = function (res) { console.error("An error occurred during the XMLHttpRequest"); setConnected(false); diff --git a/client/src/units/unit.ts b/client/src/units/unit.ts index 74971df6..64463133 100644 --- a/client/src/units/unit.ts +++ b/client/src/units/unit.ts @@ -50,14 +50,12 @@ export class Unit extends Marker { targetAltitude: 0, isTanker: false, isAWACS: false, - TACANOn: false, TACANChannel: 0, TACANXY: "X", TACANCallsign: "", radioFrequency: 0, radioCallsign: 0, - radioCallsignNumber: 0, - radioAMFM: "AM" + radioCallsignNumber: 0 }, optionsData: { ROE: "", @@ -536,7 +534,41 @@ export class Unit extends Marker { let currentStyle = el.getAttribute( "style" ) || ""; el.setAttribute( "style", currentStyle + `transform:rotate(${headingDeg}deg);` ); }); + + /* Turn on ordnance indicators */ + + var hasFox1 = element.querySelector(".unit")?.hasAttribute("data-has-fox-1"); + var hasFox2 = element.querySelector(".unit")?.hasAttribute("data-has-fox-2"); + var hasFox3 = element.querySelector(".unit")?.hasAttribute("data-has-fox-3"); + var hasOtherAmmo = element.querySelector(".unit")?.hasAttribute("data-has-other-ammo"); + + var newHasFox1 = false; + var newHasFox2 = false; + var newHasFox3 = false; + var newHasOtherAmmo = false; + Object.values(this.getMissionData().ammo).forEach((ammo: any) => { + if (ammo.desc.category == 1 && ammo.desc.missileCategory == 1) { + if (ammo.desc.guidance == 4 || ammo.desc.guidance == 5) { + newHasFox1 = true; + } + else if (ammo.desc.guidance == 2) { + newHasFox2 = true; + } + else if (ammo.desc.guidance == 3) { + newHasFox3 = true; + } + } + else { + newHasOtherAmmo = true; + } + }); + + if (hasFox1 != newHasFox1) element.querySelector(".unit")?.toggleAttribute("data-has-fox-1", newHasFox1); + if (hasFox2 != newHasFox2) element.querySelector(".unit")?.toggleAttribute("data-has-fox-2", newHasFox2); + if (hasFox3 != newHasFox3) element.querySelector(".unit")?.toggleAttribute("data-has-fox-3", newHasFox3); + if (hasOtherAmmo != newHasOtherAmmo) element.querySelector(".unit")?.toggleAttribute("data-has-other-ammo", newHasOtherAmmo); } + /* Set vertical offset for altitude stacking */ var pos = getMap().latLngToLayerPoint(this.getLatLng()).round(); this.setZIndexOffset(1000 + Math.floor(this.getFlightData().altitude) - pos.y + (this.#hovered || this.#selected? 5000: 0)); diff --git a/src/core/src/unit.cpp b/src/core/src/unit.cpp index 5e9dd25d..43f9c316 100644 --- a/src/core/src/unit.cpp +++ b/src/core/src/unit.cpp @@ -28,6 +28,9 @@ Unit::Unit(json::value json, int ID) : addMeasure(L"radioFrequency", json::value(radioFrequency)); addMeasure(L"radioCallsign", json::value(radioCallsign)); addMeasure(L"radioCallsignNumber", json::value(radioCallsignNumber)); + + setROE(L"Designated"); + setReactionToThreat(L"Evade"); } Unit::~Unit()