mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Tweaks and implemented workaround to MIST bug
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { LatLng } from "leaflet";
|
||||
import { getUnitsManager } from "..";
|
||||
|
||||
export class UnitDatabase {
|
||||
blueprints: { [key: string]: UnitBlueprint } = {};
|
||||
|
||||
@@ -5,6 +8,10 @@ export class UnitDatabase {
|
||||
|
||||
}
|
||||
|
||||
getCategory() {
|
||||
return "";
|
||||
}
|
||||
|
||||
getBlueprints() {
|
||||
return this.blueprints;
|
||||
}
|
||||
@@ -143,4 +150,16 @@ export class UnitDatabase {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
generateTestGrid(initialPosition: LatLng) {
|
||||
const step = 0.01;
|
||||
var nUnits = Object.values(this.blueprints).length;
|
||||
var gridSize = Math.ceil(Math.sqrt(nUnits));
|
||||
Object.values(this.blueprints).forEach((unitBlueprint: UnitBlueprint, idx: number) => {
|
||||
var row = Math.floor(idx / gridSize);
|
||||
var col = idx - row * gridSize;
|
||||
var location = new LatLng(initialPosition.lat + col * step, initialPosition.lng + row * step)
|
||||
getUnitsManager().spawnUnit(this.getCategory(), [{unitType: unitBlueprint.name, location: location, altitude: 1000, loadout: ""}]);
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user