feat: added airborne variable

This commit is contained in:
Pax1601
2025-03-31 08:14:17 +02:00
parent 825d60e754
commit 1248ffb60b
9 changed files with 26 additions and 4 deletions

View File

@@ -513,6 +513,7 @@ export enum DataIndexes {
targetingRange,
aimMethodRange,
acquisitionRange,
airborne,
endOfData = 255,
}

View File

@@ -283,6 +283,7 @@ export interface UnitData {
targetingRange: number;
aimMethodRange: number;
acquisitionRange: number;
airborne: boolean;
}
export interface LoadoutItemBlueprint {

View File

@@ -2269,11 +2269,13 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) {
</div>
<div className="my-auto text-sm text-gray-400">{selectedUnits[0].getTask()}</div>
{([UnitState.SIMULATE_FIRE_FIGHT, UnitState.MISS_ON_PURPOSE, UnitState.SCENIC_AAA] as string[]).includes(selectedUnits[0].getState()) && (
{/* Useful for debugging but very data hungry
([UnitState.SIMULATE_FIRE_FIGHT, UnitState.MISS_ON_PURPOSE, UnitState.SCENIC_AAA] as string[]).includes(selectedUnits[0].getState()) && (
<div className="my-auto text-sm text-gray-400">
Time to next tasking: {zeroAppend(selectedUnits[0].getTimeToNextTasking(), 0, true, 2)}s
</div>
)}
)*/}
<div className="flex content-center gap-2">
<OlLocation

View File

@@ -154,6 +154,7 @@ export abstract class Unit extends CustomMarker {
#racetrackLength: number = 0;
#racetrackAnchor: LatLng = new LatLng(0, 0);
#racetrackBearing: number = 0;
#airborne: boolean = false;
/* Other members used to draw the unit, mostly ancillary stuff like targets, ranges and so on */
#blueprint: UnitBlueprint | null = null;
@@ -391,6 +392,9 @@ export abstract class Unit extends CustomMarker {
getAcquisitionRange() {
return this.#acquisitionRange;
}
getAirborne() {
return this.#airborne;
}
static getConstructor(type: string) {
if (type === "GroundUnit") return GroundUnit;
@@ -754,6 +758,9 @@ export abstract class Unit extends CustomMarker {
case DataIndexes.acquisitionRange:
this.#acquisitionRange = dataExtractor.extractFloat64();
break;
case DataIndexes.airborne:
this.#airborne = dataExtractor.extractBool();
break;
default:
break;
}
@@ -874,6 +881,7 @@ export abstract class Unit extends CustomMarker {
targetingRange: this.#targetingRange,
aimMethodRange: this.#aimMethodRange,
acquisitionRange: this.#acquisitionRange,
airborne: this.#airborne
};
}