Skip to content

Commit

Permalink
Merge pull request #73 from Thomas-Smyth/beta
Browse files Browse the repository at this point in the history
SquadJS v1.4.2 Release
  • Loading branch information
Thomas-Smyth authored Sep 20, 2020
2 parents f47f0f8 + bff3fc0 commit 9274a7d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ Grafana:
<pre><code>600000</code></pre>
<h4>minimumVotes</h4>
<h6>Description</h6>
<p>The minimum required amount of votes for the vote to go through</p>
<p>The minimum percentage of people required to vote for the vote to go through.</p>
<h6>Default</h6>
<pre><code>20</code></pre>
<h4>reminderInterval</h4>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SquadJS",
"version": "1.4.1",
"version": "1.4.2",
"repository": "https://github.com/Thomas-Smyth/SquadJS.git",
"author": "Thomas Smyth <https://github.com/Thomas-Smyth>",
"license": "BSL-1.0",
Expand Down
11 changes: 5 additions & 6 deletions plugins/skipmap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default {

minimumVotes: {
required: false,
description: 'The minimum required amount of votes for the vote to go through',
description: 'The minimum percentage of people required to vote for the vote to go through.',
default: 20
},

Expand Down Expand Up @@ -115,6 +115,7 @@ export default {
voteNeg = 0;
playerVotes = {};
playerVotes[info.steamID] = '+';
timeLastVote = new Date(); // As a vote happened, stop any further votes from happening until enough time has passed

// Set reminders
intervalReminderBroadcasts = setInterval(async () => {
Expand All @@ -132,7 +133,7 @@ export default {
voteActive = false;
clearInterval(intervalReminderBroadcasts);
// Check if enough people voted
if (voteNeg + votePos < options.minVoteCount) {
if (voteNeg + votePos < options.minimumVotes) {
server.rcon.broadcast('Not enough people voted for the vote to go through.');
return;
}
Expand All @@ -146,8 +147,6 @@ export default {
`Not enough people voted in favour of skipping the match. ${votePos} voted in favour, ${voteNeg} against.`
);
}
// As a vote happened, stop any further votes from happening until enough time has passed
timeLastVote = new Date();
}, options.voteDuration);
});

Expand Down Expand Up @@ -183,8 +182,8 @@ export default {

playerVotes[info.steamID] = info.message;

// If 50 people voted in favour, instantly win the vote
if (votePos >= 50) {
// If 50% of people voted in favour, instantly win the vote
if (votePos > server.players.length / 2) {
await server.rcon.broadcast(
`The vote to skip the current map has passed. ${votePos} voted in favour, ${voteNeg} against.`
);
Expand Down

0 comments on commit 9274a7d

Please sign in to comment.