mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 23:03:51 -06:00
fix: vote end broadcast
This commit is contained in:
parent
09d117d86e
commit
20a2649b4a
18
mapvote.js
18
mapvote.js
@ -703,13 +703,11 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
async endVotingGently(steamID = null) {
|
async endVotingGently(steamID = null) {
|
||||||
if (!this.votingEnabled) return;
|
if (!this.votingEnabled) return;
|
||||||
|
|
||||||
this.endVoting();
|
|
||||||
|
|
||||||
if (steamID) await this.warn(steamID, "Voting terminated!");
|
|
||||||
|
|
||||||
const winningLayerId = this.updateNextMap();
|
const winningLayerId = this.updateNextMap();
|
||||||
if (!winningLayerId) return;
|
if (!winningLayerId) {
|
||||||
|
this.verbose(1, 'No winning layer available', winningLayerId)
|
||||||
|
return;
|
||||||
|
}
|
||||||
const winnerLayer = Layers.layers.find((l) => l.layerid == winningLayerId);
|
const winnerLayer = Layers.layers.find((l) => l.layerid == winningLayerId);
|
||||||
const fancyWinner = this.formatFancyLayer(winnerLayer);
|
const fancyWinner = this.formatFancyLayer(winnerLayer);
|
||||||
|
|
||||||
@ -761,6 +759,9 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
timestamp: (new Date()).toISOString()
|
timestamp: (new Date()).toISOString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.endVoting();
|
||||||
|
if (steamID) await this.warn(steamID, "Voting terminated!");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1012,15 +1013,16 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
const score = this.tallies[ choice ];
|
const score = this.tallies[ choice ];
|
||||||
if (score >= this.options.minimumVotesToAcceptResult) {
|
if (score >= this.options.minimumVotesToAcceptResult) {
|
||||||
if (score < highestScore)
|
if (score < highestScore)
|
||||||
continue;
|
continue;
|
||||||
else if (score > highestScore) {
|
else if (score > highestScore) {
|
||||||
highestScore = score;
|
highestScore = score;
|
||||||
ties.length = 0;
|
ties.length = 0;
|
||||||
ties.push(choice);
|
ties.push(choice);
|
||||||
}
|
}
|
||||||
else // equal
|
else // equal
|
||||||
ties.push(choice);
|
ties.push(choice);
|
||||||
}
|
}
|
||||||
|
this.verbose(1, 'Ties', ties, ties.map(i => this.nominations[ i ]))
|
||||||
}
|
}
|
||||||
|
|
||||||
return ties.map(i => this.nominations[ i ]);
|
return ties.map(i => this.nominations[ i ]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user