Fix code style errors

Remove extra whitespace, use more consistent spacing, add missing
semicolons, using dangling commas, break up long lines, consistent
multiline operator placement, add missing JSDoc strings and so on.
This commit is contained in:
Hornwitser committed 2023-11-19 04:48:38 +01:00
1 parent 97e05c0610
commit 7314dc99c8
71 files changed
+403 -290

No files matched your search

+3 -1
View File
@@ -186,7 +186,9 @@ export class ControllerPlugin extends lib.BaseControllerPlugin {
// use fancy neural net to calculate a "fair" dole division rate.
if (method === "neural_dole") {
for (let item of request.items) {
let count = this.neuralDole.divider({ name: item.name, count: item.count, instanceId, instanceName });
let count = this.neuralDole.divider(
{ name: item.name, count: item.count, instanceId, instanceName }
);
if (count > 0) {
itemsRemoved.push(new Item(item.name, count));
}
+2 -1
View File
@@ -99,7 +99,8 @@ export class NeuralDole {
// If the server regularly can't fulfill requests, this number grows until
// it can. Then it slowly shrinks back down.
let _doleDivisionFactor: { [key:string]: number } = {};
export function doleDivider({
export function doleDivider(
{
object,
items,
logItemTransfers,
+3 -2
View File
@@ -73,7 +73,8 @@ export class InstancePlugin extends lib.BaseInstancePlugin {
return;
}
const fromIpcItems = items.map(item => new Item(item[0], item[1]))
const fromIpcItems = items.map(item => new Item(item[0], item[1]));
this.instance.sendTo("controller", new PlaceEvent(fromIpcItems));
if (this.instance.config.get("subspace_storage.log_item_transfers")) {
@@ -85,7 +86,7 @@ export class InstancePlugin extends lib.BaseInstancePlugin {
// request items --------------------------------------------------------------
async requestItems(requestItems: IpcItems) {
// Request the items all at once
let fromIpcItems = requestItems.map(item => new Item(item[0], item[1]))
let fromIpcItems = requestItems.map(item => new Item(item[0], item[1]));
let items = await this.instance.sendTo("controller", new RemoveRequest(fromIpcItems));
if (!items.length) {
+8 -8
View File
@@ -37,8 +37,8 @@ export class PlaceEvent {
}
static jsonSchema = Type.Object({
"items": Type.Array(Item.jsonSchema)
})
"items": Type.Array(Item.jsonSchema),
});
static fromJSON(json: Static<typeof PlaceEvent.jsonSchema>): PlaceEvent {
return new this(json.items.map(item => Item.fromJSON(item)));
@@ -58,8 +58,8 @@ export class RemoveRequest {
}
static jsonSchema = Type.Object({
"items": Type.Array(Item.jsonSchema)
})
"items": Type.Array(Item.jsonSchema),
});
static fromJSON(json: Static<typeof RemoveRequest.jsonSchema>): RemoveRequest {
return new this(json.items.map(item => Item.fromJSON(item)));
@@ -91,8 +91,8 @@ export class UpdateStorageEvent {
}
static jsonSchema = Type.Object({
"items": Type.Array(Item.jsonSchema)
})
"items": Type.Array(Item.jsonSchema),
});
static fromJSON(json: Static<typeof UpdateStorageEvent.jsonSchema>): UpdateStorageEvent {
return new this(json.items.map(item => Item.fromJSON(item)));
@@ -113,8 +113,8 @@ export class SetStorageSubscriptionRequest {
}
static jsonSchema = Type.Object({
"storage": Type.Boolean()
})
"storage": Type.Boolean(),
});
static fromJSON(json: Static<typeof SetStorageSubscriptionRequest.jsonSchema>): SetStorageSubscriptionRequest {
return new this(json.storage);