Squish errors in GetCosts

This commit is contained in:
Casper Warden
2023-11-16 23:40:33 +00:00
parent e5d9d162da
commit b34bf6590c
2 changed files with 37 additions and 30 deletions

View File

@@ -391,44 +391,51 @@ export class ObjectResolver
const that = this; const that = this;
const getCosts = async function(objIDs: UUID[]): Promise<void> const getCosts = async function(objIDs: UUID[]): Promise<void>
{ {
if (!that.region) try
{ {
return; if (!that.region)
}
const result = await that.region.caps.capsPostXML('GetObjectCost', {
'object_ids': objIDs
});
const uuids = Object.keys(result);
for (const key of uuids)
{
const costs = result[key];
try
{ {
if (!that.region) return;
}
const result = await that.region.caps.capsPostXML('GetObjectCost', {
'object_ids': objIDs
});
const uuids = Object.keys(result);
for (const key of uuids)
{
const costs = result[key];
try
{ {
return; if (!that.region)
} {
const obj: GameObject = that.region.objects.getObjectByUUID(new UUID(key)); return;
obj.linkPhysicsImpact = parseFloat(costs['linked_set_physics_cost']); }
obj.linkResourceImpact = parseFloat(costs['linked_set_resource_cost']); const obj: GameObject = that.region.objects.getObjectByUUID(new UUID(key));
obj.physicaImpact = parseFloat(costs['physics_cost']); obj.linkPhysicsImpact = parseFloat(costs['linked_set_physics_cost']);
obj.resourceImpact = parseFloat(costs['resource_cost']); obj.linkResourceImpact = parseFloat(costs['linked_set_resource_cost']);
obj.limitingType = costs['resource_limiting_type']; obj.physicaImpact = parseFloat(costs['physics_cost']);
obj.resourceImpact = parseFloat(costs['resource_cost']);
obj.limitingType = costs['resource_limiting_type'];
obj.landImpact = Math.round(obj.linkPhysicsImpact); obj.landImpact = Math.round(obj.linkPhysicsImpact);
if (obj.linkResourceImpact > obj.linkPhysicsImpact) if (obj.linkResourceImpact > obj.linkPhysicsImpact)
{ {
obj.landImpact = Math.round(obj.linkResourceImpact); obj.landImpact = Math.round(obj.linkResourceImpact);
}
obj.calculatedLandImpact = obj.landImpact;
if (obj.Flags !== undefined && obj.Flags & PrimFlags.TemporaryOnRez && obj.limitingType === 'legacy')
{
obj.calculatedLandImpact = 0;
}
} }
obj.calculatedLandImpact = obj.landImpact; catch (error)
if (obj.Flags !== undefined && obj.Flags & PrimFlags.TemporaryOnRez && obj.limitingType === 'legacy')
{ {
obj.calculatedLandImpact = 0;
} }
} }
catch (error) }
{} catch (error)
{
} }
}; };

View File

@@ -1,6 +1,6 @@
{ {
"name": "@caspertech/node-metaverse", "name": "@caspertech/node-metaverse",
"version": "0.6.12", "version": "0.6.14",
"description": "A node.js interface for Second Life.", "description": "A node.js interface for Second Life.",
"main": "dist/lib/index.js", "main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",