mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Updated databases
This commit is contained in:
@@ -117,25 +117,32 @@ export class UnitDatabase {
|
||||
return eras;
|
||||
}
|
||||
|
||||
/* Returns a list of all possible ranges in a database */
|
||||
getRanges() {
|
||||
var filteredBlueprints = this.getBlueprints();
|
||||
var ranges: string[] = [];
|
||||
for (let unit in filteredBlueprints) {
|
||||
var range = filteredBlueprints[unit].rangeType;
|
||||
if (range && range !== "" && !ranges.includes(range))
|
||||
ranges.push(range);
|
||||
}
|
||||
return ranges;
|
||||
}
|
||||
|
||||
/* Get all blueprints by range */
|
||||
getByRange(range: string) {
|
||||
var filteredBlueprints = this.getBlueprints();
|
||||
var unitswithrange = [];
|
||||
var minRange = 0;
|
||||
var maxRange = 0;
|
||||
|
||||
if (range === "Short range") {
|
||||
minRange = 0;
|
||||
maxRange = 10000;
|
||||
}
|
||||
else if (range === "Medium range") {
|
||||
minRange = 10000;
|
||||
maxRange = 100000;
|
||||
}
|
||||
else {
|
||||
minRange = 100000;
|
||||
maxRange = 999999;
|
||||
}
|
||||
|
||||
for (let unit in filteredBlueprints) {
|
||||
if (filteredBlueprints[unit].rangeType === range) {
|
||||
unitswithrange.push(filteredBlueprints[unit]);
|
||||
var engagementRange = filteredBlueprints[unit].engagementRange;
|
||||
if (engagementRange !== undefined) {
|
||||
if (engagementRange >= minRange && engagementRange < maxRange) {
|
||||
unitswithrange.push(filteredBlueprints[unit]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return unitswithrange;
|
||||
|
||||
@@ -616,6 +616,14 @@ export class Unit extends CustomMarker {
|
||||
return getApp().getMap().getBounds().contains(this.getPosition());
|
||||
}
|
||||
|
||||
canTargetPoint() {
|
||||
return this.getDatabase()?.getByName(this.#name)?.canTargetPoint === true;
|
||||
}
|
||||
|
||||
canRearm() {
|
||||
return this.getDatabase()?.getByName(this.#name)?.canRearm === true;
|
||||
}
|
||||
|
||||
/********************** Unit commands *************************/
|
||||
addDestination(latlng: L.LatLng) {
|
||||
if (!this.#human) {
|
||||
|
||||
Reference in New Issue
Block a user