mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 20:43:52 -06:00
feat: ROUND_ENDED implemented & disabled next layer seeding mode
This commit is contained in:
parent
47b647cfec
commit
3ddc60cbf0
11
mapvote.js
11
mapvote.js
@ -202,6 +202,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
this.server.on('NEW_GAME', this.onNewGame);
|
this.server.on('NEW_GAME', this.onNewGame);
|
||||||
this.server.on('CHAT_MESSAGE', this.onChatMessage);
|
this.server.on('CHAT_MESSAGE', this.onChatMessage);
|
||||||
this.server.on('PLAYER_DISCONNECTED', this.onPlayerDisconnected);
|
this.server.on('PLAYER_DISCONNECTED', this.onPlayerDisconnected);
|
||||||
|
this.server.on('ROUND_ENDED', this.endVotingGently)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.verbose(1, 'Enabled late listeners.');
|
this.verbose(1, 'Enabled late listeners.');
|
||||||
this.server.on('PLAYER_CONNECTED', this.setSeedingMode);
|
this.server.on('PLAYER_CONNECTED', this.setSeedingMode);
|
||||||
@ -298,7 +299,7 @@ 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.server.nextLayer) {
|
||||||
const nextMaps = seedingMaps.filter((l) => (!this.server.currentLayer || l.layerid != this.server.currentLayer.layerid))
|
const nextMaps = seedingMaps.filter((l) => (!this.server.currentLayer || l.layerid != this.server.currentLayer.layerid))
|
||||||
let rndMap2;
|
let rndMap2;
|
||||||
do rndMap2 = randomElement(nextMaps);
|
do rndMap2 = randomElement(nextMaps);
|
||||||
@ -308,7 +309,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
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");
|
||||||
@ -416,7 +417,7 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
case "stopesqjs":
|
case "stopesqjs":
|
||||||
case "restartsqjs":
|
case "restartsqjs":
|
||||||
if (!isAdmin) return;
|
if (!isAdmin) return;
|
||||||
this.warn(steamID, "Saving persistent data.\nTerminating SquadJS process.\nIf managed by a process manager it will automatically restart.")
|
await this.warn(steamID, "Saving persistent data.\nTerminating SquadJS process.\nIf managed by a process manager it will automatically restart.")
|
||||||
this.savePersistentData();
|
this.savePersistentData();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
return;
|
return;
|
||||||
@ -642,9 +643,9 @@ export default class MapVote extends DiscordBasePlugin {
|
|||||||
this.broadcastIntervalTask = setInterval(this.broadcastNominations, toMils(this.options.voteBroadcastInterval));
|
this.broadcastIntervalTask = setInterval(this.broadcastNominations, toMils(this.options.voteBroadcastInterval));
|
||||||
}
|
}
|
||||||
|
|
||||||
endVotingGently() {
|
async endVotingGently() {
|
||||||
this.endVoting();
|
this.endVoting();
|
||||||
this.broadcast(this.options.voteWinnerBroadcastMessage + this.formatFancyLayer(Layers.layers.find((l) => l.layerid == this.updateNextMap())));
|
await this.broadcast(this.options.voteWinnerBroadcastMessage + this.formatFancyLayer(Layers.layers.find((l) => l.layerid == this.updateNextMap())));
|
||||||
}
|
}
|
||||||
|
|
||||||
endVoting() {
|
endVoting() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user