seeding mode delay

This commit is contained in:
Davide Fantino 2022-09-20 22:09:14 +02:00
parent 8c66119aa5
commit b2bfd3a167

View File

@ -142,7 +142,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('PLAYER_CONNECTED', this.setSeedingMode); this.server.on('PLAYER_CONNECTED', () => { setTimeout(this.setSeedingMode, 5000) });
this.verbose(1, 'Map vote was mounted.'); this.verbose(1, 'Map vote was mounted.');
this.verbose(1, "Blacklisted Layers/Levels: " + this.options.layerLevelBlacklist.join(', ')) this.verbose(1, "Blacklisted Layers/Levels: " + this.options.layerLevelBlacklist.join(', '))
// await this.checkUpdates(); // await this.checkUpdates();
@ -192,11 +192,12 @@ export default class MapVote extends DiscordBasePlugin {
} }
} }
this.verbose(1, logTimeframe + activeTfIds.join(', ')); this.verbose(1, logTimeframe + activeTfIds.join(', '));
const _verbose = this.verbose;
function tfFilter(tf, key, arr) { function tfFilter(tf, key, arr) {
const utcDelay = tf.timezone ? parseFloat(tf.timezone) : 0; const utcDelay = tf.timezone ? parseFloat(tf.timezone) : 0;
const timeNow = new Date(0, 0, 0, new Date().getUTCHours() + utcDelay, new Date().getUTCMinutes()); const timeNow = new Date(0, 0, 0, new Date().getUTCHours() + utcDelay, new Date().getUTCMinutes());
this.verbose(1, `Current time (UTC+${utcDelay}) ${timeNow.getHours()}:${timeNow.getMinutes()}`) _verbose(1, `Current time (UTC+${utcDelay}) ${timeNow.getHours()}:${timeNow.getMinutes()}`)
const tfStartSplit = [ parseInt(tf.start.split(':')[ 0 ]), parseInt(tf.start.split(':')[ 1 ]) ]; const tfStartSplit = [ parseInt(tf.start.split(':')[ 0 ]), parseInt(tf.start.split(':')[ 1 ]) ];
const tfEndSplit = [ parseInt(tf.end.split(':')[ 0 ]), parseInt(tf.end.split(':')[ 1 ]) ]; const tfEndSplit = [ parseInt(tf.end.split(':')[ 0 ]), parseInt(tf.end.split(':')[ 1 ]) ];