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
18
mapvote.js
18
mapvote.js
@ -138,16 +138,22 @@ export default class MapVote extends BasePlugin {
|
|||||||
setSeedingMode() {
|
setSeedingMode() {
|
||||||
// setTimeout(()=>{this.msgDirect('76561198419229279',"MV\ntest\ntest")},1000)
|
// setTimeout(()=>{this.msgDirect('76561198419229279',"MV\ntest\ntest")},1000)
|
||||||
// this.msgBroadcast("[MapVote] Seeding mode active")
|
// this.msgBroadcast("[MapVote] Seeding mode active")
|
||||||
|
let tries = 0;
|
||||||
|
let error = false;
|
||||||
const baseDataExist = this && this.options && this.server;
|
const baseDataExist = this && this.options && this.server;
|
||||||
const currentNextLayerExist = this.server.currentLayer && this.server.nextLayer;
|
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))) {
|
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 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 rndMap = randomElement(seedingMaps);
|
||||||
const nextMap = randomElement(seedingMaps).layerid;
|
do {
|
||||||
if (this.server.players && this.server.players.length < 20) {
|
if (rndMap.layerid) {
|
||||||
this.verbose(1, 'Going into seeding mode.');
|
const nextMap = rndMap.layerid;
|
||||||
this.server.rcon.execute(`AdminSetNextLayer ${nextMap}`);
|
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