fix: seeding mode next layer

This commit is contained in:
Davide Fantino 2023-02-25 11:45:06 +01:00
parent b630a727a6
commit 5ef6ba3dbb

View File

@ -321,17 +321,19 @@ export default class MapVote extends DiscordBasePlugin {
}
} else this.verbose(1, "Bad data (currentLayer). Seeding mode for current layer skipped to prevent errors.");
/*if (this.server.nextLayer) {
if (+this.layerHistory[ 0 ].time - +(new Date()) > 30 * 1000) {
if (this.server.nextLayer) {
const nextMaps = seedingMaps.filter((l) => (!this.server.currentLayer || l.layerid != this.server.currentLayer.layerid))
let rndMap2;
do rndMap2 = randomElement(nextMaps);
while (rndMap2.layerid == rndMap.layerid)
if (isNewGameEvent && this.server.players.length < 20 && this.server.nextLayer.gamemode.toLowerCase() != "seed") {
if (this.server.players.length < 20 && this.server.nextLayer.gamemode.toLowerCase() != "seed") {
const newNextMap = rndMap2.layerid;
this.server.rcon.execute(`AdminSetNextLayer ${newNextMap} `);
}
} else this.verbose(1, "Bad data (nextLayer). Seeding mode for next layer skipped to prevent errors.");*/
} else this.verbose(1, "Bad data (nextLayer). Seeding mode for next layer skipped to prevent errors.");
}
} else this.verbose(1, `Player count doesn't allow seeding mode (${this.server.players.length}/20)`);
} else this.verbose(1, "Seeding mode disabled in config");
@ -625,9 +627,11 @@ export default class MapVote extends DiscordBasePlugin {
this.nominations[ 0 ] = "Reroll vote list with random options"
this.tallies[ 0 ] = 0;
this.factionStrings[ 0 ] = "";
}
if (this.nominations[ 1 ] != "")
this.server.rcon.execute(`AdminSetNextLayer ${this.nominations[ 1 ]} `);
function getTranslation(layer) {
if (translations[ layer.faction ]) return translations[ layer.faction ]
else if (layer.faction) {