Merge pull request 'MAPG-226 change remaining time calculation' (#21) from feature/MAPG-226-change-timeout-algorithm into develop
All checks were successful
default-pipeline default-pipeline #106
All checks were successful
default-pipeline default-pipeline #106
Reviewed-on: https://gitea.e5tv.hu/esoko/mapguesser/pulls/21
This commit is contained in:
commit
1a40e3a18d
@ -5,7 +5,7 @@ process.title = 'mapguesser-multi';
|
|||||||
class MultiGame {
|
class MultiGame {
|
||||||
static ROUND_TIMEOUT_DEFAULT = 120000;
|
static ROUND_TIMEOUT_DEFAULT = 120000;
|
||||||
static ROUND_TIMEOUT_MINIMUM = 15000;
|
static ROUND_TIMEOUT_MINIMUM = 15000;
|
||||||
static ROUND_TIMEOUT_DIVIDER = 2;
|
static ROUND_TIMEOUT_DIVIDER = 1.5;
|
||||||
static ROUND_TIMEOUT_OFFSET = 500;
|
static ROUND_TIMEOUT_OFFSET = 500;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -155,7 +155,7 @@ class MultiGame {
|
|||||||
} else {
|
} else {
|
||||||
round.timeout = round.timeout - (new Date() - round.timeoutStarted);
|
round.timeout = round.timeout - (new Date() - round.timeoutStarted);
|
||||||
if (round.timeout > MultiGame.ROUND_TIMEOUT_DIVIDER * MultiGame.ROUND_TIMEOUT_MINIMUM) {
|
if (round.timeout > MultiGame.ROUND_TIMEOUT_DIVIDER * MultiGame.ROUND_TIMEOUT_MINIMUM) {
|
||||||
round.timeout = round.timeout / MultiGame.ROUND_TIMEOUT_DIVIDER;
|
round.timeout = Math.round(round.timeout / MultiGame.ROUND_TIMEOUT_DIVIDER);
|
||||||
} else if (round.timeout > MultiGame.ROUND_TIMEOUT_MINIMUM) {
|
} else if (round.timeout > MultiGame.ROUND_TIMEOUT_MINIMUM) {
|
||||||
round.timeout = MultiGame.ROUND_TIMEOUT_MINIMUM;
|
round.timeout = MultiGame.ROUND_TIMEOUT_MINIMUM;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user