Improvements to object resolution
This commit is contained in:
@@ -421,6 +421,10 @@ export class InventoryItem
|
||||
{
|
||||
inventoryItem.inventoryType = parseInt(prop, 10);
|
||||
}
|
||||
if ((prop = Utils.getFromXMLJS(result, 'Type')) !== undefined)
|
||||
{
|
||||
inventoryItem.type = parseInt(prop, 10);
|
||||
}
|
||||
if ((prop = Utils.getFromXMLJS(result, 'CreatorUUID')) !== undefined)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -99,6 +99,10 @@ export class ObjectResolver
|
||||
}
|
||||
|
||||
const objArray = Array.from(objs.values());
|
||||
for (const obj of objArray)
|
||||
{
|
||||
obj.resolveAttempts = (obj.resolveAttempts ?? 0) + 1;
|
||||
}
|
||||
try
|
||||
{
|
||||
await this.region.clientCommands.region.selectObjects(objArray);
|
||||
|
||||
@@ -234,7 +234,6 @@ export class ParticleSystem
|
||||
}
|
||||
const systemBlock = Buffer.allocUnsafe(68);
|
||||
let pos = 0;
|
||||
console.log('FLAGS: ' + this.flags);
|
||||
systemBlock.writeUInt32LE(this.crc, pos); pos = pos + 4;
|
||||
systemBlock.writeUInt32LE(this.flags, pos); pos = pos + 4; // Flags is zero
|
||||
systemBlock.writeUInt8(this.pattern, pos++);
|
||||
|
||||
@@ -376,21 +376,6 @@ export class RegionCommands extends CommandsBase
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
for (const obj of objects)
|
||||
{
|
||||
if (!(obj instanceof GameObject))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (obj.resolvedAt === undefined || obj.name === undefined)
|
||||
{
|
||||
obj.resolveAttempts++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1601,7 +1601,7 @@ export class GameObject implements IGameObjectData
|
||||
}
|
||||
}
|
||||
|
||||
private async getXML(xml: XMLNode, rootPrim: GameObject, linkNum: number, rootNode?: string): Promise<void>
|
||||
private async getXML(xml: XMLNode, rootPrim: GameObject, linkNum: number, rootNode?: string, skipInventory = false): Promise<void>
|
||||
{
|
||||
const resolver = this.region?.resolver;
|
||||
if (resolver)
|
||||
@@ -1617,7 +1617,7 @@ export class GameObject implements IGameObjectData
|
||||
Logger.Error(e);
|
||||
}
|
||||
}
|
||||
if (!this.resolvedInventory)
|
||||
if (!this.resolvedInventory && !skipInventory)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1889,25 +1889,25 @@ export class GameObject implements IGameObjectData
|
||||
this.region.objects.populateChildren(this);
|
||||
}
|
||||
|
||||
async exportXMLElement(rootNode?: string): Promise<XMLElement>
|
||||
async exportXMLElement(rootNode?: string, skipInventory = false): Promise<XMLElement>
|
||||
{
|
||||
const document = builder.create('SceneObjectGroup');
|
||||
let linkNum = 1;
|
||||
await this.getXML(document, this, linkNum, rootNode);
|
||||
await this.getXML(document, this, linkNum, rootNode, skipInventory);
|
||||
if (this.children && this.children.length > 0)
|
||||
{
|
||||
const otherParts = document.ele('OtherParts');
|
||||
for (const child of this.children)
|
||||
{
|
||||
await child.getXML(otherParts, this, ++linkNum, (rootNode !== undefined) ? 'Part' : undefined);
|
||||
await child.getXML(otherParts, this, ++linkNum, (rootNode !== undefined) ? 'Part' : undefined, skipInventory);
|
||||
}
|
||||
}
|
||||
return document;
|
||||
}
|
||||
|
||||
async exportXML(rootNode?: string): Promise<string>
|
||||
async exportXML(rootNode?: string, skipInventory = false): Promise<string>
|
||||
{
|
||||
return (await this.exportXMLElement(rootNode)).end({ pretty: true, allowEmpty: true });
|
||||
return (await this.exportXMLElement(rootNode, skipInventory)).end({ pretty: true, allowEmpty: true });
|
||||
}
|
||||
|
||||
public toJSON(): IGameObjectData
|
||||
|
||||
Reference in New Issue
Block a user