Refine the object culling a little so we don't lose avatar information
This commit is contained in:
2
dist/Bot.js.map
vendored
2
dist/Bot.js.map
vendored
File diff suppressed because one or more lines are too long
9
dist/classes/ObjectStoreFull.js
vendored
9
dist/classes/ObjectStoreFull.js
vendored
@@ -16,6 +16,7 @@ class ObjectStoreFull {
|
|||||||
this.objects = {};
|
this.objects = {};
|
||||||
this.objectsByUUID = {};
|
this.objectsByUUID = {};
|
||||||
this.objectsByParent = {};
|
this.objectsByParent = {};
|
||||||
|
agent.localID = 0;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.clientEvents = clientEvents;
|
this.clientEvents = clientEvents;
|
||||||
this.circuit = circuit;
|
this.circuit = circuit;
|
||||||
@@ -96,6 +97,14 @@ class ObjectStoreFull {
|
|||||||
obj.JointAxisOrAnchor = objData.JointAxisOrAnchor;
|
obj.JointAxisOrAnchor = objData.JointAxisOrAnchor;
|
||||||
if (this.objects[localID].PCode === PCode_1.PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString()) {
|
if (this.objects[localID].PCode === PCode_1.PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString()) {
|
||||||
this.agent.localID = localID;
|
this.agent.localID = localID;
|
||||||
|
if (this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
|
||||||
|
Object.keys(this.objectsByParent).forEach((objParentID) => {
|
||||||
|
const parent = parseInt(objParentID, 10);
|
||||||
|
if (parent !== this.agent.localID) {
|
||||||
|
this.deleteObject(parent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.readExtraParams(objData.ExtraParams, 0, this.objects[localID]);
|
this.readExtraParams(objData.ExtraParams, 0, this.objects[localID]);
|
||||||
this.objects[localID].NameValue = this.parseNameValues(Utils_1.Utils.BufferToStringSimple(objData.NameValue));
|
this.objects[localID].NameValue = this.parseNameValues(Utils_1.Utils.BufferToStringSimple(objData.NameValue));
|
||||||
|
|||||||
2
dist/classes/ObjectStoreFull.js.map
vendored
2
dist/classes/ObjectStoreFull.js.map
vendored
File diff suppressed because one or more lines are too long
12
dist/classes/ObjectStoreLite.js
vendored
12
dist/classes/ObjectStoreLite.js
vendored
@@ -14,6 +14,10 @@ class ObjectStoreLite {
|
|||||||
this.objects = {};
|
this.objects = {};
|
||||||
this.objectsByUUID = {};
|
this.objectsByUUID = {};
|
||||||
this.objectsByParent = {};
|
this.objectsByParent = {};
|
||||||
|
setInterval(() => {
|
||||||
|
console.log("Objects in store: " + Object.keys(this.objects).length);
|
||||||
|
}, 5000);
|
||||||
|
agent.localID = 0;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.clientEvents = clientEvents;
|
this.clientEvents = clientEvents;
|
||||||
this.circuit = circuit;
|
this.circuit = circuit;
|
||||||
@@ -55,6 +59,14 @@ class ObjectStoreLite {
|
|||||||
this.objects[localID].NameValue = this.parseNameValues(Utils_1.Utils.BufferToStringSimple(objData.NameValue));
|
this.objects[localID].NameValue = this.parseNameValues(Utils_1.Utils.BufferToStringSimple(objData.NameValue));
|
||||||
if (objData.PCode === PCode_1.PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString()) {
|
if (objData.PCode === PCode_1.PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString()) {
|
||||||
this.agent.localID = localID;
|
this.agent.localID = localID;
|
||||||
|
if (this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
|
||||||
|
Object.keys(this.objectsByParent).forEach((objParentID) => {
|
||||||
|
const parent = parseInt(objParentID, 10);
|
||||||
|
if (parent !== this.agent.localID) {
|
||||||
|
this.deleteObject(parent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.objectsByUUID[objData.FullID.toString()] = localID;
|
this.objectsByUUID[objData.FullID.toString()] = localID;
|
||||||
if (!this.objectsByParent[parentID]) {
|
if (!this.objectsByParent[parentID]) {
|
||||||
|
|||||||
2
dist/classes/ObjectStoreLite.js.map
vendored
2
dist/classes/ObjectStoreLite.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -35,7 +35,7 @@ export class Bot
|
|||||||
private ping: Timer | null = null;
|
private ping: Timer | null = null;
|
||||||
private pingNumber = 0;
|
private pingNumber = 0;
|
||||||
private lastSuccessfulPing = 0;
|
private lastSuccessfulPing = 0;
|
||||||
private circuitSubscription: Subscription | null = null
|
private circuitSubscription: Subscription | null = null;
|
||||||
private options: BotOptionFlags;
|
private options: BotOptionFlags;
|
||||||
public clientEvents: ClientEvents;
|
public clientEvents: ClientEvents;
|
||||||
public clientCommands: ClientCommands;
|
public clientCommands: ClientCommands;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {UUID} from './UUID';
|
import {UUID} from './UUID';
|
||||||
import {IGameObject} from './interfaces/IGameObject';
|
import {IGameObject} from './interfaces/IGameObject';
|
||||||
import {NameValue} from './NameValue';
|
import {NameValue} from './NameValue';
|
||||||
|
import {PCode} from '../enums/PCode';
|
||||||
|
|
||||||
export class GameObjectLite implements IGameObject
|
export class GameObjectLite implements IGameObject
|
||||||
{
|
{
|
||||||
@@ -10,6 +11,7 @@ export class GameObjectLite implements IGameObject
|
|||||||
OwnerID: UUID;
|
OwnerID: UUID;
|
||||||
IsAttachment: boolean;
|
IsAttachment: boolean;
|
||||||
NameValue: {[key: string]: NameValue};
|
NameValue: {[key: string]: NameValue};
|
||||||
|
PCode: PCode;
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
this.IsAttachment = false;
|
this.IsAttachment = false;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export class ObjectStoreFull implements IObjectStore
|
|||||||
|
|
||||||
constructor(circuit: Circuit, agent: Agent, clientEvents: ClientEvents, options: BotOptionFlags)
|
constructor(circuit: Circuit, agent: Agent, clientEvents: ClientEvents, options: BotOptionFlags)
|
||||||
{
|
{
|
||||||
this.agent.localID = 0;
|
agent.localID = 0;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.clientEvents = clientEvents;
|
this.clientEvents = clientEvents;
|
||||||
this.circuit = circuit;
|
this.circuit = circuit;
|
||||||
@@ -136,7 +136,30 @@ export class ObjectStoreFull implements IObjectStore
|
|||||||
const parent = parseInt(objParentID, 10);
|
const parent = parseInt(objParentID, 10);
|
||||||
if (parent !== this.agent.localID)
|
if (parent !== this.agent.localID)
|
||||||
{
|
{
|
||||||
this.deleteObject(parent);
|
let foundAvatars = false;
|
||||||
|
this.objectsByParent[parent].forEach((objID) =>
|
||||||
|
{
|
||||||
|
if (this.objects[objID])
|
||||||
|
{
|
||||||
|
const o = this.objects[objID];
|
||||||
|
if (o.PCode === PCode.Avatar)
|
||||||
|
{
|
||||||
|
foundAvatars = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (this.objects[parent])
|
||||||
|
{
|
||||||
|
const o = this.objects[parent];
|
||||||
|
if (o.PCode === PCode.Avatar)
|
||||||
|
{
|
||||||
|
foundAvatars = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!foundAvatars)
|
||||||
|
{
|
||||||
|
this.deleteObject(parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -155,7 +178,7 @@ export class ObjectStoreFull implements IObjectStore
|
|||||||
this.objectsByParent[parentID].push(localID);
|
this.objectsByParent[parentID].push(localID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.options & BotOptionFlags.StoreMyAttachmentsOnly)
|
if (objData.PCode !== PCode.Avatar && this.options & BotOptionFlags.StoreMyAttachmentsOnly)
|
||||||
{
|
{
|
||||||
if (this.agent.localID !== 0 && obj.ParentID !== this.agent.localID)
|
if (this.agent.localID !== 0 && obj.ParentID !== this.agent.localID)
|
||||||
{
|
{
|
||||||
@@ -260,7 +283,7 @@ export class ObjectStoreFull implements IObjectStore
|
|||||||
}
|
}
|
||||||
o.ParentID = newParentID;
|
o.ParentID = newParentID;
|
||||||
}
|
}
|
||||||
if (newObj && this.options & BotOptionFlags.StoreMyAttachmentsOnly)
|
if (pcode !== PCode.Avatar && newObj && this.options & BotOptionFlags.StoreMyAttachmentsOnly)
|
||||||
{
|
{
|
||||||
if (this.agent.localID !== 0 && o.ParentID !== this.agent.localID)
|
if (this.agent.localID !== 0 && o.ParentID !== this.agent.localID)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ export class ObjectStoreLite implements IObjectStore
|
|||||||
|
|
||||||
constructor(circuit: Circuit, agent: Agent, clientEvents: ClientEvents, options: BotOptionFlags)
|
constructor(circuit: Circuit, agent: Agent, clientEvents: ClientEvents, options: BotOptionFlags)
|
||||||
{
|
{
|
||||||
this.agent.localID = 0;
|
setInterval(() =>
|
||||||
|
{
|
||||||
|
console.log("Objects in store: " + Object.keys(this.objects).length);
|
||||||
|
}, 5000);
|
||||||
|
agent.localID = 0;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.clientEvents = clientEvents;
|
this.clientEvents = clientEvents;
|
||||||
this.circuit = circuit;
|
this.circuit = circuit;
|
||||||
@@ -81,6 +85,7 @@ export class ObjectStoreLite implements IObjectStore
|
|||||||
obj.FullID = objData.FullID;
|
obj.FullID = objData.FullID;
|
||||||
obj.ParentID = objData.ParentID;
|
obj.ParentID = objData.ParentID;
|
||||||
obj.OwnerID = objData.OwnerID;
|
obj.OwnerID = objData.OwnerID;
|
||||||
|
obj.PCode = objData.PCode;
|
||||||
|
|
||||||
this.objects[localID].NameValue = this.parseNameValues(Utils.BufferToStringSimple(objData.NameValue));
|
this.objects[localID].NameValue = this.parseNameValues(Utils.BufferToStringSimple(objData.NameValue));
|
||||||
|
|
||||||
@@ -95,7 +100,30 @@ export class ObjectStoreLite implements IObjectStore
|
|||||||
const parent = parseInt(objParentID, 10);
|
const parent = parseInt(objParentID, 10);
|
||||||
if (parent !== this.agent.localID)
|
if (parent !== this.agent.localID)
|
||||||
{
|
{
|
||||||
this.deleteObject(parent);
|
let foundAvatars = false;
|
||||||
|
this.objectsByParent[parent].forEach((objID) =>
|
||||||
|
{
|
||||||
|
if (this.objects[objID])
|
||||||
|
{
|
||||||
|
const o = this.objects[objID];
|
||||||
|
if (o.PCode === PCode.Avatar)
|
||||||
|
{
|
||||||
|
foundAvatars = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (this.objects[parent])
|
||||||
|
{
|
||||||
|
const o = this.objects[parent];
|
||||||
|
if (o.PCode === PCode.Avatar)
|
||||||
|
{
|
||||||
|
foundAvatars = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!foundAvatars)
|
||||||
|
{
|
||||||
|
this.deleteObject(parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -111,7 +139,7 @@ export class ObjectStoreLite implements IObjectStore
|
|||||||
this.objectsByParent[parentID].push(localID);
|
this.objectsByParent[parentID].push(localID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.options & BotOptionFlags.StoreMyAttachmentsOnly)
|
if (objData.PCode !== PCode.Avatar && this.options & BotOptionFlags.StoreMyAttachmentsOnly)
|
||||||
{
|
{
|
||||||
if (this.agent.localID !== 0 && obj.ParentID !== this.agent.localID)
|
if (this.agent.localID !== 0 && obj.ParentID !== this.agent.localID)
|
||||||
{
|
{
|
||||||
@@ -161,6 +189,7 @@ export class ObjectStoreLite implements IObjectStore
|
|||||||
}
|
}
|
||||||
const o = this.objects[localID];
|
const o = this.objects[localID];
|
||||||
o.ID = localID;
|
o.ID = localID;
|
||||||
|
o.PCode = pcode;
|
||||||
this.objectsByUUID[fullID.toString()] = localID;
|
this.objectsByUUID[fullID.toString()] = localID;
|
||||||
o.FullID = fullID;
|
o.FullID = fullID;
|
||||||
|
|
||||||
@@ -215,7 +244,7 @@ export class ObjectStoreLite implements IObjectStore
|
|||||||
}
|
}
|
||||||
o.ParentID = newParentID;
|
o.ParentID = newParentID;
|
||||||
}
|
}
|
||||||
if (newObj && this.options & BotOptionFlags.StoreMyAttachmentsOnly)
|
if (pcode !== PCode.Avatar && newObj && this.options & BotOptionFlags.StoreMyAttachmentsOnly)
|
||||||
{
|
{
|
||||||
if (this.agent.localID !== 0 && o.ParentID !== this.agent.localID)
|
if (this.agent.localID !== 0 && o.ParentID !== this.agent.localID)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user