From ba3f0372dd1882f06700eb2cd8c8420a3b2942d7 Mon Sep 17 00:00:00 2001 From: cv <34649812+cpvalente@users.noreply.github.com> Date: Fri, 29 Oct 2021 13:03:47 +0200 Subject: [PATCH] refract: secondary timer small fixes on how the timer is calculated --- server/src/classes/EventTimer.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/server/src/classes/EventTimer.js b/server/src/classes/EventTimer.js index 020872e53..a93469ea0 100644 --- a/server/src/classes/EventTimer.js +++ b/server/src/classes/EventTimer.js @@ -242,10 +242,6 @@ export class EventTimer extends Timer { } else { // look for event if none is loaded if (this.current <= 0 || this.secondaryTimer <= 0) this.rollLoad(); - - // count to next event - // TODO: replace with proper counter - if (this.secondaryTimer != null) this.secondaryTimer -= 1000; } } @@ -946,8 +942,12 @@ export class EventTimer extends Timer { rollLoad() { const now = this._getCurrentTime(); - this._resetTimers(true); - this._resetSelection(); + + // maybe roll has already been loaded + if (this.secondaryTimer == null) { + this._resetTimers(true); + this._resetSelection(); + } let foundNow = null; let nextIndex = null; @@ -990,6 +990,7 @@ export class EventTimer extends Timer { // nothing to play next, unload if (foundNow == null && nextIndex == null) { this.unload(); + console.log('Roll: no events found'); return; } @@ -998,6 +999,8 @@ export class EventTimer extends Timer { this._loadThisTitles(nextIndex, 'next'); if (foundNow == null) { + if (this.secondaryTimer == null) + console.log('Roll: waiting for event start'); // timer counts to nextStart this.secondaryTimer = nextStart; }