From a6c503c624be240310ef4e214eead7a7a9dc9f13 Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 8 Mar 2023 17:26:36 -0500 Subject: [PATCH] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 8fbbe49..1529829 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -191,20 +191,28 @@ export default class DBLogPlayerTime extends DBLog { async onUpdatedA2SInformation(info) { await super.onUpdatedA2SInformation(info); - const curDateTime = new Date(); - if ((this.seeding !== ServerState.live) && (info.a2sPlayerCount >= this.options.seedingThreshold)) { - console.log('switching to Live'); - await this.updateCurrentTimeState(curDateTime, this.seeding, ServerState.live); - } else if (this.seeding === false && (info.a2sPlayerCount - 20) < this.options.seedingThreshold) { - console.log('switching to seeding'); - await this.updateCurrentTimeState(curDateTime, this.seeding, ServerState.seeding); - } +// const curDateTime = new Date(); +// if ((this.seeding !== ServerState.live) && (info.a2sPlayerCount >= this.options.seedingThreshold)) { +// console.log('switching to Live'); +// await this.updateCurrentTimeState(curDateTime, this.seeding, ServerState.live); +// } else if (this.seeding === false && (info.a2sPlayerCount - 20) < this.options.seedingThreshold) { +// console.log('switching to seeding'); +// await this.updateCurrentTimeState(curDateTime, this.seeding, ServerState.seeding); +// } } async onNewGame(info){ await super.onNewGame(info); console.log(info); + const curDateTime = info.time; + if(info.layer.gamemode === 'Seed'){ + console.log('switching to seeding'); + await this.updateCurrentTimeState(curDateTime, this.seeding, ServerState.seeding); + } else { + console.log('switching to Live'); + await this.updateCurrentTimeState(curDateTime, this.seeding, ServerState.live); + } } async onPlayerConnected(info) {