From 8dcbf2d32a97e37d5444f4a02aa36c3e541f155c Mon Sep 17 00:00:00 2001 From: Casper Warden <216465704+casperwardensl@users.noreply.github.com> Date: Thu, 14 Dec 2017 02:24:06 +0000 Subject: [PATCH] When StoreMyAttachmentsOnly is set, Drop all other objects as soon as we know our agent localID --- lib/classes/ObjectStoreFull.ts | 12 ++++++++++++ lib/classes/ObjectStoreLite.ts | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/classes/ObjectStoreFull.ts b/lib/classes/ObjectStoreFull.ts index 2ba3b03..0ca484c 100644 --- a/lib/classes/ObjectStoreFull.ts +++ b/lib/classes/ObjectStoreFull.ts @@ -127,6 +127,18 @@ export class ObjectStoreFull implements IObjectStore if (this.objects[localID].PCode === PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString()) { this.agent.localID = localID; + + if (this.options & BotOptionFlags.StoreMyAttachmentsOnly) + { + Object.keys(this.objectsByParent).forEach((objParentID: string) => + { + const parent = parseInt(objParentID, 10); + if (parent !== this.agent.localID) + { + this.deleteObject(parent); + } + }); + } } this.readExtraParams(objData.ExtraParams, 0, this.objects[localID]); diff --git a/lib/classes/ObjectStoreLite.ts b/lib/classes/ObjectStoreLite.ts index cbd16e3..e4e9a85 100644 --- a/lib/classes/ObjectStoreLite.ts +++ b/lib/classes/ObjectStoreLite.ts @@ -86,6 +86,18 @@ export class ObjectStoreLite implements IObjectStore if (objData.PCode === PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString()) { this.agent.localID = localID; + + if (this.options & BotOptionFlags.StoreMyAttachmentsOnly) + { + Object.keys(this.objectsByParent).forEach((objParentID: string) => + { + const parent = parseInt(objParentID, 10); + if (parent !== this.agent.localID) + { + this.deleteObject(parent); + } + }); + } } this.objectsByUUID[objData.FullID.toString()] = localID;