mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 14:04:25 -05:00
Attempt Fix vehicle filtering for maps with 0 tanks or helicopters
2.12 Squad, some layers have no vehicles, so when reading JSON from the wiki team we reject a promise because no data[t].vehicles property, this sets to empty array before we attempt a filter. Should stop promise rejection during startup
This commit is contained in:
parent
f34426d61f
commit
5964b37769
@ -2,7 +2,7 @@ export default class Layer {
|
||||
constructor(data) {
|
||||
this.name = data.Name;
|
||||
this.classname = data.levelName;
|
||||
this.layerid = data.rawName
|
||||
this.layerid = data.rawName;
|
||||
this.map = {
|
||||
name: data.mapName
|
||||
};
|
||||
@ -30,10 +30,10 @@ export default class Layer {
|
||||
spawnDelay: vehicle.delay,
|
||||
respawnDelay: vehicle.respawnTime
|
||||
})),
|
||||
numberOfTanks: data[t].vehicles.filter((v) => {
|
||||
numberOfTanks: (data[t].vehicles || []).filter((v) => {
|
||||
return v.icon.match(/tank/);
|
||||
}).length,
|
||||
numberOfHelicopters: data[t].vehicles.filter((v) => {
|
||||
numberOfHelicopters: (data[t].vehicles || []).filter((v) => {
|
||||
return v.icon.match(/helo/);
|
||||
}).length
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user