Fix object selectin/deselection, deprecated http option

This commit is contained in:
Casper Warden
2023-11-22 11:51:20 +00:00
parent adc9d54190
commit 302bf3302f
7 changed files with 50 additions and 20 deletions

View File

@@ -174,7 +174,9 @@ export class Caps
const assetURL = capURL + '/?' + type + '_id=' + uuid.toString();
const response = await got.get(assetURL, {
https: {
rejectUnauthorized: false,
},
method: 'GET',
responseType: 'buffer'
});
@@ -195,7 +197,9 @@ export class Caps
'Content-Type': contentType
},
body: data,
rejectUnauthorized: false
https: {
rejectUnauthorized: false,
},
});
return { status: response.statusCode, body: response.body };
@@ -209,7 +213,9 @@ export class Caps
'Content-Type': contentType
},
body: data,
rejectUnauthorized: false
https: {
rejectUnauthorized: false,
},
});
return { status: response.statusCode, body: response.body };
@@ -218,7 +224,9 @@ export class Caps
public async requestGet(requestURL: string): Promise<ICapResponse>
{
const response = await got.get(requestURL, {
rejectUnauthorized: false
https: {
rejectUnauthorized: false,
},
});
return { status: response.statusCode, body: response.body };
@@ -227,7 +235,9 @@ export class Caps
public async requestDelete(requestURL: string): Promise<ICapResponse>
{
const response = await got.delete(requestURL, {
rejectUnauthorized: false
https: {
rejectUnauthorized: false,
},
});
return { status: response.statusCode, body: response.body };

View File

@@ -568,7 +568,9 @@ export class EventQueueClient
'Content-Type': contentType
},
body: data,
https: {
rejectUnauthorized: false,
},
timeout: 1800000 // Super long timeout
});

View File

@@ -214,7 +214,7 @@ export class ObjectStoreFull extends ObjectStoreLite implements IObjectStore
{
this.insertIntoRtree(obj);
const parentObj = this.objects.get(objData.ParentID ?? 0);
if (objData.ParentID !== undefined && objData.ParentID !== 0 && !parentObj)
if (objData.ParentID !== undefined && objData.ParentID !== 0 && !parentObj && !obj.IsAttachment)
{
this.requestMissingObject(objData.ParentID).then(() =>
{
@@ -352,7 +352,7 @@ export class ObjectStoreFull extends ObjectStoreLite implements IObjectStore
}
else
{
if (o.ParentID !== undefined && o.ParentID !== 0 && !this.objects.has(o.ParentID))
if (o.ParentID !== undefined && o.ParentID !== 0 && !this.objects.has(o.ParentID) && !o.IsAttachment)
{
this.requestMissingObject(o.ParentID).catch((e) =>
{

View File

@@ -663,7 +663,7 @@ export class ObjectStoreLite implements IObjectStore
this.notifyObjectUpdate(newObject, obj!);
if (objData.ParentID !== undefined && objData.ParentID !== 0 && !this.objects.get(objData.ParentID))
if (objData.ParentID !== undefined && objData.ParentID !== 0 && !this.objects.get(objData.ParentID) && !obj?.IsAttachment)
{
this.requestMissingObject(objData.ParentID);
}
@@ -907,7 +907,7 @@ export class ObjectStoreLite implements IObjectStore
return;
}
}
if (o.ParentID !== undefined && o.ParentID !== 0 && !this.objects.has(o.ParentID))
if (o.ParentID !== undefined && o.ParentID !== 0 && !this.objects.has(o.ParentID) && !o.IsAttachment)
{
this.requestMissingObject(o.ParentID).catch((e) =>
{
@@ -1160,7 +1160,7 @@ export class ObjectStoreLite implements IObjectStore
}
else
{
if (go.ParentID !== undefined && go.ParentID !== 0 && !parentObj)
if (go.ParentID !== undefined && go.ParentID !== 0 && !parentObj && !go.IsAttachment)
{
this.requestMissingObject(go.ParentID).catch((e: unknown) =>
{

View File

@@ -201,20 +201,28 @@ export class RegionCommands extends CommandsBase
SessionID: this.circuit.sessionID
};
deselectObject.ObjectData = [];
const idMap: { [key: number]: GameObject } = {};
const uuidMap: { [key: string]: GameObject } = {};
let skipped = 0;
for (const obj of objects)
{
const localID = obj.ID;
if (!idMap[localID])
if (!(obj instanceof GameObject))
{
idMap[localID] = obj;
skipped++;
continue;
}
const uuidStr = obj.FullID.toString();
if (!uuidMap[uuidStr])
{
uuidMap[uuidStr] = obj;
deselectObject.ObjectData.push({
ObjectLocalID: obj.ID
});
}
}
// Create a map of our expected UUIDs
if (skipped > 0)
{
console.log('Skipped ' + String(skipped) + ' bad objects during deselection');
}
const sequenceID = this.circuit.sendMessage(deselectObject, PacketFlags.Reliable);
return this.circuit.waitForAck(sequenceID, 10000);
@@ -286,8 +294,14 @@ export class RegionCommands extends CommandsBase
};
selectObject.ObjectData = [];
const uuidMap: { [key: string]: GameObject } = {};
let skipped = 0;
for (const obj of objects)
{
if (!(obj instanceof GameObject))
{
skipped++;
continue;
}
const uuidStr = obj.FullID.toString();
if (!uuidMap[uuidStr])
{
@@ -297,6 +311,10 @@ export class RegionCommands extends CommandsBase
});
}
}
if (skipped > 0)
{
console.log('Skipped ' + String(skipped) + ' bad objects during deselection');
}
// Create a map of our expected UUIDs
this.circuit.sendMessage(selectObject, PacketFlags.Reliable);

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@caspertech/node-metaverse",
"version": "0.7.13",
"version": "0.7.14",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@caspertech/node-metaverse",
"version": "0.7.13",
"version": "0.7.14",
"license": "MIT",
"dependencies": {
"@caspertech/llsd": "^1.0.5",

View File

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