mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added basic template spawning
This commit is contained in:
@@ -322,7 +322,7 @@ export class AircraftDatabase extends UnitDatabase {
|
||||
},
|
||||
"H-6J": {
|
||||
"name": "H-6J",
|
||||
"label": "H-6J Badger,
|
||||
"label": "H-6J Badger",
|
||||
"era": ["Mid Cold War, Late Cold War", "Modern"],
|
||||
"shortLabel": "H6",
|
||||
"loadouts": [
|
||||
|
||||
@@ -4,6 +4,24 @@ export class GroundUnitsDatabase extends UnitDatabase {
|
||||
constructor() {
|
||||
super();
|
||||
this.blueprints = {
|
||||
"SA-2 SAM Battery": {
|
||||
"name": "SA-2 SAM Battery",
|
||||
"label": "SA-2 SAM Battery",
|
||||
"shortLabel": "SA-2 SAM Battery",
|
||||
"loadouts": [
|
||||
{
|
||||
"fuel": 1,
|
||||
"items": [
|
||||
],
|
||||
"roles": [
|
||||
"Template"
|
||||
],
|
||||
"code": "",
|
||||
"name": "Default"
|
||||
}
|
||||
],
|
||||
"filename": ""
|
||||
},
|
||||
"2B11 mortar": {
|
||||
"name": "2B11 mortar",
|
||||
"label": "2B11 mortar",
|
||||
|
||||
@@ -646,27 +646,25 @@ export class Unit extends Marker {
|
||||
}
|
||||
|
||||
#drawTargets() {
|
||||
for (let typeIndex in this.getMissionData().targets) {
|
||||
for (let index in this.getMissionData().targets[typeIndex]) {
|
||||
var targetData = this.getMissionData().targets[typeIndex][index];
|
||||
var target = getUnitsManager().getUnitByID(targetData.object["id_"])
|
||||
if (target != null) {
|
||||
var startLatLng = new LatLng(this.getFlightData().latitude, this.getFlightData().longitude)
|
||||
var endLatLng = new LatLng(target.getFlightData().latitude, target.getFlightData().longitude)
|
||||
for (let index in this.getMissionData().targets) {
|
||||
var targetData = this.getMissionData().targets[index];
|
||||
var target = getUnitsManager().getUnitByID(targetData.object["id_"])
|
||||
if (target != null) {
|
||||
var startLatLng = new LatLng(this.getFlightData().latitude, this.getFlightData().longitude)
|
||||
var endLatLng = new LatLng(target.getFlightData().latitude, target.getFlightData().longitude)
|
||||
|
||||
var color;
|
||||
if (typeIndex === "radar")
|
||||
color = "#FFFF00";
|
||||
else if (typeIndex === "visual")
|
||||
color = "#FF00FF";
|
||||
else if (typeIndex === "rwr")
|
||||
color = "#00FF00";
|
||||
else
|
||||
color = "#FFFFFF";
|
||||
var targetPolyline = new Polyline([startLatLng, endLatLng], { color: color, weight: 3, opacity: 0.4, smoothFactor: 1 });
|
||||
targetPolyline.addTo(getMap());
|
||||
this.#targetsPolylines.push(targetPolyline)
|
||||
}
|
||||
var color;
|
||||
if (targetData.detectionMethod === "RADAR")
|
||||
color = "#FFFF00";
|
||||
else if (targetData.detectionMethod === "VISUAL")
|
||||
color = "#FF00FF";
|
||||
else if (targetData.detectionMethod === "RWR")
|
||||
color = "#00FF00";
|
||||
else
|
||||
color = "#FFFFFF";
|
||||
var targetPolyline = new Polyline([startLatLng, endLatLng], { color: color, weight: 3, opacity: 0.4, smoothFactor: 1 });
|
||||
targetPolyline.addTo(getMap());
|
||||
this.#targetsPolylines.push(targetPolyline)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ export class UnitsManager {
|
||||
}
|
||||
|
||||
update(data: UnitsData) {
|
||||
var updatedUnits: Unit[] = [];
|
||||
Object.keys(data.units)
|
||||
.filter((ID: string) => !(ID in this.#units))
|
||||
.reduce((timeout: number, ID: string) => {
|
||||
@@ -75,7 +76,15 @@ export class UnitsManager {
|
||||
|
||||
Object.keys(data.units)
|
||||
.filter((ID: string) => ID in this.#units)
|
||||
.forEach((ID: string) => this.#units[parseInt(ID)]?.setData(data.units[ID]));
|
||||
.forEach((ID: string) => {
|
||||
updatedUnits.push(this.#units[parseInt(ID)]);
|
||||
this.#units[parseInt(ID)]?.setData(data.units[ID])
|
||||
});
|
||||
|
||||
this.getSelectedUnits().forEach((unit: Unit) => {
|
||||
if (!updatedUnits.includes(unit))
|
||||
unit.setData({})
|
||||
});
|
||||
}
|
||||
|
||||
selectUnit(ID: number, deselectAllUnits: boolean = true) {
|
||||
|
||||
Reference in New Issue
Block a user