From 6ecad4db558cbd939b665fc5a2a85b818a86bdaf Mon Sep 17 00:00:00 2001 From: Casper Warden <216465704+casperwardensl@users.noreply.github.com> Date: Wed, 22 Sep 2021 16:58:06 +0100 Subject: [PATCH] Fix for timeouts when adding scripts to ask inventory --- lib/classes/commands/RegionCommands.ts | 4 ++-- lib/classes/public/GameObject.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/classes/commands/RegionCommands.ts b/lib/classes/commands/RegionCommands.ts index 1920948..2623ab1 100644 --- a/lib/classes/commands/RegionCommands.ts +++ b/lib/classes/commands/RegionCommands.ts @@ -1563,13 +1563,13 @@ export class RegionCommands extends CommandsBase return this.currentRegion.getParcels(); } - async getAllObjects(resolve: boolean = false, onlyUnresolved: boolean = false): Promise + async getAllObjects(resolve = false, onlyUnresolved = false, skipInventory = false, outputLog = false): Promise { const objs = await this.currentRegion.objects.getAllObjects(); if (resolve) { const resolver = new ObjectResolver(this.currentRegion); - await resolver.resolveObjects(objs, onlyUnresolved); + await resolver.resolveObjects(objs, onlyUnresolved, skipInventory, outputLog); } return objs; } diff --git a/lib/classes/public/GameObject.ts b/lib/classes/public/GameObject.ts index dd17c79..9bc9d41 100644 --- a/lib/classes/public/GameObject.ts +++ b/lib/classes/public/GameObject.ts @@ -900,8 +900,16 @@ export class GameObject implements IGameObjectData { if (item.name === tmpName) { + // We are intentionally not waiting for this rename job so that the wait below succeeds item.renameInTask(this, name).then(() => {}).catch(() => {}); - await this.waitForInventoryUpdate(); + try + { + await this.waitForInventoryUpdate(); + } + catch (error) + { + + } await this.updateInventory(); for (const newItem of this.inventory) { @@ -1964,6 +1972,7 @@ export class GameObject implements IGameObjectData async waitForInventoryUpdate(inventorySerial?: number): Promise { // We need to select the object or we won't get the objectProperties message + await this.deselect(); this.select(); await this.region.circuit.waitForMessage(Message.ObjectProperties, 10000, (message: ObjectPropertiesMessage) => {