Remove debug

This commit is contained in:
Casper Warden
2017-12-14 02:38:21 +00:00
parent 2bd3b9a789
commit 56d3c8e5df
7 changed files with 47 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
import { UUID } from './UUID';
import { IGameObject } from './interfaces/IGameObject';
import { NameValue } from './NameValue';
import { PCode } from '../enums/PCode';
export declare class GameObjectLite implements IGameObject {
ID: number;
FullID: UUID;
@@ -10,6 +11,7 @@ export declare class GameObjectLite implements IGameObject {
NameValue: {
[key: string]: NameValue;
};
PCode: PCode;
constructor();
hasNameValueEntry(key: string): boolean;
getNameValueEntry(key: string): string;

View File

@@ -1 +1 @@
{"version":3,"file":"GameObjectLite.js","sourceRoot":"","sources":["../../lib/classes/GameObjectLite.ts"],"names":[],"mappings":";;AAIA;IAQI;QAEI,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC9B,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CACnC,CAAC;YACG,MAAM,CAAC,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CACnC,CAAC;YACG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC;QAChD,CAAC;QACD,MAAM,CAAC,EAAE,CAAC;IACd,CAAC;CACJ;AA9BD,wCA8BC"}
{"version":3,"file":"GameObjectLite.js","sourceRoot":"","sources":["../../lib/classes/GameObjectLite.ts"],"names":[],"mappings":";;AAKA;IASI;QAEI,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC9B,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CACnC,CAAC;YACG,MAAM,CAAC,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CACnC,CAAC;YACG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC;QAChD,CAAC;QACD,MAAM,CAAC,EAAE,CAAC;IACd,CAAC;CACJ;AA/BD,wCA+BC"}

View File

@@ -101,7 +101,24 @@ class ObjectStoreFull {
Object.keys(this.objectsByParent).forEach((objParentID) => {
const parent = parseInt(objParentID, 10);
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_1.PCode.Avatar) {
foundAvatars = true;
}
}
});
if (this.objects[parent]) {
const o = this.objects[parent];
if (o.PCode === PCode_1.PCode.Avatar) {
foundAvatars = true;
}
}
if (!foundAvatars) {
this.deleteObject(parent);
}
}
});
}
@@ -115,7 +132,7 @@ class ObjectStoreFull {
if (addToParentList) {
this.objectsByParent[parentID].push(localID);
}
if (this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
if (objData.PCode !== PCode_1.PCode.Avatar && this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
if (this.agent.localID !== 0 && obj.ParentID !== this.agent.localID) {
this.deleteObject(localID);
return;
@@ -204,7 +221,7 @@ class ObjectStoreFull {
}
o.ParentID = newParentID;
}
if (newObj && this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
if (pcode !== PCode_1.PCode.Avatar && newObj && this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
if (this.agent.localID !== 0 && o.ParentID !== this.agent.localID) {
this.deleteObject(localID);
return;

File diff suppressed because one or more lines are too long

View File

@@ -14,9 +14,6 @@ class ObjectStoreLite {
this.objects = {};
this.objectsByUUID = {};
this.objectsByParent = {};
setInterval(() => {
console.log("Objects in store: " + Object.keys(this.objects).length);
}, 5000);
agent.localID = 0;
this.options = options;
this.clientEvents = clientEvents;
@@ -56,6 +53,7 @@ class ObjectStoreLite {
obj.FullID = objData.FullID;
obj.ParentID = objData.ParentID;
obj.OwnerID = objData.OwnerID;
obj.PCode = objData.PCode;
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()) {
this.agent.localID = localID;
@@ -63,7 +61,24 @@ class ObjectStoreLite {
Object.keys(this.objectsByParent).forEach((objParentID) => {
const parent = parseInt(objParentID, 10);
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_1.PCode.Avatar) {
foundAvatars = true;
}
}
});
if (this.objects[parent]) {
const o = this.objects[parent];
if (o.PCode === PCode_1.PCode.Avatar) {
foundAvatars = true;
}
}
if (!foundAvatars) {
this.deleteObject(parent);
}
}
});
}
@@ -75,7 +90,7 @@ class ObjectStoreLite {
if (addToParentList) {
this.objectsByParent[parentID].push(localID);
}
if (this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
if (objData.PCode !== PCode_1.PCode.Avatar && this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
if (this.agent.localID !== 0 && obj.ParentID !== this.agent.localID) {
this.deleteObject(localID);
return;
@@ -118,6 +133,7 @@ class ObjectStoreLite {
}
const o = this.objects[localID];
o.ID = localID;
o.PCode = pcode;
this.objectsByUUID[fullID.toString()] = localID;
o.FullID = fullID;
pos++;
@@ -157,7 +173,7 @@ class ObjectStoreLite {
}
o.ParentID = newParentID;
}
if (newObj && this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
if (pcode !== PCode_1.PCode.Avatar && newObj && this.options & BotOptionFlags_1.BotOptionFlags.StoreMyAttachmentsOnly) {
if (this.agent.localID !== 0 && o.ParentID !== this.agent.localID) {
this.deleteObject(localID);
return;

File diff suppressed because one or more lines are too long

View File

@@ -32,10 +32,6 @@ export class ObjectStoreLite implements IObjectStore
constructor(circuit: Circuit, agent: Agent, clientEvents: ClientEvents, options: BotOptionFlags)
{
setInterval(() =>
{
console.log("Objects in store: " + Object.keys(this.objects).length);
}, 5000);
agent.localID = 0;
this.options = options;
this.clientEvents = clientEvents;