mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Ordnance markers are now painted correctly
This commit is contained in:
parent
d146a47e71
commit
7545e848d6
2
client/src/@types/unit.d.ts
vendored
2
client/src/@types/unit.d.ts
vendored
@ -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 {
|
||||
|
||||
@ -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 = <string> 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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user