mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 23:03:51 -06:00
fix: seeding mode next layer
This commit is contained in:
parent
b630a727a6
commit
5ef6ba3dbb
28
mapvote.js
28
mapvote.js
@ -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.");
|
} 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) {
|
||||||
const nextMaps = seedingMaps.filter((l) => (!this.server.currentLayer || l.layerid != this.server.currentLayer.layerid))
|
if (this.server.nextLayer) {
|
||||||
let rndMap2;
|
const nextMaps = seedingMaps.filter((l) => (!this.server.currentLayer || l.layerid != this.server.currentLayer.layerid))
|
||||||
do rndMap2 = randomElement(nextMaps);
|
let rndMap2;
|
||||||
while (rndMap2.layerid == rndMap.layerid)
|
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;
|
const newNextMap = rndMap2.layerid;
|
||||||
this.server.rcon.execute(`AdminSetNextLayer ${newNextMap} `);
|
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, `Player count doesn't allow seeding mode (${this.server.players.length}/20)`);
|
||||||
} else this.verbose(1, "Seeding mode disabled in config");
|
} 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.nominations[ 0 ] = "Reroll vote list with random options"
|
||||||
this.tallies[ 0 ] = 0;
|
this.tallies[ 0 ] = 0;
|
||||||
this.factionStrings[ 0 ] = "";
|
this.factionStrings[ 0 ] = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.nominations[ 1 ] != "")
|
||||||
|
this.server.rcon.execute(`AdminSetNextLayer ${this.nominations[ 1 ]} `);
|
||||||
|
|
||||||
function getTranslation(layer) {
|
function getTranslation(layer) {
|
||||||
if (translations[ layer.faction ]) return translations[ layer.faction ]
|
if (translations[ layer.faction ]) return translations[ layer.faction ]
|
||||||
else if (layer.faction) {
|
else if (layer.faction) {
|
||||||
@ -998,7 +1002,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
|
|
||||||
this.verbose(1, 'Layer list updated');
|
this.verbose(1, 'Layer list updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
formatChoice(choiceIndex, mapString, currentVotes, hideVoteCount) {
|
formatChoice(choiceIndex, mapString, currentVotes, hideVoteCount) {
|
||||||
return `${choiceIndex}➤ ${mapString} ` + (!hideVoteCount ? `(${currentVotes})` : "");
|
return `${choiceIndex}➤ ${mapString} ` + (!hideVoteCount ? `(${currentVotes})` : "");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user