Added all ship to the naval database and made a function to filter by ship type

This commit is contained in:
WoodyXP 2023-07-05 18:47:02 +02:00
parent fa9f1e05ea
commit 3b2757a022
2 changed files with 1242 additions and 9 deletions

File diff suppressed because it is too large Load Diff

View File

@ -37,12 +37,25 @@ export class UnitDatabase {
/* Gets a specific blueprint by range */
getByRange(range: string) {
var unitswithrange = [];
for (let unit in this.blueprints) {
if (this.blueprints[unit].range === range)
return this.blueprints[unit];
if (this.blueprints[unit].range === range) {
unitswithrange.push(this.blueprints[unit]);
}
}
return null;
}
return unitswithrange;
}
/* Gets a specific blueprint by type */
getByType(type: string) {
var units = [];
for (let unit in this.blueprints) {
if (this.blueprints[unit].type === type) {
units.push(this.blueprints[unit]);
}
}
return units;
}
/* Get all blueprints by role */
getByRole(role: string) {