Fix for timeouts when adding scripts to ask inventory

This commit is contained in:
Casper Warden
2021-09-22 16:58:06 +01:00
parent 41f79d969e
commit 6ecad4db55
2 changed files with 12 additions and 3 deletions

View File

@@ -1563,13 +1563,13 @@ export class RegionCommands extends CommandsBase
return this.currentRegion.getParcels();
}
async getAllObjects(resolve: boolean = false, onlyUnresolved: boolean = false): Promise<GameObject[]>
async getAllObjects(resolve = false, onlyUnresolved = false, skipInventory = false, outputLog = false): Promise<GameObject[]>
{
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;
}

View File

@@ -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<void>
{
// We need to select the object or we won't get the objectProperties message
await this.deselect();
this.select();
await this.region.circuit.waitForMessage<ObjectPropertiesMessage>(Message.ObjectProperties, 10000, (message: ObjectPropertiesMessage) =>
{