Skip to content

Commit

Permalink
Merge pull request #228 from ect0s/JSON-FIX
Browse files Browse the repository at this point in the history
Attempt Fix vehicle filtering for maps with 0 tanks or helicopters
  • Loading branch information
Thomas-Smyth authored Feb 13, 2022
2 parents 170175f + 5964b37 commit 813aca1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions squad-server/layers/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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
});
Expand Down

0 comments on commit 813aca1

Please sign in to comment.