This commit is contained in:
Davide Fantino 2023-02-25 11:45:11 +01:00
commit 106ae758b2
2 changed files with 26 additions and 10 deletions

View File

@ -246,6 +246,15 @@ Array of timeframes that allows to override options based on local time. See exa
}
}
```
#### minimumVotesToAcceptResult
###### Description
Minimum votes per map to accept result.
Can be used to prevent situation when insignificant number of players decide what map should be next, but most still wants to play map according to rotation.
###### Default
```json
1
```
### Example configuration
```json
{
@ -272,12 +281,13 @@ Array of timeframes that allows to override options based on local time. See exa
"voteBroadcastMessage": "✯ MAPVOTE ✯\nVote for the next map by writing in chat the corresponding number!",
"voteWinnerBroadcastMessage": "✯ MAPVOTE ✯\nThe winning layer is\n\n",
"showWinnerBroadcastMessage": true,
"includeMainAssetsInBroadcast" true,
"includeMainAssetsInBroadcast": true,
"allowedSameMapEntries": 1,
"logToDiscord": true,
"channelID": "112233445566778899",
"persistentDataFile": "",
"timezone": 2,
"minimumVotesToAcceptResult": 1,
"timeFrames": [
{
"name": "follow layer rotation list",

View File

@ -170,6 +170,11 @@ export default class MapVote extends DiscordBasePlugin {
required: false,
description: 'Array of timeframes to override options',
default: []
},
minimumVotesToAcceptResult: {
required: false,
description: "Minimum votes per map to accept result.",
default: 1
}
};
}
@ -301,7 +306,6 @@ export default class MapVote extends DiscordBasePlugin {
}
}
setSeedingMode(isNewGameEvent = false) {
// setTimeout(()=>{this.msgDirect('76561198419229279',"MV\ntest\ntest")},1000)
// this.msgBroadcast("[MapVote] Seeding mode active")
const baseDataExist = this && this.options && this.server && this.server.players;
if (baseDataExist) {
@ -974,6 +978,7 @@ export default class MapVote extends DiscordBasePlugin {
let highestScore = -Infinity;
for (let choice in this.tallies) {
const score = this.tallies[ choice ];
if (score >= this.options.minimumVotesToAcceptResult) {
if (score < highestScore)
continue;
else if (score > highestScore) {
@ -984,6 +989,7 @@ export default class MapVote extends DiscordBasePlugin {
else // equal
ties.push(choice);
}
}
return ties.map(i => this.nominations[ i ]);
}