Эх сурвалжийг харах

Refs #1 update timeout val in fps unit

isundil 6 жил өмнө
parent
commit
41f422005a
2 өөрчлөгдсөн 2 нэмэгдсэн , 2 устгасан
  1. 1 1
      config.js
  2. 1 1
      rapido.js

+ 1 - 1
config.js

@@ -35,7 +35,7 @@ module.exports.MODULES["#quizz"] = new (require('./quizz.js'))({
 module.exports.MODULES["#rapido"] = new (require('./rapido.js'))({
     DISABLED: false,
     NEXT_WORD_DELAY: 10 * 1000, // 10 sec
-    WORD_TIMEOUT: 20 * 1000, // 20 sec
+    WORD_TIMEO_FPS: 0.5, // 2 seconds per key
     DICTIONARY_PATH: './db/fr.txt',
     MIN_PLAYERS: 1,
     SCORE_MAP: [

+ 1 - 1
rapido.js

@@ -115,7 +115,7 @@ Rapido.prototype.startNextWordTimer = function() {
         var wordEsc = _this.currentWord.replace(/(\w)/g, ' $1').toUpperCase().trimStart();
         _this.bot.sendMsg(_this.room, wordEsc);
         _this.wordStart = Date.now();
-        _this.wordTimeout = setTimeout(_this.onWordTimeout.bind(_this), _this.config.WORD_TIMEOUT);
+        _this.wordTimeout = setTimeout(_this.onWordTimeout.bind(_this), Math.floor(1000 * this.currentWord.length / this.config.WORD_TIMEO_FPS));
     }, this.config.NEXT_WORD_DELAY);
 }