More work on follow and tanking (added combo tasks)

This commit is contained in:
Pax1601
2023-04-16 20:24:33 +02:00
parent 39698c66a3
commit 77d39c17b8
11 changed files with 158 additions and 114 deletions

View File

@@ -28,6 +28,7 @@ var mouseInfoPanel: MouseInfoPanel;
var logPanel: LogPanel;
var connected: boolean = false;
var paused: boolean = false;
var activeCoalition: string = "blue";
var sessionHash: string | null = null;
@@ -106,8 +107,10 @@ function startPeriodicUpdate() {
function requestUpdate() {
/* Main update rate = 250ms is minimum time, equal to server update time. */
getUnits((data: UnitsData) => {
getUnitsManager()?.update(data);
checkSessionHash(data.sessionHash);
if (!getPaused()){
getUnitsManager()?.update(data);
checkSessionHash(data.sessionHash);
}
}, false);
setTimeout(() => requestUpdate(), getConnected() ? 250 : 1000);
@@ -117,15 +120,17 @@ function requestUpdate() {
function requestRefresh() {
/* Main refresh rate = 5000ms. */
getUnits((data: UnitsData) => {
getUnitsManager()?.update(data);
getAirbases((data: AirbasesData) => getMissionData()?.update(data));
getBullseyes((data: BullseyesData) => getMissionData()?.update(data));
getMission((data: any) => {getMissionData()?.update(data)});
if (!getPaused()){
getUnitsManager()?.update(data);
getAirbases((data: AirbasesData) => getMissionData()?.update(data));
getBullseyes((data: BullseyesData) => getMissionData()?.update(data));
getMission((data: any) => {getMissionData()?.update(data)});
// Update the list of existing units
getUnitDataTable()?.update();
checkSessionHash(data.sessionHash);
// Update the list of existing units
getUnitDataTable()?.update();
checkSessionHash(data.sessionHash);
}
}, true);
setTimeout(() => requestRefresh(), 5000);
}
@@ -183,6 +188,9 @@ function setupEvents() {
case "Quote":
unitDataTable.toggle();
break
case "Space":
setPaused(!getPaused());
break;
}
});
@@ -268,4 +276,12 @@ export function getConnected() {
return connected;
}
export function setPaused(newPaused: boolean) {
paused = newPaused;
}
export function getPaused() {
return paused;
}
window.onload = setup;

View File

@@ -210,7 +210,6 @@ export class UnitControlPanel extends Panel {
if (getUnitsManager().getSelectedUnits().length == 1)
{
var asd = this.#advancedSettingsDialog;
this.#radioCallsignDropdown.setOptions(["Enfield", "Springfield", "Uzi", "Colt", "Dodge", "Ford", "Chevy", "Pontiac"]);
this.#radioCallsignDropdown.selectValue(unit.getTaskData().radioCallsign);
var tankerCheckbox = this.#advancedSettingsDialog.querySelector("#tanker-checkbox")?.querySelector("input")

View File

@@ -118,7 +118,11 @@ export function attackUnit(ID: number, targetID: number) {
}
export function followUnit(ID: number, targetID: number) {
var command = { "ID": ID, "targetID": targetID };
// X: front-rear, positive front
// Y: top-bottom, positive bottom
// Z: left-right, positive right
var command = { "ID": ID, "targetID": targetID, "offsetX": -50, "offsetY": -10, "offsetZ": 50};
var data = { "followUnit": command }
POST(data, () => { });
}

View File

@@ -708,6 +708,25 @@ export class AircraftDatabase extends UnitDatabase {
],
"filename": "kc-135.png"
},
"KC135MPRS": {
"name": "KC135MPRS",
"label": "KC-135 MPRS",
"shortLabel": "135M",
"loadouts": [
{
"fuel": 1,
"items": [
],
"roles": [
"Tanker"
],
"code": "",
"name": "Default Tanker"
}
],
"filename": "kc-135.png"
},
"MiG-23MLD": {
"name": "MiG-23MLD",
"label": "MiG-23MLD",

View File

@@ -515,6 +515,9 @@ export class Unit extends Marker {
points.push(new LatLng(destination.lat, destination.lng));
this.#pathPolyline.setLatLngs(points);
}
if (points.length == 1)
this.#clearPath();
}
}