mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 23:03:51 -06:00
untested layer filtering for recent played maps
This commit is contained in:
parent
c3b4193a2a
commit
8fb5681144
13
mapvote.js
13
mapvote.js
@ -58,6 +58,11 @@ export default class MapVote extends BasePlugin {
|
|||||||
required: false,
|
required: false,
|
||||||
description: 'set a seeding layer if server has less than 20 players',
|
description: 'set a seeding layer if server has less than 20 players',
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
numberRecentMapsToExlude:{
|
||||||
|
required: false,
|
||||||
|
description: 'random layer list will not include the n. recent maps',
|
||||||
|
default: 4
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -270,7 +275,7 @@ export default class MapVote extends BasePlugin {
|
|||||||
let rnd_layers = [];
|
let rnd_layers = [];
|
||||||
// let rnd_layers = [];
|
// let rnd_layers = [];
|
||||||
if (!cmdLayers || cmdLayers.length == 0) {
|
if (!cmdLayers || cmdLayers.length == 0) {
|
||||||
const all_layers = Layers.layers.filter((l) => [ 'RAAS', 'AAS', 'INVASION' ].includes(l.gamemode.toUpperCase()));
|
const all_layers = Layers.layers.filter((l) => [ 'RAAS', 'AAS', 'INVASION' ].includes(l.gamemode.toUpperCase()) && ![this.server.currentLayer.classname,...objArrToValArr(this.server.layerHistory.splice(0,this.options.numberRecentMapsToExlude),"classname")].includes(l.classname));
|
||||||
for (let i = 0; i < 6; i++) {
|
for (let i = 0; i < 6; i++) {
|
||||||
// rnd_layers.push(all_layers[Math.floor(Math.random()*all_layers.length)]);
|
// rnd_layers.push(all_layers[Math.floor(Math.random()*all_layers.length)]);
|
||||||
let l;
|
let l;
|
||||||
@ -347,7 +352,11 @@ export default class MapVote extends BasePlugin {
|
|||||||
clearInterval(this.broadcastIntervalTask);
|
clearInterval(this.broadcastIntervalTask);
|
||||||
this.broadcastIntervalTask = null;
|
this.broadcastIntervalTask = null;
|
||||||
}
|
}
|
||||||
|
objArrToValArr(arr,key){
|
||||||
|
let vet = [];
|
||||||
|
for(let o of arr) if(arr[key]) vet.push(arr[key]);
|
||||||
|
return vet;
|
||||||
|
}
|
||||||
//sends a message about nominations through a broadcast
|
//sends a message about nominations through a broadcast
|
||||||
//NOTE: max squad broadcast message length appears to be 485 characters
|
//NOTE: max squad broadcast message length appears to be 485 characters
|
||||||
//Note: broadcast strings with multi lines are very strange
|
//Note: broadcast strings with multi lines are very strange
|
||||||
|
Loading…
x
Reference in New Issue
Block a user