mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 20:43:52 -06:00
quick fix
This commit is contained in:
parent
5b762b4796
commit
e1540c853c
10
mapvote.js
10
mapvote.js
@ -138,16 +138,22 @@ export default class MapVote extends BasePlugin {
|
||||
setSeedingMode() {
|
||||
// setTimeout(()=>{this.msgDirect('76561198419229279',"MV\ntest\ntest")},1000)
|
||||
// this.msgBroadcast("[MapVote] Seeding mode active")
|
||||
let tries = 0;
|
||||
let error = false;
|
||||
const baseDataExist = this && this.options && this.server;
|
||||
const currentNextLayerExist = this.server.currentLayer && this.server.nextLayer;
|
||||
if (baseDataExist && this.options.automaticSeedingMode && ((this.server.nextLayer && this.server.nextLayer.gamemode.toLowerCase() != "seed") || (currentNextLayerExist && this.server.currentLayer.layerid == this.server.nextLayer.layerid))) {
|
||||
const seedingMaps = Layers.layers.filter((l) => l.gamemode.toUpperCase() == "SEED" && (currentNextLayerExist && l.layerid != this.server.currentLayer.layerid && !this.options.layerLevelBlacklist.find((fl) => l.layerid.toLowerCase().startsWith(fl.toLowerCase()))))
|
||||
|
||||
const nextMap = randomElement(seedingMaps).layerid;
|
||||
const rndMap = randomElement(seedingMaps);
|
||||
do {
|
||||
if (rndMap.layerid) {
|
||||
const nextMap = rndMap.layerid;
|
||||
if (this.server.players && this.server.players.length < 20) {
|
||||
this.verbose(1, 'Going into seeding mode.');
|
||||
this.server.rcon.execute(`AdminSetNextLayer ${nextMap}`);
|
||||
}
|
||||
}else error = true;
|
||||
} while (error && ++tries<=5)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user