only do void when less than 2k players

This commit is contained in:
HF 2022-10-08 19:44:16 +02:00
parent 930889865b
commit ab09cf3bc1

View File

@ -22,6 +22,9 @@ import socketEvents from '../socket/socketEvents';
import chatProvider from './ChatProvider'; import chatProvider from './ChatProvider';
import canvases from './canvases'; import canvases from './canvases';
// if there are more than USER_THRESHOLD users,
// void will not appear
const USER_THRESHOLD = 2000;
// steps in minutes for event stages // steps in minutes for event stages
// STEPS[5] is event duration, adjusted from 10 to 8 on 2022.04.26 // STEPS[5] is event duration, adjusted from 10 to 8 on 2022.04.26
const STEPS = [30, 10, 2, 1, 0, -8, -15, -40, -60]; const STEPS = [30, 10, 2, 1, 0, -8, -15, -40, -60];
@ -381,11 +384,12 @@ class RpgEvent {
} else { } else {
// 52min after last Event / 1h before next Event // 52min after last Event / 1h before next Event
// define and protect it // define and protect it
this.eventTimestamp = await RpgEvent.setNextEvent(); if (socketEvents.onlineCounter.total < USER_THRESHOLD) {
await this.calcEventCenter(); this.eventTimestamp = await RpgEvent.setNextEvent();
const [x, y, w, h] = this.eventArea; await this.calcEventCenter();
await protectCanvasArea(CANVAS_ID, x, y, w, h, true); const [x, y, w, h] = this.eventArea;
await protectCanvasArea(CANVAS_ID, x, y, w, h, true);
}
setTimeout(this.runEventLoop, 60000); setTimeout(this.runEventLoop, 60000);
} }
} }