forked from noxious/server
npm run frmat
This commit is contained in:
@ -27,16 +27,14 @@ class ZoneManager {
|
||||
}
|
||||
|
||||
public async getZoneAssets(zone: Zone): Promise<ZoneAssets> {
|
||||
const tiles: string[] = this.getUnique(
|
||||
(JSON.parse(JSON.stringify(zone.tiles)) as string[][]).reduce((acc, val) => [...acc, ...val])
|
||||
);
|
||||
const objects = await zoneRepository.getObjects(zone.id);
|
||||
const mappedObjects = this.getUnique(objects.map(x => x.objectId));
|
||||
const tiles: string[] = this.getUnique((JSON.parse(JSON.stringify(zone.tiles)) as string[][]).reduce((acc, val) => [...acc, ...val]))
|
||||
const objects = await zoneRepository.getObjects(zone.id)
|
||||
const mappedObjects = this.getUnique(objects.map((x) => x.objectId))
|
||||
|
||||
return {
|
||||
tiles: tiles,
|
||||
objects: mappedObjects,
|
||||
} as ZoneAssets;
|
||||
objects: mappedObjects
|
||||
} as ZoneAssets
|
||||
}
|
||||
|
||||
private getUnique<T>(array: T[]) {
|
||||
@ -47,7 +45,7 @@ class ZoneManager {
|
||||
public async loadZone(zone: Zone) {
|
||||
const loadedZone = new LoadedZone(zone)
|
||||
this.loadedZones.push(loadedZone)
|
||||
await this.getZoneAssets(zone);
|
||||
await this.getZoneAssets(zone)
|
||||
logger.info(`Zone ID ${zone.id} loaded`)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user