diff --git a/packages/create/create.js b/packages/create/create.js index b72b6a8e..1d7972a2 100755 --- a/packages/create/create.js +++ b/packages/create/create.js @@ -2,7 +2,6 @@ "use strict"; const child_process = require("child_process"); -const events = require("events"); const fs = require("fs-extra"); const inquirer = require("inquirer"); const os = require("os"); @@ -94,7 +93,6 @@ async function safeOutputFile(file, data, options={}) { async function execFile(cmd, args) { logger.verbose(`executing ${cmd} ${args.join(" ")}`); - const asyncExec = util.promisify(child_process.execFile); return new Promise((resolve, reject) => { let child = child_process.execFile(cmd, args, (err, stdout, stderr) => { if (err) { diff --git a/packages/ctl/ctl.js b/packages/ctl/ctl.js index 64e1ff15..9e48860f 100755 --- a/packages/ctl/ctl.js +++ b/packages/ctl/ctl.js @@ -327,7 +327,7 @@ instanceCommands.add(new libCommand.Command({ } instanceConfig.set("instance.name", args.name); let serialized_config = instanceConfig.serialize("master"); - let response = await libLink.messages.createInstance.send(control, { serialized_config }); + await libLink.messages.createInstance.send(control, { serialized_config }); }, })); @@ -563,7 +563,7 @@ instanceCommands.add(new libCommand.Command({ let instanceId = await libCommand.resolveInstance(control, args.instance); let { seed, mapGenSettings, mapSettings } = await loadMapSettings(args); await control.setLogSubscriptions({ instance_ids: [instanceId] }); - let response = await libLink.messages.createSave.send(control, { + await libLink.messages.createSave.send(control, { instance_id: instanceId, name: args.name, seed, @@ -611,7 +611,7 @@ instanceCommands.add(new libCommand.Command({ } for (let requestError of result.body.request_errors || []) { - logger.error(error); + logger.error(requestError); } if (result.body.saves && result.body.saves.length) { @@ -690,7 +690,7 @@ instanceCommands.add(new libCommand.Command({ handler: async function(args, control) { let instanceId = await libCommand.resolveInstance(control, args.instance); await control.setLogSubscriptions({ instance_ids: [instanceId] }); - let response = await libLink.messages.exportData.send(control, { + await libLink.messages.exportData.send(control, { instance_id: instanceId, }); }, @@ -707,7 +707,7 @@ instanceCommands.add(new libCommand.Command({ handler: async function(args, control) { let instanceId = await libCommand.resolveInstance(control, args.instance); await control.setLogSubscriptions({ instance_ids: [instanceId] }); - let response = await libLink.messages.startInstance.send(control, { + await libLink.messages.startInstance.send(control, { instance_id: instanceId, save: args.save || null, }); @@ -731,7 +731,7 @@ instanceCommands.add(new libCommand.Command({ let instanceId = await libCommand.resolveInstance(control, args.instance); await control.setLogSubscriptions({ instance_ids: [instanceId] }); let { seed, mapGenSettings, mapSettings } = await loadMapSettings(args); - let response = await libLink.messages.loadScenario.send(control, { + await libLink.messages.loadScenario.send(control, { instance_id: instanceId, scenario: args.scenario, seed, @@ -749,7 +749,7 @@ instanceCommands.add(new libCommand.Command({ handler: async function(args, control) { let instanceId = await libCommand.resolveInstance(control, args.instance); await control.setLogSubscriptions({ instance_ids: [instanceId] }); - let response = await libLink.messages.stopInstance.send(control, { + await libLink.messages.stopInstance.send(control, { instance_id: instanceId, }); }, @@ -760,7 +760,7 @@ instanceCommands.add(new libCommand.Command({ yargs.positional("instance", { describe: "Instance to delete", type: "string" }); }], handler: async function(args, control) { - let response = await libLink.messages.deleteInstance.send(control, { + await libLink.messages.deleteInstance.send(control, { instance_id: await libCommand.resolveInstance(control, args.instance), }); }, diff --git a/packages/lib/build_mod.js b/packages/lib/build_mod.js index 3ac716c6..1aedce48 100644 --- a/packages/lib/build_mod.js +++ b/packages/lib/build_mod.js @@ -83,7 +83,7 @@ async function build(args) { for (let entry of await fs.readdir(args.outputDir)) { let match = splitter.exec(entry); if (match) { - let [, name, version] = match; + let name = match[1]; if (name === info.name) { let modPath = path.join(args.outputDir, entry); console.log(`Removing ${modPath}`); @@ -94,7 +94,7 @@ async function build(args) { } if (info.variants) { - for (let [variant, variantOverrides] of Object.entries(info.variants)) { + for (let variantOverrides of info.variants) { let variantInfo = { ...info, ...variantOverrides, diff --git a/packages/lib/config/definitions.js b/packages/lib/config/definitions.js index 6744e8ff..608ce496 100644 --- a/packages/lib/config/definitions.js +++ b/packages/lib/config/definitions.js @@ -376,9 +376,9 @@ ControlConfig.registerGroup(ControlGroup); function validateGroup(pluginInfo, groupName) { - if (!pluginInfo[groupName] instanceof classes.PluginConfigGroup) { + if (!(pluginInfo[groupName].prototype instanceof classes.PluginConfigGroup)) { throw new Error( - `Expected ${groupName} for ${pluginInfo.name} to be an instance of PluginConfigGroup` + `Expected ${groupName} for ${pluginInfo.name} to be a subclass of PluginConfigGroup` ); } diff --git a/packages/lib/factorio/server.js b/packages/lib/factorio/server.js index ba7dd424..60070550 100644 --- a/packages/lib/factorio/server.js +++ b/packages/lib/factorio/server.js @@ -791,6 +791,7 @@ class FactorioServer extends events.EventEmitter { try { let [code, signal] = await events.once(this._server, "exit"); + void signal; if (code !== 0) { throw new Error(`Factorio exited with status ${code}`); } diff --git a/packages/lib/link/connectors.js b/packages/lib/link/connectors.js index dc7bc6a3..fa0f2a91 100644 --- a/packages/lib/link/connectors.js +++ b/packages/lib/link/connectors.js @@ -445,7 +445,7 @@ class WebSocketClientConnector extends WebSocketBaseConnector { return; } - let { seq, type, data } = message; + let { type, data } = message; if (type === "hello") { logger.verbose(`Connector | received hello from master version ${data.version}`); this.emit("hello", data); diff --git a/packages/lib/link/link.js b/packages/lib/link/link.js index fa98e927..ee68ba3d 100644 --- a/packages/lib/link/link.js +++ b/packages/lib/link/link.js @@ -4,7 +4,6 @@ const libSchema = require("../schema"); const libErrors = require("../errors"); const { logger } = require("../logging"); -const messages = require("./messages"); // Some definitions for the terminology used here: // link: Either side of a master - client connection @@ -135,7 +134,7 @@ class Link { * @returns {Boolean} true if a waiter was triggered. */ _processWaiters(message) { - let { seq, type, data } = message; + let { type, data } = message; let waiters = this._waiters.get(type); if (!waiters || !waiters.length) { return false; diff --git a/packages/lib/shared_commands.js b/packages/lib/shared_commands.js index 1a2f62a3..8f050ad1 100644 --- a/packages/lib/shared_commands.js +++ b/packages/lib/shared_commands.js @@ -3,7 +3,6 @@ * @module lib/shared_commands */ "use strict"; -const fs = require("fs-extra"); const path = require("path"); const libConfig = require("./config"); diff --git a/packages/master/master.js b/packages/master/master.js index f2a09f0d..ab9ea436 100755 --- a/packages/master/master.js +++ b/packages/master/master.js @@ -89,12 +89,14 @@ const wsActiveConnectionsGauge = new libPrometheus.Gauge( "How many WebSocket connections are currently open to the master server", { callback: function(gauge) { gauge.set(master.wsServer.activeConnectors.size); }} ); +void wsActiveConnectionsGauge; const wsActiveSlavesGauge = new libPrometheus.Gauge( "clusterio_master_active_slaves", "How many slaves are currently connected to the master", { callback: function(gauge) { gauge.set(master.wsServer.slaveConnections.size); }} ); +void wsActiveSlavesGauge; const masterConnectedClientsCount = new libPrometheus.Gauge( "clusterio_master_connected_clients_count", "How many clients are currently connected to this master server", @@ -105,6 +107,7 @@ const masterConnectedClientsCount = new libPrometheus.Gauge( }, }, ); +void masterConnectedClientsCount; async function handleBootstrapCommand(args, masterConfig) { @@ -356,7 +359,7 @@ async function startup() { // add better stack traces on promise rejection process.on("unhandledRejection", err => logger.error(`Unhandled rejection:\n${err.stack}`)); - let { args, shouldRun, clusterLogger, pluginInfos, masterConfigPath, masterConfig } = await initialize(master); + let { args, shouldRun, clusterLogger, pluginInfos, masterConfigPath, masterConfig } = await initialize(); if (!shouldRun) { return; } diff --git a/packages/master/src/ControlConnection.js b/packages/master/src/ControlConnection.js index 5535bcc1..068076ee 100644 --- a/packages/master/src/ControlConnection.js +++ b/packages/master/src/ControlConnection.js @@ -385,7 +385,7 @@ class ControlConnection extends BaseConnection { }); ready.catch(() => {}); - let result = await this._master.forwardRequestToInstance(libLink.messages.pushSave, { + await this._master.forwardRequestToInstance(libLink.messages.pushSave, { instance_id, stream_id: stream.id, save, diff --git a/packages/master/src/HttpCloser.js b/packages/master/src/HttpCloser.js index 8a488404..af10e14b 100644 --- a/packages/master/src/HttpCloser.js +++ b/packages/master/src/HttpCloser.js @@ -1,7 +1,6 @@ "use strict"; const http = require("http"); const https = require("https"); -const util = require("util"); /** * Gracefully close a Node.js HTTP(S) server diff --git a/packages/master/src/Master.js b/packages/master/src/Master.js index b5944ac5..28809002 100644 --- a/packages/master/src/Master.js +++ b/packages/master/src/Master.js @@ -97,7 +97,7 @@ class Master { } async start(args) { - if (!this._state === "new") { + if (this._state !== "new") { throw new Error(`Cannot start in state ${this._state}`); } diff --git a/packages/master/src/WsServer.js b/packages/master/src/WsServer.js index 1e1de286..2be97122 100644 --- a/packages/master/src/WsServer.js +++ b/packages/master/src/WsServer.js @@ -176,7 +176,7 @@ ${err.stack}` return; } - let { seq, type, data } = message; + let { type, data } = message; if (type === "resume") { let connector; diff --git a/packages/web_ui/src/components/App.jsx b/packages/web_ui/src/components/App.jsx index 3a51feef..db5f64d0 100644 --- a/packages/web_ui/src/components/App.jsx +++ b/packages/web_ui/src/components/App.jsx @@ -1,4 +1,3 @@ -import events from "events"; import React, { useEffect, useState } from "react"; import { BrowserRouter } from "react-router-dom"; diff --git a/packages/web_ui/src/components/BaseConfigTree.jsx b/packages/web_ui/src/components/BaseConfigTree.jsx index 5f78d44d..1e75338a 100644 --- a/packages/web_ui/src/components/BaseConfigTree.jsx +++ b/packages/web_ui/src/components/BaseConfigTree.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useContext, useState } from "react"; +import React, { useEffect, useState } from "react"; import { Button, Card, Checkbox, Form, Input, InputNumber, Space, Spin, Tree, Typography } from "antd"; const { Title } = Typography; diff --git a/packages/web_ui/src/components/CreateSaveModal.jsx b/packages/web_ui/src/components/CreateSaveModal.jsx index 1ded9c5c..5a311c66 100644 --- a/packages/web_ui/src/components/CreateSaveModal.jsx +++ b/packages/web_ui/src/components/CreateSaveModal.jsx @@ -1,5 +1,5 @@ import React, { useContext, useState } from "react"; -import { Button, Col, Form, Input, Modal, Row, Typography } from "antd"; +import { Button, Form, Input, Modal } from "antd"; import { libFactorio, libLink } from "@clusterio/lib"; diff --git a/packages/web_ui/src/components/ErrorPage.jsx b/packages/web_ui/src/components/ErrorPage.jsx index 6dc28028..22748c46 100644 --- a/packages/web_ui/src/components/ErrorPage.jsx +++ b/packages/web_ui/src/components/ErrorPage.jsx @@ -1,8 +1,6 @@ -import React, { useContext } from "react"; +import React from "react"; import { Typography } from "antd"; -import { libLink } from "@clusterio/lib"; - import PageLayout from "./PageLayout"; const { Paragraph } = Typography; diff --git a/packages/web_ui/src/components/InstanceConfigTree.jsx b/packages/web_ui/src/components/InstanceConfigTree.jsx index cd77abe2..a2d05a71 100644 --- a/packages/web_ui/src/components/InstanceConfigTree.jsx +++ b/packages/web_ui/src/components/InstanceConfigTree.jsx @@ -1,5 +1,4 @@ import React, { useContext } from "react"; -import { Typography } from "antd"; import { libConfig, libLink } from "@clusterio/lib"; diff --git a/packages/web_ui/src/components/InstanceViewPage.jsx b/packages/web_ui/src/components/InstanceViewPage.jsx index 4559839c..c56be6bd 100644 --- a/packages/web_ui/src/components/InstanceViewPage.jsx +++ b/packages/web_ui/src/components/InstanceViewPage.jsx @@ -20,7 +20,7 @@ import { useInstance } from "../model/instance"; import { useSlave } from "../model/slave"; import InstanceStatusTag from "./InstanceStatusTag"; -const { Title, Paragraph } = Typography; +const { Title } = Typography; export default function InstanceViewPage(props) { diff --git a/packages/web_ui/src/components/InstancesPage.jsx b/packages/web_ui/src/components/InstancesPage.jsx index a6ed0aef..3195c439 100644 --- a/packages/web_ui/src/components/InstancesPage.jsx +++ b/packages/web_ui/src/components/InstancesPage.jsx @@ -28,7 +28,7 @@ function CreateInstanceButton(props) { await instanceConfig.init(); instanceConfig.set("instance.name", values.instanceName); let serialized_config = instanceConfig.serialize("master"); - let result = await libLink.messages.createInstance.send(control, { serialized_config }); + await libLink.messages.createInstance.send(control, { serialized_config }); setVisible(false); history.push(`/instances/${instanceConfig.get("instance.id")}/view`); } diff --git a/packages/web_ui/src/components/LoadScenarioModal.jsx b/packages/web_ui/src/components/LoadScenarioModal.jsx index 045b665d..a0b2c37b 100644 --- a/packages/web_ui/src/components/LoadScenarioModal.jsx +++ b/packages/web_ui/src/components/LoadScenarioModal.jsx @@ -1,5 +1,5 @@ import React, { useContext, useState } from "react"; -import { Button, Col, Form, Input, Modal, Row, Typography } from "antd"; +import { Button, Form, Input, Modal } from "antd"; import { libFactorio, libLink } from "@clusterio/lib"; diff --git a/packages/web_ui/src/components/LoginForm.jsx b/packages/web_ui/src/components/LoginForm.jsx index e44f2ecf..d3b22a38 100644 --- a/packages/web_ui/src/components/LoginForm.jsx +++ b/packages/web_ui/src/components/LoginForm.jsx @@ -1,11 +1,11 @@ import React, { Fragment, useContext } from "react"; -import { Button, Card, Divider, Form, Image, Input, List, Space, Spin, Typography } from "antd"; +import { Button, Card, Divider, Form, Image, Input, Space, Typography } from "antd"; import LockOutlined from "@ant-design/icons/LockOutlined"; import logo from "../images/logo.png"; import ControlContext from "./ControlContext"; -const { Paragraph, Text } = Typography; +const { Paragraph } = Typography; function TokenAuth(props) { @@ -22,7 +22,7 @@ function TokenAuth(props) { > + prefix={} type="password" placeholder="Authentication Token" /> diff --git a/packages/web_ui/src/components/MasterConfigTree.jsx b/packages/web_ui/src/components/MasterConfigTree.jsx index d72512e6..f5a8508f 100644 --- a/packages/web_ui/src/components/MasterConfigTree.jsx +++ b/packages/web_ui/src/components/MasterConfigTree.jsx @@ -1,5 +1,4 @@ import React, { useContext } from "react"; -import { Typography } from "antd"; import { libConfig, libLink } from "@clusterio/lib"; diff --git a/packages/web_ui/src/components/MasterPage.jsx b/packages/web_ui/src/components/MasterPage.jsx index 088d347e..8ba92848 100644 --- a/packages/web_ui/src/components/MasterPage.jsx +++ b/packages/web_ui/src/components/MasterPage.jsx @@ -1,4 +1,4 @@ -import React, { useContext } from "react"; +import React from "react"; import { Typography } from "antd"; import LogConsole from "./LogConsole"; diff --git a/packages/web_ui/src/components/PageLayout.jsx b/packages/web_ui/src/components/PageLayout.jsx index f4373d32..7749552c 100644 --- a/packages/web_ui/src/components/PageLayout.jsx +++ b/packages/web_ui/src/components/PageLayout.jsx @@ -1,6 +1,6 @@ import React from "react"; import { Link } from "react-router-dom"; -import { Layout, Menu, Breadcrumb, Typography } from "antd"; +import { Layout, Breadcrumb } from "antd"; const { Content } = Layout; diff --git a/packages/web_ui/src/components/PluginViewPage.jsx b/packages/web_ui/src/components/PluginViewPage.jsx index f6ef29de..4e9eebc1 100644 --- a/packages/web_ui/src/components/PluginViewPage.jsx +++ b/packages/web_ui/src/components/PluginViewPage.jsx @@ -1,10 +1,9 @@ import React, { useEffect, useContext, useState } from "react"; -import { useHistory, useParams } from "react-router-dom"; +import { useParams } from "react-router-dom"; import { Alert, Descriptions, Spin } from "antd"; import ControlContext from "./ControlContext"; import PageLayout from "./PageLayout"; -import { notifyErrorHandler } from "../util/notify"; export default function PluginViewPage() { diff --git a/packages/web_ui/src/components/SectionHeader.jsx b/packages/web_ui/src/components/SectionHeader.jsx index 13323316..a2bf4161 100644 --- a/packages/web_ui/src/components/SectionHeader.jsx +++ b/packages/web_ui/src/components/SectionHeader.jsx @@ -1,4 +1,4 @@ -import React, { useContext, useState } from "react"; +import React from "react"; export default function SectionHeader(props) { return
diff --git a/packages/web_ui/src/components/SlaveViewPage.jsx b/packages/web_ui/src/components/SlaveViewPage.jsx index 0b03fb6c..12544ad0 100644 --- a/packages/web_ui/src/components/SlaveViewPage.jsx +++ b/packages/web_ui/src/components/SlaveViewPage.jsx @@ -1,4 +1,4 @@ -import React, { useContext, useState } from "react"; +import React from "react"; import { Descriptions, PageHeader, Spin, Tag, Typography } from "antd"; import { useParams } from "react-router-dom"; diff --git a/packages/web_ui/src/model/instance.jsx b/packages/web_ui/src/model/instance.jsx index 11c7cc78..0f194a37 100644 --- a/packages/web_ui/src/model/instance.jsx +++ b/packages/web_ui/src/model/instance.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useContext, useState } from "react"; +import { useEffect, useContext, useState } from "react"; import ControlContext from "../components/ControlContext"; import { libLink, libLogging } from "@clusterio/lib"; diff --git a/packages/web_ui/src/model/item_metadata.jsx b/packages/web_ui/src/model/item_metadata.jsx index 50ece427..95ed36ac 100644 --- a/packages/web_ui/src/model/item_metadata.jsx +++ b/packages/web_ui/src/model/item_metadata.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; let itemMetadataCache = null; diff --git a/packages/web_ui/src/model/saves.jsx b/packages/web_ui/src/model/saves.jsx index 1f2454f4..0befca88 100644 --- a/packages/web_ui/src/model/saves.jsx +++ b/packages/web_ui/src/model/saves.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useContext, useState } from "react"; +import { useEffect, useContext, useState } from "react"; import ControlContext from "../components/ControlContext"; import { libLink, libLogging } from "@clusterio/lib"; diff --git a/packages/web_ui/src/model/slave.jsx b/packages/web_ui/src/model/slave.jsx index 6f6a6cfd..58a366fa 100644 --- a/packages/web_ui/src/model/slave.jsx +++ b/packages/web_ui/src/model/slave.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useContext, useState } from "react"; +import { useEffect, useContext, useState } from "react"; import ControlContext from "../components/ControlContext"; import { libLink } from "@clusterio/lib"; diff --git a/plugins/inventory_sync/master.js b/plugins/inventory_sync/master.js index 6ef37d28..e89a1b07 100644 --- a/plugins/inventory_sync/master.js +++ b/plugins/inventory_sync/master.js @@ -4,7 +4,6 @@ const path = require("path"); const libFileOps = require("@clusterio/lib/file_ops"); const libPlugin = require("@clusterio/lib/plugin"); -const libErrors = require("@clusterio/lib/errors"); async function loadDatabase(config, logger) { let itemsPath = path.resolve(config.get("master.database_directory"), "inventories.json"); diff --git a/plugins/player_auth/instance.js b/plugins/player_auth/instance.js index 931f722a..566d49be 100644 --- a/plugins/player_auth/instance.js +++ b/plugins/player_auth/instance.js @@ -3,7 +3,6 @@ */ "use strict"; const libPlugin = require("@clusterio/lib/plugin"); -const libLuaTools = require("@clusterio/lib/lua_tools"); class InstancePlugin extends libPlugin.BaseInstancePlugin { diff --git a/plugins/player_auth/master.js b/plugins/player_auth/master.js index cdfa2cfc..143b2c28 100644 --- a/plugins/player_auth/master.js +++ b/plugins/player_auth/master.js @@ -78,7 +78,7 @@ class MasterPlugin extends libPlugin.BaseMasterPlugin { return; } - for (let [player, entry] of this.players) { + for (let entry of this.players.values()) { if (entry.playerCode === playerCode && entry.expires > Date.now()) { let verifyCode = await generateCode(this.master.config.get("player_auth.code_length")); let secret = Buffer.from(this.master.config.get("master.auth_secret"), "base64"); diff --git a/plugins/player_auth/web/index.jsx b/plugins/player_auth/web/index.jsx index 8bbdcf2b..6ea302a2 100644 --- a/plugins/player_auth/web/index.jsx +++ b/plugins/player_auth/web/index.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from "react"; import { libPlugin } from "@clusterio/lib"; -import { notify, notifyErrorHandler } from "@clusterio/web_ui"; +import { notifyErrorHandler } from "@clusterio/web_ui"; import { Button, Form, Input, Spin, Typography } from "antd"; import "./index.css"; diff --git a/plugins/research_sync/instance.js b/plugins/research_sync/instance.js index 3f58bf2c..9f55ac37 100644 --- a/plugins/research_sync/instance.js +++ b/plugins/research_sync/instance.js @@ -43,7 +43,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin { if (!this.syncStarted || !["starting", "running"].includes(this.instance.status)) { return; } - let { name, level, researched } = message.data; + let { name, level } = message.data; await this.sendOrderedRcon( `/sc research_sync.research_technology("${libLuaTools.escapeString(name)}", ${level})`, true ); diff --git a/plugins/subspace_storage/dole_nn_base.js b/plugins/subspace_storage/dole_nn_base.js index a6f56508..d26f8cc0 100644 --- a/plugins/subspace_storage/dole_nn_base.js +++ b/plugins/subspace_storage/dole_nn_base.js @@ -62,7 +62,6 @@ function dose(numreq, instore, store_last_tick, dole, carry, prev_req, numreq_to debt, ]; // 5..12 let inputs = inp1.concat(inp2); - let internal = new Array(20).fill(0); let outputs = [0, 0, 0, 0]; // NN: Please don't touch :), code is generated @@ -78,7 +77,7 @@ function dose(numreq, instore, store_last_tick, dole, carry, prev_req, numreq_to outputs[0]=1.0; } - let res1 = Number(outputs[0]) * numreq+outputs[3] + debt; + let res1 = Number(outputs[0]) * numreq + outputs[3] + debt; let res_capped = Math.round(res1); if (res_capped > numreq) { res_capped = numreq; } @@ -88,7 +87,7 @@ function dose(numreq, instore, store_last_tick, dole, carry, prev_req, numreq_to res1 = res1 || 0; res_capped = res_capped || 0; // Safeguard against wrong values debt = res1 - res_capped; - debt_cap = Math.round(numreq * 1.5) + 5; + let debt_cap = Math.round(numreq * 1.5) + 5; if (debt > debt_cap) { debt = debt_cap; } @@ -129,7 +128,6 @@ function tick(instore, dole, store_last_tick, numreq_total_adj) { store_last_tick, numreq_total_adj, ]; - let internal = new Array(10).fill(0); let outputs = [0, 0]; // NN: Please don't touch :), code is generated @@ -139,7 +137,7 @@ function tick(instore, dole, store_last_tick, numreq_total_adj) { outputs[1] = outputs[0] * 1.828422785; outputs[1] = sigmoid3(outputs[1]); - avg = outputs[1]; + let avg = outputs[1]; if (numreq_total_adj < 0.11) { // When no item's are requested, result is 0.1; In that case there is // no deficit, so return 1 = 100% demand fulfilled diff --git a/plugins/subspace_storage/instance.js b/plugins/subspace_storage/instance.js index 36cacd20..806b9d22 100644 --- a/plugins/subspace_storage/instance.js +++ b/plugins/subspace_storage/instance.js @@ -1,6 +1,4 @@ "use strict"; -const fs = require("fs-extra"); - const libPlugin = require("@clusterio/lib/plugin"); const libLuaTools = require("@clusterio/lib/lua_tools"); diff --git a/plugins/subspace_storage/routes.js b/plugins/subspace_storage/routes.js index e3b0d3e9..16223b9a 100644 --- a/plugins/subspace_storage/routes.js +++ b/plugins/subspace_storage/routes.js @@ -1,7 +1,4 @@ "use strict"; -const path = require("path"); - - function addApiRoutes(app, items, endpointHitCounter) { /**