diff --git a/clusterctl.js b/clusterctl.js index 6f38905e..d02594db 100644 --- a/clusterctl.js +++ b/clusterctl.js @@ -370,7 +370,7 @@ class Control extends link.Link { try { await link.messages.prepareDisconnect.send(this); } catch (err) { - if (!(err instanceof SessionLost)) { + if (!(err instanceof errors.SessionLost)) { throw err; } } diff --git a/lib/link/connectors.js b/lib/link/connectors.js index 2b94c0e5..5a420323 100644 --- a/lib/link/connectors.js +++ b/lib/link/connectors.js @@ -351,6 +351,7 @@ class WebSocketClientConnector extends WebSocketBaseConnector { this._sessionToken = data.session_token; this._heartbeatInterval = data.heartbeat_interval; this.startHeartbeat(); + this._startedReconnect = null; this._connected = true; this.emit("connected"); @@ -363,6 +364,7 @@ class WebSocketClientConnector extends WebSocketBaseConnector { for (let message of this._sendBuffer) { this._socket.send(JSON.stringify(message)); } + this._startedReconnect = null; this._connected = true; this.emit("connected"); diff --git a/plugins/research_sync/master.js b/plugins/research_sync/master.js index 84a00db4..4e141be9 100644 --- a/plugins/research_sync/master.js +++ b/plugins/research_sync/master.js @@ -67,6 +67,17 @@ class MasterPlugin extends plugin.BaseMasterPlugin { return; } + // Handle contributon to the next level of a researched technology + if (tech.level === level - 1 && tech.researched) { + tech.researched = false; + tech.level = level; + } + + // Ignore contributions to higher levels + if (tech.level < level) { + return; + } + let newProgress = tech.progress + contribution; if (newProgress < 1) { tech.progress = newProgress; @@ -125,12 +136,15 @@ class MasterPlugin extends plugin.BaseMasterPlugin { } if (tech.level < level || researched) { + // Send update if the unlocked level is greater + if (level - !researched > tech.level - !tech.researched) { + for (let slaveConnection of this.master.slaveConnections.values()) { + this.info.messages.finished.send(slaveConnection, { name, level: level - !researched }); + } + } tech.level = level; tech.progress = progress; tech.researched = researched; - for (let slaveConnection of this.master.slaveConnections.values()) { - this.info.messages.finished.send(slaveConnection, { name, level }); - } if (progress) { this.progressToBroadcast.add(name); diff --git a/plugins/research_sync/module/sync.lua b/plugins/research_sync/module/sync.lua index f7c88aae..108e0b2d 100644 --- a/plugins/research_sync/module/sync.lua +++ b/plugins/research_sync/module/sync.lua @@ -197,7 +197,7 @@ function research_sync.research_technology(name, level) tech.researched = true if tech.name:find("-%d+$") then - game.print {"", "Researched ", {"technology-name." .. tech.name:gsub("-%d+$", "")}, level} + game.print {"", "Researched ", {"technology-name." .. tech.name:gsub("-%d+$", "")}, " ", level} else game.print {"", "Researched ", {"technology-name." .. tech.name}} end diff --git a/plugins/subspace_storage/dole.js b/plugins/subspace_storage/dole.js index 5a4d9306..f7ed8dc2 100644 --- a/plugins/subspace_storage/dole.js +++ b/plugins/subspace_storage/dole.js @@ -94,6 +94,7 @@ let _doleDivisionFactor = {}; function doleDivider({ object, items, + logItemTransfers, }){ let itemCount = items.getItemCount(object.name); const doleDivisionRetardation = 10; //lower rates will equal more dramatic swings @@ -102,7 +103,7 @@ function doleDivider({ const originalCount = Number(object.count) || 0; object.count /= ((_doleDivisionFactor[object.name]||0)+doleDivisionRetardation)/doleDivisionRetardation; object.count = Math.round(object.count); - if (itemCount > 40) { + if (logItemTransfers) { console.info(`Serving ${object.count}/${originalCount} ${object.name} from ${itemCount} ${object.name} with dole division factor ${(_doleDivisionFactor[object.name]||0)} (real=${((_doleDivisionFactor[object.name]||0)+doleDivisionRetardation)/doleDivisionRetardation}), item is ${itemCount > object.count?'stocked':'short'}.`); } diff --git a/plugins/subspace_storage/master.js b/plugins/subspace_storage/master.js index 21e44938..64a10a3b 100644 --- a/plugins/subspace_storage/master.js +++ b/plugins/subspace_storage/master.js @@ -139,6 +139,7 @@ class MasterPlugin extends plugin.BaseMasterPlugin { let count = dole.doleDivider({ object: { name: item[0], count: item[1], instanceId, instanceName}, items: this.items, + logItemTransfers: this.master.config.get("subspace_storage.log_item_transfers"), }); if (count > 0) { itemsRemoved.push([item[0], count]);