mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-24 00:13:52 -06:00
Add minimum votes to accept result configuration
This commit is contained in:
parent
47b647cfec
commit
4eae81f5db
@ -150,6 +150,11 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
required: false,
|
required: false,
|
||||||
description: 'Array of timeframes to override options',
|
description: 'Array of timeframes to override options',
|
||||||
default: []
|
default: []
|
||||||
|
},
|
||||||
|
minimumVotesToAcceptResult: {
|
||||||
|
required: false,
|
||||||
|
description: "Minimum votes per map to accept result.",
|
||||||
|
default: 1
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -278,7 +283,6 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setSeedingMode(isNewGameEvent = false) {
|
setSeedingMode(isNewGameEvent = false) {
|
||||||
// setTimeout(()=>{this.msgDirect('76561198419229279',"MV\ntest\ntest")},1000)
|
|
||||||
// this.msgBroadcast("[MapVote] Seeding mode active")
|
// this.msgBroadcast("[MapVote] Seeding mode active")
|
||||||
const baseDataExist = this && this.options && this.server && this.server.players;
|
const baseDataExist = this && this.options && this.server && this.server.players;
|
||||||
if (baseDataExist) {
|
if (baseDataExist) {
|
||||||
@ -853,6 +857,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
let highestScore = -Infinity;
|
let highestScore = -Infinity;
|
||||||
for (let choice in this.tallies) {
|
for (let choice in this.tallies) {
|
||||||
const score = this.tallies[ choice ];
|
const score = this.tallies[ choice ];
|
||||||
|
if (score >= this.options.minimumVotesToAcceptResult) {
|
||||||
if (score < highestScore)
|
if (score < highestScore)
|
||||||
continue;
|
continue;
|
||||||
else if (score > highestScore) {
|
else if (score > highestScore) {
|
||||||
@ -863,6 +868,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
else // equal
|
else // equal
|
||||||
ties.push(choice);
|
ties.push(choice);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ties.map(i => this.nominations[ i ]);
|
return ties.map(i => this.nominations[ i ]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user