- Add grabObject, deGrabObject, dragGrabbedObject, touchObject to RegionCommands (closes #8)
- Properly decode object TextureEntry - Properly decode object ParticleSystem - Properly decode object ObjectData - Properly decode object TextColor - Properly decode Linden Tree species - Correct handling of ObjectUpdateCached (only request objects if we don't already have them) - Implement handling of ImprovedTerseObjectUpdate to complete support for R-Tree object searching - Object store interface: getObjectByUUID, getObjectByLocalID
This commit is contained in:
10
dist/classes/Color4.d.ts
vendored
Normal file
10
dist/classes/Color4.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/// <reference types="node" />
|
||||
export declare class Color4 {
|
||||
red: number | Buffer;
|
||||
green: number;
|
||||
blue: number | boolean;
|
||||
alpha: number | boolean;
|
||||
static black: Color4;
|
||||
static white: Color4;
|
||||
constructor(red: number | Buffer, green: number, blue: number | boolean, alpha?: number | boolean);
|
||||
}
|
||||
43
dist/classes/Color4.js
vendored
Normal file
43
dist/classes/Color4.js
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class Color4 {
|
||||
constructor(red, green, blue, alpha = 0) {
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
this.alpha = alpha;
|
||||
if (red instanceof Buffer && typeof blue === 'boolean') {
|
||||
const buf = red;
|
||||
const pos = green;
|
||||
const inverted = blue;
|
||||
let alphaInverted = false;
|
||||
if (typeof alpha === 'boolean' && alpha === true) {
|
||||
alphaInverted = true;
|
||||
}
|
||||
this.red = 0.0;
|
||||
this.green = 0.0;
|
||||
this.blue = 0.0;
|
||||
this.alpha = 0.0;
|
||||
const quanta = 1.0 / 255.0;
|
||||
if (inverted) {
|
||||
this.red = (255 - buf[pos]) * quanta;
|
||||
this.green = (255 - buf[pos + 1]) * quanta;
|
||||
this.blue = (255 - buf[pos + 2]) * quanta;
|
||||
this.alpha = (255 - buf[pos + 3]) * quanta;
|
||||
}
|
||||
else {
|
||||
this.red = buf[pos] * quanta;
|
||||
this.green = buf[pos + 1] * quanta;
|
||||
this.blue = buf[pos + 2] * quanta;
|
||||
this.alpha = buf[pos + 3] * quanta;
|
||||
}
|
||||
if (alphaInverted) {
|
||||
this.alpha = 1.0 - this.alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Color4.black = new Color4(0.0, 0.0, 0.0, 1.0);
|
||||
Color4.white = new Color4(1.0, 1.0, 1.0, 1.0);
|
||||
exports.Color4 = Color4;
|
||||
//# sourceMappingURL=Color4.js.map
|
||||
1
dist/classes/Color4.js.map
vendored
Normal file
1
dist/classes/Color4.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Color4.js","sourceRoot":"","sources":["../../lib/classes/Color4.ts"],"names":[],"mappings":";;AAAA,MAAa,MAAM;IAKf,YAAmB,GAAoB,EAAS,KAAa,EAAS,IAAsB,EAAS,QAA0B,CAAC;QAA7G,QAAG,GAAH,GAAG,CAAiB;QAAS,UAAK,GAAL,KAAK,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAkB;QAAS,UAAK,GAAL,KAAK,CAAsB;QAE5H,IAAI,GAAG,YAAY,MAAM,IAAI,OAAO,IAAI,KAAK,SAAS,EACtD;YACI,MAAM,GAAG,GAAG,GAAG,CAAC;YAChB,MAAM,GAAG,GAAG,KAAK,CAAC;YAClB,MAAM,QAAQ,GAAG,IAAI,CAAC;YACtB,IAAI,aAAa,GAAG,KAAK,CAAC;YAC1B,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAChD;gBACI,aAAa,GAAG,IAAI,CAAC;aACxB;YAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;YACf,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;YACjB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;YAEjB,MAAM,MAAM,GAAW,GAAG,GAAG,KAAK,CAAC;YACnC,IAAI,QAAQ,EACZ;gBACI,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;gBACrC,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;gBAC3C,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;gBAC1C,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;aAC9C;iBAED;gBACI,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;gBAC7B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;gBACnC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;gBAClC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;aACtC;YACD,IAAI,aAAa,EACjB;gBACI,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;aACjC;SACJ;IACL,CAAC;;AAzCM,YAAK,GAAW,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC/C,YAAK,GAAW,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAH1D,wBA4CC"}
|
||||
12
dist/classes/GameObjectFull.d.ts
vendored
12
dist/classes/GameObjectFull.d.ts
vendored
@@ -8,6 +8,10 @@ import { NameValue } from './NameValue';
|
||||
import { IGameObject } from './interfaces/IGameObject';
|
||||
import { SoundFlags } from '..';
|
||||
import { ITreeBoundingBox } from './interfaces/ITreeBoundingBox';
|
||||
import { Vector4 } from './Vector4';
|
||||
import { TextureEntry } from './TextureEntry';
|
||||
import { Color4 } from './Color4';
|
||||
import { ParticleSystem } from './ParticleSystem';
|
||||
export declare class GameObjectFull implements IGameObject {
|
||||
rtreeEntry?: ITreeBoundingBox;
|
||||
ID: number;
|
||||
@@ -40,11 +44,11 @@ export declare class GameObjectFull implements IGameObject {
|
||||
ProfileBegin: number;
|
||||
ProfileEnd: number;
|
||||
ProfileHollow: number;
|
||||
TextureEntry: Buffer;
|
||||
TextureEntry: TextureEntry;
|
||||
TextureAnim: Buffer;
|
||||
Data: Buffer;
|
||||
Text: string;
|
||||
TextColor: Buffer;
|
||||
TextColor: Color4;
|
||||
MediaURL: string;
|
||||
PSBlock: Buffer;
|
||||
OwnerID: UUID;
|
||||
@@ -53,6 +57,9 @@ export declare class GameObjectFull implements IGameObject {
|
||||
JointAxisOrAnchor: Vector3;
|
||||
Position: Vector3;
|
||||
Rotation: Quaternion;
|
||||
CollisionPlane: Vector4;
|
||||
Velocity: Vector3;
|
||||
Acceleration: Vector3;
|
||||
AngularVelocity: Vector3;
|
||||
TreeSpecies: Tree;
|
||||
Sound: UUID;
|
||||
@@ -63,6 +70,7 @@ export declare class GameObjectFull implements IGameObject {
|
||||
NameValue: {
|
||||
[key: string]: NameValue;
|
||||
};
|
||||
Particles: ParticleSystem;
|
||||
constructor();
|
||||
hasNameValueEntry(key: string): boolean;
|
||||
getNameValueEntry(key: string): string;
|
||||
|
||||
2
dist/classes/GameObjectFull.js.map
vendored
2
dist/classes/GameObjectFull.js.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"GameObjectFull.js","sourceRoot":"","sources":["../../lib/classes/GameObjectFull.ts"],"names":[],"mappings":";;AAAA,uCAAkC;AAGlC,6CAAwC;AAOxC,MAAa,cAAc;IAsDvB;QAEI,IAAI,CAAC,QAAQ,GAAG,iBAAO,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AI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,IAAI,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAClC;YACI,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,IAAI,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAClC;YACI,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC;SAC/C;QACD,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AAzFD,wCAyFC"}
|
||||
3
dist/classes/ObjectStoreFull.d.ts
vendored
3
dist/classes/ObjectStoreFull.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
/// <reference types="node" />
|
||||
import { Circuit } from './Circuit';
|
||||
import { Agent } from './Agent';
|
||||
import { UUID } from './UUID';
|
||||
import { NameValue } from './NameValue';
|
||||
import { ClientEvents } from './ClientEvents';
|
||||
import { IObjectStore } from './interfaces/IObjectStore';
|
||||
@@ -22,6 +23,8 @@ export declare class ObjectStoreFull implements IObjectStore {
|
||||
deleteObject(objectID: number): void;
|
||||
readExtraParams(buf: Buffer, pos: number, o: GameObjectFull): number;
|
||||
getObjectsByParent(parentID: number): IGameObject[];
|
||||
getObjectByUUID(fullID: UUID | string): IGameObject;
|
||||
getObjectByLocalID(localID: number): IGameObject;
|
||||
parseNameValues(str: string): {
|
||||
[key: string]: NameValue;
|
||||
};
|
||||
|
||||
226
dist/classes/ObjectStoreFull.js
vendored
226
dist/classes/ObjectStoreFull.js
vendored
@@ -11,6 +11,10 @@ const NameValue_1 = require("./NameValue");
|
||||
const GameObjectFull_1 = require("./GameObjectFull");
|
||||
const __1 = require("..");
|
||||
const dist_1 = require("rbush-3d/dist");
|
||||
const Vector4_1 = require("./Vector4");
|
||||
const TextureEntry_1 = require("./TextureEntry");
|
||||
const Color4_1 = require("./Color4");
|
||||
const ParticleSystem_1 = require("./ParticleSystem");
|
||||
class ObjectStoreFull {
|
||||
constructor(circuit, agent, clientEvents, options) {
|
||||
this.objects = {};
|
||||
@@ -61,6 +65,89 @@ class ObjectStoreFull {
|
||||
obj.ClickAction = objData.ClickAction;
|
||||
obj.Scale = objData.Scale;
|
||||
obj.ObjectData = objData.ObjectData;
|
||||
const data = objData.ObjectData;
|
||||
let dataPos = 0;
|
||||
switch (data.length) {
|
||||
case 76:
|
||||
obj.CollisionPlane = new Vector4_1.Vector4(objData.ObjectData, dataPos);
|
||||
dataPos += 16;
|
||||
case 60:
|
||||
obj.Position = new Vector3_1.Vector3(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
obj.Velocity = new Vector3_1.Vector3(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
obj.Acceleration = new Vector3_1.Vector3(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
obj.Rotation = new Quaternion_1.Quaternion(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
obj.AngularVelocity = new Vector3_1.Vector3(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
break;
|
||||
case 48:
|
||||
obj.CollisionPlane = new Vector4_1.Vector4(objData.ObjectData, dataPos);
|
||||
dataPos += 16;
|
||||
case 32:
|
||||
obj.Position = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -0.5 * 256.0, 1.5 * 256.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -0.5 * 256.0, 1.5 * 256.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -256.0, 3.0 * 256.0)
|
||||
]);
|
||||
dataPos += 6;
|
||||
obj.Velocity = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -256.0, 256.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
||||
]);
|
||||
dataPos += 6;
|
||||
obj.Acceleration = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -256.0, 256.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
||||
]);
|
||||
dataPos += 6;
|
||||
obj.Rotation = new Quaternion_1.Quaternion([
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -1.0, 1.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -1.0, 1.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -1.0, 1.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -1.0, 1.0)
|
||||
]);
|
||||
dataPos += 8;
|
||||
obj.AngularVelocity = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -256.0, 256.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
||||
]);
|
||||
dataPos += 6;
|
||||
break;
|
||||
case 16:
|
||||
obj.Position = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0)
|
||||
]);
|
||||
obj.Velocity = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0)
|
||||
]);
|
||||
obj.Acceleration = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0)
|
||||
]);
|
||||
obj.Rotation = new Quaternion_1.Quaternion([
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -1.0, 1.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -1.0, 1.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -1.0, 1.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -1.0, 1.0)
|
||||
]);
|
||||
obj.AngularVelocity = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils_1.Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0)
|
||||
]);
|
||||
break;
|
||||
}
|
||||
obj.ParentID = objData.ParentID;
|
||||
obj.Flags = objData.UpdateFlags;
|
||||
obj.PathCurve = objData.PathCurve;
|
||||
@@ -81,11 +168,11 @@ class ObjectStoreFull {
|
||||
obj.ProfileBegin = objData.ProfileBegin;
|
||||
obj.ProfileEnd = objData.ProfileEnd;
|
||||
obj.ProfileHollow = objData.ProfileHollow;
|
||||
obj.TextureEntry = objData.TextureEntry;
|
||||
obj.TextureEntry = new TextureEntry_1.TextureEntry(objData.TextureEntry);
|
||||
obj.TextureAnim = objData.TextureAnim;
|
||||
obj.Data = objData.Data;
|
||||
const pcodeData = objData.Data;
|
||||
obj.Text = Utils_1.Utils.BufferToStringSimple(objData.Text);
|
||||
obj.TextColor = objData.TextColor;
|
||||
obj.TextColor = new Color4_1.Color4(objData.TextColor, 0, false, true);
|
||||
obj.MediaURL = Utils_1.Utils.BufferToStringSimple(objData.MediaURL);
|
||||
obj.PSBlock = objData.PSBlock;
|
||||
obj.Sound = objData.Sound;
|
||||
@@ -96,6 +183,15 @@ class ObjectStoreFull {
|
||||
obj.JointType = objData.JointType;
|
||||
obj.JointPivot = objData.JointPivot;
|
||||
obj.JointAxisOrAnchor = objData.JointAxisOrAnchor;
|
||||
switch (obj.PCode) {
|
||||
case PCode_1.PCode.Grass:
|
||||
case PCode_1.PCode.Tree:
|
||||
case PCode_1.PCode.NewTree:
|
||||
if (pcodeData.length === 1) {
|
||||
obj.TreeSpecies = pcodeData[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (this.objects[localID].PCode === PCode_1.PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString()) {
|
||||
this.agent.localID = localID;
|
||||
if (this.options & __1.BotOptionFlags.StoreMyAttachmentsOnly) {
|
||||
@@ -142,21 +238,27 @@ class ObjectStoreFull {
|
||||
}
|
||||
break;
|
||||
case Message_1.Message.ObjectUpdateCached:
|
||||
const objectUpdateCached = packet.message;
|
||||
const rmo = new RequestMultipleObjects_1.RequestMultipleObjectsMessage();
|
||||
rmo.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
rmo.ObjectData = [];
|
||||
objectUpdateCached.ObjectData.forEach((obj) => {
|
||||
rmo.ObjectData.push({
|
||||
CacheMissType: 0,
|
||||
ID: obj.ID
|
||||
});
|
||||
});
|
||||
circuit.sendMessage(rmo, 0);
|
||||
break;
|
||||
{
|
||||
const objectUpdateCached = packet.message;
|
||||
const rmo = new RequestMultipleObjects_1.RequestMultipleObjectsMessage();
|
||||
rmo.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
rmo.ObjectData = [];
|
||||
for (const obj of objectUpdateCached.ObjectData) {
|
||||
if (!this.objects[obj.ID]) {
|
||||
rmo.ObjectData.push({
|
||||
CacheMissType: 0,
|
||||
ID: obj.ID
|
||||
});
|
||||
}
|
||||
}
|
||||
if (rmo.ObjectData.length > 0) {
|
||||
circuit.sendMessage(rmo, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Message_1.Message.ObjectUpdateCompressed:
|
||||
{
|
||||
const objectUpdateCompressed = packet.message;
|
||||
@@ -239,7 +341,7 @@ class ObjectStoreFull {
|
||||
const result = Utils_1.Utils.BufferToString(buf, pos);
|
||||
pos += result.readLength;
|
||||
o.Text = result.result;
|
||||
o.TextColor = buf.slice(pos, pos + 4);
|
||||
o.TextColor = new Color4_1.Color4(buf, pos, false, true);
|
||||
pos = pos + 4;
|
||||
}
|
||||
else {
|
||||
@@ -251,6 +353,7 @@ class ObjectStoreFull {
|
||||
o.MediaURL = result.result;
|
||||
}
|
||||
if (compressedflags & __1.CompressedFlags.HasParticles) {
|
||||
o.Particles = new ParticleSystem_1.ParticleSystem(buf.slice(pos, pos + 86), 0);
|
||||
pos += 86;
|
||||
}
|
||||
pos = this.readExtraParams(buf, pos, o);
|
||||
@@ -293,6 +396,7 @@ class ObjectStoreFull {
|
||||
pos = pos + 2;
|
||||
const textureEntryLength = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
o.TextureEntry = new TextureEntry_1.TextureEntry(buf.slice(pos, pos + textureEntryLength));
|
||||
pos = pos + textureEntryLength;
|
||||
if (compressedflags & __1.CompressedFlags.TextureAnimation) {
|
||||
pos = pos + 4;
|
||||
@@ -304,8 +408,72 @@ class ObjectStoreFull {
|
||||
break;
|
||||
}
|
||||
case Message_1.Message.ImprovedTerseObjectUpdate:
|
||||
const objectUpdateTerse = packet.message;
|
||||
break;
|
||||
{
|
||||
const objectUpdateTerse = packet.message;
|
||||
const dilation = objectUpdateTerse.RegionData.TimeDilation / 65535.0;
|
||||
for (let i = 0; i < objectUpdateTerse.ObjectData.length; i++) {
|
||||
const objectData = objectUpdateTerse.ObjectData[i];
|
||||
if (!(this.options & __1.BotOptionFlags.StoreMyAttachmentsOnly)) {
|
||||
let pos = 0;
|
||||
const localID = objectData.Data.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
if (this.objects[localID]) {
|
||||
this.objects[localID].State = objectData.Data.readUInt8(pos++);
|
||||
const avatar = (objectData.Data.readUInt8(pos++) !== 0);
|
||||
if (avatar) {
|
||||
this.objects[localID].CollisionPlane = new Vector4_1.Vector4(objectData.Data, pos);
|
||||
pos += 16;
|
||||
}
|
||||
this.objects[localID].Position = new Vector3_1.Vector3(objectData.Data, pos);
|
||||
pos += 12;
|
||||
this.objects[localID].Velocity = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos), -128.0, 128.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 2), -128.0, 128.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 4), -128.0, 128.0)
|
||||
]);
|
||||
pos += 6;
|
||||
this.objects[localID].Acceleration = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos), -64.0, 64.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 2), -64.0, 64.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 4), -64.0, 64.0)
|
||||
]);
|
||||
pos += 6;
|
||||
this.objects[localID].Rotation = new Quaternion_1.Quaternion([
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos), -1.0, 1.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 2), -1.0, 1.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 4), -1.0, 1.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 6), -1.0, 1.0)
|
||||
]);
|
||||
pos += 8;
|
||||
this.objects[localID].AngularVelocity = new Vector3_1.Vector3([
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos), -64.0, 64.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 2), -64.0, 64.0),
|
||||
Utils_1.Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 4), -64.0, 64.0)
|
||||
]);
|
||||
pos += 6;
|
||||
if (objectData.TextureEntry.length > 0) {
|
||||
this.objects[localID].TextureEntry = new TextureEntry_1.TextureEntry(objectData.TextureEntry.slice(4));
|
||||
}
|
||||
this.insertIntoRtree(this.objects[localID]);
|
||||
}
|
||||
else {
|
||||
console.log('Received terse update for object ' + localID + ' which is not in the store, so requesting the object');
|
||||
const rmo = new RequestMultipleObjects_1.RequestMultipleObjectsMessage();
|
||||
rmo.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
rmo.ObjectData = [];
|
||||
rmo.ObjectData.push({
|
||||
CacheMissType: 0,
|
||||
ID: localID
|
||||
});
|
||||
circuit.sendMessage(rmo, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Message_1.Message.MultipleObjectUpdate:
|
||||
const multipleObjectUpdate = packet.message;
|
||||
console.error('TODO: MultipleObjectUpdate');
|
||||
@@ -388,6 +556,22 @@ class ObjectStoreFull {
|
||||
});
|
||||
return result;
|
||||
}
|
||||
getObjectByUUID(fullID) {
|
||||
if (fullID instanceof UUID_1.UUID) {
|
||||
fullID = fullID.toString();
|
||||
}
|
||||
if (!this.objectsByUUID[fullID]) {
|
||||
throw new Error('No object found with that UUID');
|
||||
}
|
||||
const localID = this.objectsByUUID[fullID];
|
||||
return this.objects[localID];
|
||||
}
|
||||
getObjectByLocalID(localID) {
|
||||
if (!this.objects[localID]) {
|
||||
throw new Error('No object found with that UUID');
|
||||
}
|
||||
return this.objects[localID];
|
||||
}
|
||||
parseNameValues(str) {
|
||||
const nv = {};
|
||||
const lines = str.split('\n');
|
||||
|
||||
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
4
dist/classes/ObjectStoreLite.d.ts
vendored
4
dist/classes/ObjectStoreLite.d.ts
vendored
@@ -1,11 +1,13 @@
|
||||
/// <reference types="node" />
|
||||
import { Circuit } from './Circuit';
|
||||
import { Agent } from './Agent';
|
||||
import { UUID } from './UUID';
|
||||
import { ClientEvents } from './ClientEvents';
|
||||
import { IObjectStore } from './interfaces/IObjectStore';
|
||||
import { GameObjectLite } from './GameObjectLite';
|
||||
import { NameValue } from './NameValue';
|
||||
import { BotOptionFlags } from '..';
|
||||
import { IGameObject } from './interfaces/IGameObject';
|
||||
import { GameObjectFull } from './GameObjectFull';
|
||||
export declare class ObjectStoreLite implements IObjectStore {
|
||||
private circuit;
|
||||
@@ -24,4 +26,6 @@ export declare class ObjectStoreLite implements IObjectStore {
|
||||
};
|
||||
shutdown(): void;
|
||||
getObjectsInArea(minX: number, maxX: number, minY: number, maxY: number, minZ: number, maxZ: number): GameObjectFull[];
|
||||
getObjectByUUID(fullID: UUID | string): IGameObject;
|
||||
getObjectByLocalID(localID: number): IGameObject;
|
||||
}
|
||||
|
||||
16
dist/classes/ObjectStoreLite.js
vendored
16
dist/classes/ObjectStoreLite.js
vendored
@@ -328,6 +328,22 @@ class ObjectStoreLite {
|
||||
getObjectsInArea(minX, maxX, minY, maxY, minZ, maxZ) {
|
||||
throw new Error('GetObjectsInArea not available with the Lite object store.');
|
||||
}
|
||||
getObjectByUUID(fullID) {
|
||||
if (fullID instanceof UUID_1.UUID) {
|
||||
fullID = fullID.toString();
|
||||
}
|
||||
if (!this.objectsByUUID[fullID]) {
|
||||
throw new Error('No object found with that UUID');
|
||||
}
|
||||
const localID = this.objectsByUUID[fullID];
|
||||
return this.objects[localID];
|
||||
}
|
||||
getObjectByLocalID(localID) {
|
||||
if (!this.objects[localID]) {
|
||||
throw new Error('No object found with that UUID');
|
||||
}
|
||||
return this.objects[localID];
|
||||
}
|
||||
}
|
||||
exports.ObjectStoreLite = ObjectStoreLite;
|
||||
//# sourceMappingURL=ObjectStoreLite.js.map
|
||||
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
41
dist/classes/ParticleSystem.d.ts
vendored
Normal file
41
dist/classes/ParticleSystem.d.ts
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/// <reference types="node" />
|
||||
import { BlendFunc } from '../enums/BlendFunc';
|
||||
import { SourcePattern } from '../enums/SourcePattern';
|
||||
import { Vector3 } from './Vector3';
|
||||
import { UUID } from './UUID';
|
||||
import { ParticleDataFlags } from '../enums/ParticleDataFlags';
|
||||
import { Color4 } from './Color4';
|
||||
export declare class ParticleSystem {
|
||||
startGlow: number;
|
||||
endGlow: number;
|
||||
blendFuncSource: BlendFunc;
|
||||
blendFuncDest: BlendFunc;
|
||||
crc: number;
|
||||
pattern: SourcePattern;
|
||||
maxAge: number;
|
||||
startAge: number;
|
||||
innerAngle: number;
|
||||
outerAngle: number;
|
||||
burstRate: number;
|
||||
burstRadius: number;
|
||||
burstSpeedMin: number;
|
||||
burstSpeedMax: number;
|
||||
burstPartCount: number;
|
||||
angularVelocity: Vector3;
|
||||
acceleration: Vector3;
|
||||
texture: UUID;
|
||||
target: UUID;
|
||||
dataFlags: ParticleDataFlags;
|
||||
partMaxAge: number;
|
||||
startColor: Color4;
|
||||
endColor: Color4;
|
||||
startScaleX: number;
|
||||
startScaleY: number;
|
||||
endScaleX: number;
|
||||
endScaleY: number;
|
||||
flags: number;
|
||||
static unpackFixed(buf: Buffer, pos: number, signed: boolean, intBits: number, fracBits: number): number;
|
||||
constructor(buf: Buffer, pos: number);
|
||||
unpackSystem(buf: Buffer, pos: number): number;
|
||||
unpackLegacyData(buf: Buffer, pos: number): number;
|
||||
}
|
||||
153
dist/classes/ParticleSystem.js
vendored
Normal file
153
dist/classes/ParticleSystem.js
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const BlendFunc_1 = require("../enums/BlendFunc");
|
||||
const SourcePattern_1 = require("../enums/SourcePattern");
|
||||
const Vector3_1 = require("./Vector3");
|
||||
const UUID_1 = require("./UUID");
|
||||
const ParticleDataFlags_1 = require("../enums/ParticleDataFlags");
|
||||
const Color4_1 = require("./Color4");
|
||||
class ParticleSystem {
|
||||
constructor(buf, pos) {
|
||||
this.startGlow = 0.0;
|
||||
this.endGlow = 0.0;
|
||||
this.blendFuncSource = BlendFunc_1.BlendFunc.SourceAlpha;
|
||||
this.blendFuncDest = BlendFunc_1.BlendFunc.OneMinusSourceAlpha;
|
||||
this.crc = 0;
|
||||
this.pattern = SourcePattern_1.SourcePattern.None;
|
||||
this.maxAge = 0.0;
|
||||
this.startAge = 0.0;
|
||||
this.innerAngle = 0.0;
|
||||
this.outerAngle = 0.0;
|
||||
this.burstRate = 0.0;
|
||||
this.burstRadius = 0.0;
|
||||
this.burstSpeedMin = 0.0;
|
||||
this.burstSpeedMax = 0.0;
|
||||
this.burstPartCount = 0;
|
||||
this.angularVelocity = Vector3_1.Vector3.getZero();
|
||||
this.acceleration = Vector3_1.Vector3.getZero();
|
||||
this.texture = UUID_1.UUID.zero();
|
||||
this.target = UUID_1.UUID.zero();
|
||||
this.dataFlags = ParticleDataFlags_1.ParticleDataFlags.None;
|
||||
this.partMaxAge = 0.0;
|
||||
this.startColor = Color4_1.Color4.black;
|
||||
this.endColor = Color4_1.Color4.black;
|
||||
this.startScaleX = 0.0;
|
||||
this.startScaleY = 0.0;
|
||||
this.endScaleX = 0.0;
|
||||
this.endScaleY = 0.0;
|
||||
this.flags = 0;
|
||||
const size = buf.length - pos;
|
||||
if (size === 86) {
|
||||
pos = this.unpackSystem(buf, pos);
|
||||
pos = this.unpackLegacyData(buf, pos);
|
||||
}
|
||||
else if (size > 86 && size <= 98) {
|
||||
const sysSize = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
if (sysSize !== 68) {
|
||||
console.error('Particle system block size ' + sysSize + ' different from expected 68 bytes');
|
||||
return;
|
||||
}
|
||||
pos = this.unpackSystem(buf, pos);
|
||||
const dataSize = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
pos = this.unpackLegacyData(buf, pos);
|
||||
if ((this.dataFlags & ParticleDataFlags_1.ParticleDataFlags.DataGlow) === ParticleDataFlags_1.ParticleDataFlags.DataGlow) {
|
||||
let glow = buf.readUInt8(pos++);
|
||||
this.startGlow = glow / 255.0;
|
||||
glow = buf.readUInt8(pos++);
|
||||
this.endGlow = glow / 255.0;
|
||||
}
|
||||
if ((this.dataFlags & ParticleDataFlags_1.ParticleDataFlags.DataBlend) === ParticleDataFlags_1.ParticleDataFlags.DataBlend) {
|
||||
this.blendFuncSource = buf.readUInt8(pos++);
|
||||
this.blendFuncDest = buf.readUInt8(pos++);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.error('WARNING: Paricle system size of ' + size + ' bytes exceeds maximum block size of 98');
|
||||
}
|
||||
}
|
||||
static unpackFixed(buf, pos, signed, intBits, fracBits) {
|
||||
let totalBits = intBits + fracBits;
|
||||
let fixedVal = 0.0;
|
||||
if (signed) {
|
||||
totalBits++;
|
||||
}
|
||||
const maxVal = 1 << intBits;
|
||||
if (totalBits <= 8) {
|
||||
fixedVal = buf.readUInt8(pos);
|
||||
}
|
||||
else if (totalBits <= 16) {
|
||||
fixedVal = buf.readUInt16LE(pos);
|
||||
}
|
||||
else if (totalBits <= 31) {
|
||||
fixedVal = buf.readUInt32LE(pos);
|
||||
}
|
||||
else {
|
||||
return 0.0;
|
||||
}
|
||||
fixedVal /= (1 << fracBits);
|
||||
if (signed) {
|
||||
fixedVal -= maxVal;
|
||||
}
|
||||
return fixedVal;
|
||||
}
|
||||
unpackSystem(buf, pos) {
|
||||
const startPos = pos;
|
||||
this.crc = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.flags = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.pattern = buf.readUInt8(pos++);
|
||||
this.maxAge = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.startAge = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.innerAngle = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.outerAngle = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.burstRate = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.burstRadius = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.burstSpeedMin = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.burstSpeedMax = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.burstPartCount = buf.readUInt8(pos++);
|
||||
this.angularVelocity = new Vector3_1.Vector3([
|
||||
ParticleSystem.unpackFixed(buf, pos, true, 8, 7),
|
||||
ParticleSystem.unpackFixed(buf, pos + 2, true, 8, 7),
|
||||
ParticleSystem.unpackFixed(buf, pos + 4, true, 8, 7),
|
||||
]);
|
||||
pos = pos + 6;
|
||||
this.acceleration = new Vector3_1.Vector3([
|
||||
ParticleSystem.unpackFixed(buf, pos, true, 8, 7),
|
||||
ParticleSystem.unpackFixed(buf, pos + 2, true, 8, 7),
|
||||
ParticleSystem.unpackFixed(buf, pos + 4, true, 8, 7),
|
||||
]);
|
||||
pos = pos + 6;
|
||||
this.texture = new UUID_1.UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.target = new UUID_1.UUID(buf, pos);
|
||||
pos += 16;
|
||||
if (pos - startPos !== 68) {
|
||||
console.log('INVALID SIZE: ' + (pos - startPos));
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
unpackLegacyData(buf, pos) {
|
||||
this.dataFlags = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.partMaxAge = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.startColor = new Color4_1.Color4(buf.readUInt8(pos++), buf.readUInt8(pos++), buf.readUInt8(pos++), buf.readUInt8(pos++));
|
||||
this.endColor = new Color4_1.Color4(buf.readUInt8(pos++), buf.readUInt8(pos++), buf.readUInt8(pos++), buf.readUInt8(pos++));
|
||||
this.startScaleX = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.startScaleY = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.endScaleX = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.endScaleY = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
exports.ParticleSystem = ParticleSystem;
|
||||
//# sourceMappingURL=ParticleSystem.js.map
|
||||
1
dist/classes/ParticleSystem.js.map
vendored
Normal file
1
dist/classes/ParticleSystem.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
14
dist/classes/TextureEntry.d.ts
vendored
Normal file
14
dist/classes/TextureEntry.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/// <reference types="node" />
|
||||
import { TextureEntryFace } from './TextureEntryFace';
|
||||
export declare class TextureEntry {
|
||||
defaultTexture: TextureEntryFace | null;
|
||||
faces: TextureEntryFace[];
|
||||
static readFaceBitfield(buf: Buffer, pos: number): {
|
||||
result: boolean;
|
||||
pos: number;
|
||||
faceBits: number;
|
||||
bitfieldSize: number;
|
||||
};
|
||||
constructor(buf: Buffer);
|
||||
private createFace;
|
||||
}
|
||||
266
dist/classes/TextureEntry.js
vendored
Normal file
266
dist/classes/TextureEntry.js
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const TextureEntryFace_1 = require("./TextureEntryFace");
|
||||
const UUID_1 = require("./UUID");
|
||||
const Color4_1 = require("./Color4");
|
||||
const Utils_1 = require("./Utils");
|
||||
class TextureEntry {
|
||||
constructor(buf) {
|
||||
this.faces = [];
|
||||
if (buf.length < 16) {
|
||||
this.defaultTexture = null;
|
||||
}
|
||||
else {
|
||||
this.defaultTexture = new TextureEntryFace_1.TextureEntryFace(null);
|
||||
let pos = 0;
|
||||
let i = pos;
|
||||
{
|
||||
this.defaultTexture.textureID = new UUID_1.UUID(buf, i);
|
||||
i += 16;
|
||||
let done = false;
|
||||
while (!done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const uuid = new UUID_1.UUID(buf, i);
|
||||
i += 16;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].textureID = uuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
this.defaultTexture.rgba = new Color4_1.Color4(buf, i, true);
|
||||
i += 4;
|
||||
let done = false;
|
||||
while (!done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const tmpColor = new Color4_1.Color4(buf, i, true);
|
||||
i += 4;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].rgba = tmpColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
this.defaultTexture.repeatU = buf.readFloatLE(i);
|
||||
i += 4;
|
||||
let done = false;
|
||||
while (!done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const tmpFloat = buf.readFloatLE(i);
|
||||
i += 4;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].repeatU = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
this.defaultTexture.repeatV = buf.readFloatLE(i);
|
||||
i += 4;
|
||||
let done = false;
|
||||
while (!done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const tmpFloat = buf.readFloatLE(i);
|
||||
i += 4;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].repeatV = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
this.defaultTexture.offsetU = Utils_1.Utils.ReadOffsetFloat(buf, i);
|
||||
i += 2;
|
||||
let done = false;
|
||||
while (!done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const tmpFloat = Utils_1.Utils.ReadOffsetFloat(buf, i);
|
||||
i += 2;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].offsetU = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
this.defaultTexture.offsetV = Utils_1.Utils.ReadOffsetFloat(buf, i);
|
||||
i += 2;
|
||||
let done = false;
|
||||
while (!done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const tmpFloat = Utils_1.Utils.ReadOffsetFloat(buf, i);
|
||||
i += 2;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].offsetV = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
this.defaultTexture.rotation = Utils_1.Utils.ReadRotationFloat(buf, i);
|
||||
i += 2;
|
||||
let done = false;
|
||||
while (!done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const tmpFloat = Utils_1.Utils.ReadRotationFloat(buf, i);
|
||||
i += 2;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].rotation = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
this.defaultTexture.materialb = buf[i++];
|
||||
let done = false;
|
||||
while (!done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const tmpByte = buf[i++];
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].materialb = tmpByte;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
this.defaultTexture.mediab = buf[i++];
|
||||
let done = false;
|
||||
while (i - pos < buf.length && !done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const tmpByte = buf[i++];
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].mediab = tmpByte;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
this.defaultTexture.glow = Utils_1.Utils.ReadGlowFloat(buf, i++);
|
||||
let done = false;
|
||||
while (!done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const tmpFloat = Utils_1.Utils.ReadGlowFloat(buf, i++);
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].glow = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
const len = i - pos + 16;
|
||||
if (i - pos + 16 <= buf.length) {
|
||||
this.defaultTexture.materialID = new UUID_1.UUID(buf, i);
|
||||
i += 16;
|
||||
let done = false;
|
||||
while (i - pos + 16 <= buf.length && !done) {
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done) {
|
||||
const uuid = new UUID_1.UUID(buf, i);
|
||||
i += 16;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1) {
|
||||
if ((result.faceBits & bit) !== 0) {
|
||||
this.createFace(face);
|
||||
this.faces[face].materialID = uuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static readFaceBitfield(buf, pos) {
|
||||
const result = {
|
||||
result: false,
|
||||
pos: pos,
|
||||
faceBits: 0,
|
||||
bitfieldSize: 0
|
||||
};
|
||||
if (result.pos >= buf.length) {
|
||||
return result;
|
||||
}
|
||||
let b = 0;
|
||||
do {
|
||||
b = buf.readUInt8(result.pos);
|
||||
result.faceBits = (result.faceBits << 7) | (b & 0x7F);
|
||||
result.bitfieldSize += 7;
|
||||
result.pos++;
|
||||
} while ((b & 0x80) !== 0);
|
||||
result.result = (result.faceBits !== 0);
|
||||
return result;
|
||||
}
|
||||
createFace(face) {
|
||||
if (face > 32) {
|
||||
console.error('Warning: Face number exceeds maximum number of faces: 32');
|
||||
}
|
||||
while (this.faces.length <= face) {
|
||||
this.faces.push(new TextureEntryFace_1.TextureEntryFace(this.defaultTexture));
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.TextureEntry = TextureEntry;
|
||||
//# sourceMappingURL=TextureEntry.js.map
|
||||
1
dist/classes/TextureEntry.js.map
vendored
Normal file
1
dist/classes/TextureEntry.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
23
dist/classes/TextureEntryFace.d.ts
vendored
Normal file
23
dist/classes/TextureEntryFace.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { UUID } from './UUID';
|
||||
import { Color4 } from './Color4';
|
||||
export declare class TextureEntryFace {
|
||||
private BUMP_MASK;
|
||||
private FULLBRIGHT_MASK;
|
||||
private SHINY_MASK;
|
||||
private MEDIA_MASK;
|
||||
private TEX_MAP_MASK;
|
||||
textureID: UUID;
|
||||
rgba: Color4;
|
||||
repeatU: number;
|
||||
repeatV: number;
|
||||
offsetU: number;
|
||||
offsetV: number;
|
||||
rotation: number;
|
||||
materialb: number;
|
||||
mediab: number;
|
||||
glow: number;
|
||||
materialID: UUID;
|
||||
private hasAttribute;
|
||||
private defaultTexture;
|
||||
constructor(def: TextureEntryFace | null);
|
||||
}
|
||||
25
dist/classes/TextureEntryFace.js
vendored
Normal file
25
dist/classes/TextureEntryFace.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Color4_1 = require("./Color4");
|
||||
const TextureFlags_1 = require("../enums/TextureFlags");
|
||||
class TextureEntryFace {
|
||||
constructor(def) {
|
||||
this.BUMP_MASK = 0x1F;
|
||||
this.FULLBRIGHT_MASK = 0x20;
|
||||
this.SHINY_MASK = 0xC0;
|
||||
this.MEDIA_MASK = 0x01;
|
||||
this.TEX_MAP_MASK = 0x06;
|
||||
this.rgba = Color4_1.Color4.white;
|
||||
this.repeatU = 1.0;
|
||||
this.repeatV = 1.0;
|
||||
this.defaultTexture = def;
|
||||
if (this.defaultTexture == null) {
|
||||
this.hasAttribute = TextureFlags_1.TextureFlags.All;
|
||||
}
|
||||
else {
|
||||
this.hasAttribute = TextureFlags_1.TextureFlags.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.TextureEntryFace = TextureEntryFace;
|
||||
//# sourceMappingURL=TextureEntryFace.js.map
|
||||
1
dist/classes/TextureEntryFace.js.map
vendored
Normal file
1
dist/classes/TextureEntryFace.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TextureEntryFace.js","sourceRoot":"","sources":["../../lib/classes/TextureEntryFace.ts"],"names":[],"mappings":";;AACA,qCAAgC;AAChC,wDAAmD;AAEnD,MAAa,gBAAgB;IAuBzB,YAAY,GAA4B;QArBhC,cAAS,GAAG,IAAI,CAAC;QACjB,oBAAe,GAAG,IAAI,CAAC;QACvB,eAAU,GAAG,IAAI,CAAC;QAClB,eAAU,GAAG,IAAI,CAAC;QAClB,iBAAY,GAAG,IAAI,CAAC;QAmBxB,IAAI,CAAC,IAAI,GAAG,eAAM,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACnB,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC;QAC1B,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,EAC/B;YACI,IAAI,CAAC,YAAY,GAAG,2BAAY,CAAC,GAAG,CAAC;SACxC;aAED;YACI,IAAI,CAAC,YAAY,GAAG,2BAAY,CAAC,IAAI,CAAC;SACzC;IACL,CAAC;CACJ;AAtCD,4CAsCC"}
|
||||
4
dist/classes/Utils.d.ts
vendored
4
dist/classes/Utils.d.ts
vendored
@@ -10,8 +10,12 @@ export declare class Utils {
|
||||
};
|
||||
static RegionCoordinatesToHandle(regionX: number, regionY: number): GlobalPosition;
|
||||
static HTTPAssetTypeToInventoryType(HTTPAssetType: string): "" | "script" | "object" | "texture" | "sound" | "animation" | "gesture" | "landmark" | "callcard" | "wearable" | "notecard" | "category" | "mesh";
|
||||
static ByteToFloat(byte: number, lower: number, upper: number): number;
|
||||
static UInt16ToFloat(val: number, lower: number, upper: number): number;
|
||||
static Base64EncodeString(str: string): string;
|
||||
static Base64DecodeString(str: string): string;
|
||||
static HexToLong(hex: string): Long;
|
||||
static ReadRotationFloat(buf: Buffer, pos: number): number;
|
||||
static ReadGlowFloat(buf: Buffer, pos: number): number;
|
||||
static ReadOffsetFloat(buf: Buffer, pos: number): number;
|
||||
}
|
||||
|
||||
22
dist/classes/Utils.js
vendored
22
dist/classes/Utils.js
vendored
@@ -93,6 +93,18 @@ class Utils {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
static ByteToFloat(byte, lower, upper) {
|
||||
const ONE_OVER_BYTEMAX = 1.0 / 255;
|
||||
let fval = byte * ONE_OVER_BYTEMAX;
|
||||
const delta = (upper - lower);
|
||||
fval *= delta;
|
||||
fval += lower;
|
||||
const error = delta * ONE_OVER_BYTEMAX;
|
||||
if (Math.abs(fval) < error) {
|
||||
fval = 0.0;
|
||||
}
|
||||
return fval;
|
||||
}
|
||||
static UInt16ToFloat(val, lower, upper) {
|
||||
const ONE_OVER_U16_MAX = 1.0 / 65535;
|
||||
let fval = val * ONE_OVER_U16_MAX;
|
||||
@@ -119,6 +131,16 @@ class Utils {
|
||||
}
|
||||
return new Long(parseInt(hex.substr(8), 16), parseInt(hex.substr(0, 8), 16));
|
||||
}
|
||||
static ReadRotationFloat(buf, pos) {
|
||||
return ((buf[pos] | (buf[pos + 1] << 8)) / 32768.0) * (2 * Math.PI);
|
||||
}
|
||||
static ReadGlowFloat(buf, pos) {
|
||||
return buf[pos] / 255;
|
||||
}
|
||||
static ReadOffsetFloat(buf, pos) {
|
||||
const offset = buf.readInt16LE(pos);
|
||||
return offset / 32767.0;
|
||||
}
|
||||
}
|
||||
exports.Utils = Utils;
|
||||
//# sourceMappingURL=Utils.js.map
|
||||
2
dist/classes/Utils.js.map
vendored
2
dist/classes/Utils.js.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../lib/classes/Utils.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,0BAA8C;AAE9C,MAAa,KAAK;IAEd,MAAM,CAAC,cAAc,CAAC,GAAW;QAE7B,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,CAAC,oBAAoB,CAAC,GAAW,EAAE,QAAiB;QAEtD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EACpB;YACI,OAAO,EAAE,CAAC;SACb;QACD,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAC7B;YACI,OAAO,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AC;IACjF,CAAC;IACD,MAAM,CAAC,iBAAiB,CAAC,GAAW,EAAE,GAAW;QAE7C,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,CAAC,aAAa,CAAC,GAAW,EAAE,GAAW;QAEzC,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;IACD,MAAM,CAAC,eAAe,CAAC,GAAW,EAAE,GAAW;QAE3C,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO,MAAM,GAAG,OAAO,CAAC;IAC5B,CAAC;CACJ;AAjLD,sBAiLC"}
|
||||
5
dist/classes/commands/RegionCommands.d.ts
vendored
5
dist/classes/commands/RegionCommands.d.ts
vendored
@@ -1,8 +1,13 @@
|
||||
import { CommandsBase } from './CommandsBase';
|
||||
import { UUID } from '../UUID';
|
||||
import * as Long from 'long';
|
||||
import { Vector3 } from '../..';
|
||||
import { IGameObject } from '../interfaces/IGameObject';
|
||||
export declare class RegionCommands extends CommandsBase {
|
||||
getRegionHandle(regionID: UUID): Promise<Long>;
|
||||
getObjectsInArea(minX: number, maxX: number, minY: number, maxY: number, minZ: number, maxZ: number): IGameObject[];
|
||||
grabObject(localID: number | UUID, grabOffset?: Vector3, uvCoordinate?: Vector3, stCoordinate?: Vector3, faceIndex?: number, position?: Vector3, normal?: Vector3, binormal?: Vector3): Promise<void>;
|
||||
deGrabObject(localID: number | UUID, grabOffset?: Vector3, uvCoordinate?: Vector3, stCoordinate?: Vector3, faceIndex?: number, position?: Vector3, normal?: Vector3, binormal?: Vector3): Promise<void>;
|
||||
dragGrabbedObject(localID: number | UUID, grabPosition: Vector3, grabOffset?: Vector3, uvCoordinate?: Vector3, stCoordinate?: Vector3, faceIndex?: number, position?: Vector3, normal?: Vector3, binormal?: Vector3): Promise<void>;
|
||||
touchObject(localID: number | UUID, grabOffset?: Vector3, uvCoordinate?: Vector3, stCoordinate?: Vector3, faceIndex?: number, position?: Vector3, normal?: Vector3, binormal?: Vector3): Promise<void>;
|
||||
}
|
||||
|
||||
117
dist/classes/commands/RegionCommands.js
vendored
117
dist/classes/commands/RegionCommands.js
vendored
@@ -1,34 +1,143 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const CommandsBase_1 = require("./CommandsBase");
|
||||
const UUID_1 = require("../UUID");
|
||||
const RegionHandleRequest_1 = require("../messages/RegionHandleRequest");
|
||||
const Message_1 = require("../../enums/Message");
|
||||
const FilterResponse_1 = require("../../enums/FilterResponse");
|
||||
const __1 = require("../..");
|
||||
const ObjectGrab_1 = require("../messages/ObjectGrab");
|
||||
const ObjectDeGrab_1 = require("../messages/ObjectDeGrab");
|
||||
const ObjectGrabUpdate_1 = require("../messages/ObjectGrabUpdate");
|
||||
class RegionCommands extends CommandsBase_1.CommandsBase {
|
||||
getRegionHandle(regionID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const circuit = this.currentRegion.circuit;
|
||||
const msg = new RegionHandleRequest_1.RegionHandleRequestMessage();
|
||||
msg.RequestBlock = {
|
||||
RegionID: regionID,
|
||||
};
|
||||
circuit.sendMessage(msg, __1.PacketFlags.Reliable);
|
||||
circuit.waitForMessage(Message_1.Message.RegionIDAndHandleReply, 10000, (filterMsg) => {
|
||||
const responseMsg = yield circuit.waitForMessage(Message_1.Message.RegionIDAndHandleReply, 10000, (filterMsg) => {
|
||||
if (filterMsg.ReplyBlock.RegionID.toString() === regionID.toString()) {
|
||||
return FilterResponse_1.FilterResponse.Finish;
|
||||
}
|
||||
else {
|
||||
return FilterResponse_1.FilterResponse.NoMatch;
|
||||
}
|
||||
}).then((responseMsg) => {
|
||||
resolve(responseMsg.ReplyBlock.RegionHandle);
|
||||
});
|
||||
return responseMsg.ReplyBlock.RegionHandle;
|
||||
});
|
||||
}
|
||||
getObjectsInArea(minX, maxX, minY, maxY, minZ, maxZ) {
|
||||
return this.currentRegion.objects.getObjectsInArea(minX, maxX, minY, maxY, minZ, maxZ);
|
||||
}
|
||||
grabObject(localID, grabOffset = __1.Vector3.getZero(), uvCoordinate = __1.Vector3.getZero(), stCoordinate = __1.Vector3.getZero(), faceIndex = 0, position = __1.Vector3.getZero(), normal = __1.Vector3.getZero(), binormal = __1.Vector3.getZero()) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (localID instanceof UUID_1.UUID) {
|
||||
const obj = this.currentRegion.objects.getObjectByUUID(localID);
|
||||
localID = obj.ID;
|
||||
}
|
||||
const msg = new ObjectGrab_1.ObjectGrabMessage();
|
||||
msg.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
msg.ObjectData = {
|
||||
LocalID: localID,
|
||||
GrabOffset: grabOffset
|
||||
};
|
||||
msg.SurfaceInfo = [
|
||||
{
|
||||
UVCoord: uvCoordinate,
|
||||
STCoord: stCoordinate,
|
||||
FaceIndex: faceIndex,
|
||||
Position: position,
|
||||
Normal: normal,
|
||||
Binormal: binormal
|
||||
}
|
||||
];
|
||||
const seqID = this.circuit.sendMessage(msg, __1.PacketFlags.Reliable);
|
||||
yield this.circuit.waitForAck(seqID, 10000);
|
||||
});
|
||||
}
|
||||
deGrabObject(localID, grabOffset = __1.Vector3.getZero(), uvCoordinate = __1.Vector3.getZero(), stCoordinate = __1.Vector3.getZero(), faceIndex = 0, position = __1.Vector3.getZero(), normal = __1.Vector3.getZero(), binormal = __1.Vector3.getZero()) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (localID instanceof UUID_1.UUID) {
|
||||
const obj = this.currentRegion.objects.getObjectByUUID(localID);
|
||||
localID = obj.ID;
|
||||
}
|
||||
const msg = new ObjectDeGrab_1.ObjectDeGrabMessage();
|
||||
msg.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
msg.ObjectData = {
|
||||
LocalID: localID
|
||||
};
|
||||
msg.SurfaceInfo = [
|
||||
{
|
||||
UVCoord: uvCoordinate,
|
||||
STCoord: stCoordinate,
|
||||
FaceIndex: faceIndex,
|
||||
Position: position,
|
||||
Normal: normal,
|
||||
Binormal: binormal
|
||||
}
|
||||
];
|
||||
const seqID = this.circuit.sendMessage(msg, __1.PacketFlags.Reliable);
|
||||
yield this.circuit.waitForAck(seqID, 10000);
|
||||
});
|
||||
}
|
||||
dragGrabbedObject(localID, grabPosition, grabOffset = __1.Vector3.getZero(), uvCoordinate = __1.Vector3.getZero(), stCoordinate = __1.Vector3.getZero(), faceIndex = 0, position = __1.Vector3.getZero(), normal = __1.Vector3.getZero(), binormal = __1.Vector3.getZero()) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!(localID instanceof UUID_1.UUID)) {
|
||||
const obj = this.currentRegion.objects.getObjectByLocalID(localID);
|
||||
localID = obj.FullID;
|
||||
}
|
||||
const msg = new ObjectGrabUpdate_1.ObjectGrabUpdateMessage();
|
||||
msg.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
msg.ObjectData = {
|
||||
ObjectID: localID,
|
||||
GrabOffsetInitial: grabOffset,
|
||||
GrabPosition: grabPosition,
|
||||
TimeSinceLast: 0
|
||||
};
|
||||
msg.SurfaceInfo = [
|
||||
{
|
||||
UVCoord: uvCoordinate,
|
||||
STCoord: stCoordinate,
|
||||
FaceIndex: faceIndex,
|
||||
Position: position,
|
||||
Normal: normal,
|
||||
Binormal: binormal
|
||||
}
|
||||
];
|
||||
const seqID = this.circuit.sendMessage(msg, __1.PacketFlags.Reliable);
|
||||
yield this.circuit.waitForAck(seqID, 10000);
|
||||
});
|
||||
}
|
||||
touchObject(localID, grabOffset = __1.Vector3.getZero(), uvCoordinate = __1.Vector3.getZero(), stCoordinate = __1.Vector3.getZero(), faceIndex = 0, position = __1.Vector3.getZero(), normal = __1.Vector3.getZero(), binormal = __1.Vector3.getZero()) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (localID instanceof UUID_1.UUID) {
|
||||
const obj = this.currentRegion.objects.getObjectByUUID(localID);
|
||||
localID = obj.ID;
|
||||
}
|
||||
yield this.grabObject(localID, grabOffset, uvCoordinate, stCoordinate, faceIndex, position, normal, binormal);
|
||||
yield this.deGrabObject(localID, grabOffset, uvCoordinate, stCoordinate, faceIndex, position, normal, binormal);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.RegionCommands = RegionCommands;
|
||||
//# sourceMappingURL=RegionCommands.js.map
|
||||
2
dist/classes/commands/RegionCommands.js.map
vendored
2
dist/classes/commands/RegionCommands.js.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"RegionCommands.js","sourceRoot":"","sources":["../../../lib/classes/commands/RegionCommands.ts"],"names":[],"mappings":";;AAAA,iDAA4C;AAG5C,yEAA2E;AAC3E,iDAA4C;AAC5C,+DAA0D;AAE1D,6BAAkC;AAGlC,MAAa,cAAe,SAAQ,2BAAY;IAE5C,eAAe,CAAC,QAAc;QAE1B,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAEzC,MAAM,OAAO,GAAG,IA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AE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC9G,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACpH,CAAC;KAAA;CACJ;AAhKD,wCAgKC"}
|
||||
8
dist/classes/interfaces/IGameObject.d.ts
vendored
8
dist/classes/interfaces/IGameObject.d.ts
vendored
@@ -1,5 +1,13 @@
|
||||
import { ITreeBoundingBox } from './ITreeBoundingBox';
|
||||
import { UUID } from '../UUID';
|
||||
import { PCode } from '../../enums/PCode';
|
||||
export interface IGameObject {
|
||||
ID: number;
|
||||
FullID: UUID;
|
||||
ParentID: number;
|
||||
OwnerID: UUID;
|
||||
IsAttachment: boolean;
|
||||
PCode: PCode;
|
||||
rtreeEntry?: ITreeBoundingBox;
|
||||
hasNameValueEntry(key: string): boolean;
|
||||
getNameValueEntry(key: string): string;
|
||||
|
||||
3
dist/classes/interfaces/IObjectStore.d.ts
vendored
3
dist/classes/interfaces/IObjectStore.d.ts
vendored
@@ -1,9 +1,12 @@
|
||||
import { IGameObject } from './IGameObject';
|
||||
import { RBush3D } from 'rbush-3d/dist';
|
||||
import { GameObjectFull } from '../GameObjectFull';
|
||||
import { UUID } from '../UUID';
|
||||
export interface IObjectStore {
|
||||
rtree?: RBush3D;
|
||||
getObjectsByParent(parentID: number): IGameObject[];
|
||||
shutdown(): void;
|
||||
getObjectsInArea(minX: number, maxX: number, minY: number, maxY: number, minZ: number, maxZ: number): GameObjectFull[];
|
||||
getObjectByUUID(fullID: UUID): IGameObject;
|
||||
getObjectByLocalID(ID: number): IGameObject;
|
||||
}
|
||||
|
||||
12
dist/enums/BlendFunc.d.ts
vendored
Normal file
12
dist/enums/BlendFunc.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export declare enum BlendFunc {
|
||||
One = 0,
|
||||
Zero = 1,
|
||||
DestColor = 2,
|
||||
SourceColor = 3,
|
||||
OneMinusDestColor = 4,
|
||||
OneMinusSourceColor = 5,
|
||||
DestAlpha = 6,
|
||||
SourceAlpha = 7,
|
||||
OneMinusDestAlpha = 8,
|
||||
OneMinusSourceAlpha = 9
|
||||
}
|
||||
16
dist/enums/BlendFunc.js
vendored
Normal file
16
dist/enums/BlendFunc.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var BlendFunc;
|
||||
(function (BlendFunc) {
|
||||
BlendFunc[BlendFunc["One"] = 0] = "One";
|
||||
BlendFunc[BlendFunc["Zero"] = 1] = "Zero";
|
||||
BlendFunc[BlendFunc["DestColor"] = 2] = "DestColor";
|
||||
BlendFunc[BlendFunc["SourceColor"] = 3] = "SourceColor";
|
||||
BlendFunc[BlendFunc["OneMinusDestColor"] = 4] = "OneMinusDestColor";
|
||||
BlendFunc[BlendFunc["OneMinusSourceColor"] = 5] = "OneMinusSourceColor";
|
||||
BlendFunc[BlendFunc["DestAlpha"] = 6] = "DestAlpha";
|
||||
BlendFunc[BlendFunc["SourceAlpha"] = 7] = "SourceAlpha";
|
||||
BlendFunc[BlendFunc["OneMinusDestAlpha"] = 8] = "OneMinusDestAlpha";
|
||||
BlendFunc[BlendFunc["OneMinusSourceAlpha"] = 9] = "OneMinusSourceAlpha";
|
||||
})(BlendFunc = exports.BlendFunc || (exports.BlendFunc = {}));
|
||||
//# sourceMappingURL=BlendFunc.js.map
|
||||
1
dist/enums/BlendFunc.js.map
vendored
Normal file
1
dist/enums/BlendFunc.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BlendFunc.js","sourceRoot":"","sources":["../../lib/enums/BlendFunc.ts"],"names":[],"mappings":";;AAAA,IAAY,SAYX;AAZD,WAAY,SAAS;IAEjB,uCAAO,CAAA;IACP,yCAAQ,CAAA;IACR,mDAAa,CAAA;IACb,uDAAe,CAAA;IACf,mEAAqB,CAAA;IACrB,uEAAuB,CAAA;IACvB,mDAAa,CAAA;IACb,uDAAe,CAAA;IACf,mEAAqB,CAAA;IACrB,uEAAuB,CAAA;AAC3B,CAAC,EAZW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAYpB"}
|
||||
16
dist/enums/ParticleDataFlags.d.ts
vendored
Normal file
16
dist/enums/ParticleDataFlags.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export declare enum ParticleDataFlags {
|
||||
None = 0,
|
||||
InterpColor = 1,
|
||||
InterpScale = 2,
|
||||
Bounce = 4,
|
||||
Wind = 8,
|
||||
FollowSrc = 16,
|
||||
FollowVelocity = 32,
|
||||
TargetPos = 64,
|
||||
TargetLinear = 128,
|
||||
Emissive = 256,
|
||||
Beam = 512,
|
||||
Ribbon = 1024,
|
||||
DataGlow = 65536,
|
||||
DataBlend = 131072
|
||||
}
|
||||
20
dist/enums/ParticleDataFlags.js
vendored
Normal file
20
dist/enums/ParticleDataFlags.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var ParticleDataFlags;
|
||||
(function (ParticleDataFlags) {
|
||||
ParticleDataFlags[ParticleDataFlags["None"] = 0] = "None";
|
||||
ParticleDataFlags[ParticleDataFlags["InterpColor"] = 1] = "InterpColor";
|
||||
ParticleDataFlags[ParticleDataFlags["InterpScale"] = 2] = "InterpScale";
|
||||
ParticleDataFlags[ParticleDataFlags["Bounce"] = 4] = "Bounce";
|
||||
ParticleDataFlags[ParticleDataFlags["Wind"] = 8] = "Wind";
|
||||
ParticleDataFlags[ParticleDataFlags["FollowSrc"] = 16] = "FollowSrc";
|
||||
ParticleDataFlags[ParticleDataFlags["FollowVelocity"] = 32] = "FollowVelocity";
|
||||
ParticleDataFlags[ParticleDataFlags["TargetPos"] = 64] = "TargetPos";
|
||||
ParticleDataFlags[ParticleDataFlags["TargetLinear"] = 128] = "TargetLinear";
|
||||
ParticleDataFlags[ParticleDataFlags["Emissive"] = 256] = "Emissive";
|
||||
ParticleDataFlags[ParticleDataFlags["Beam"] = 512] = "Beam";
|
||||
ParticleDataFlags[ParticleDataFlags["Ribbon"] = 1024] = "Ribbon";
|
||||
ParticleDataFlags[ParticleDataFlags["DataGlow"] = 65536] = "DataGlow";
|
||||
ParticleDataFlags[ParticleDataFlags["DataBlend"] = 131072] = "DataBlend";
|
||||
})(ParticleDataFlags = exports.ParticleDataFlags || (exports.ParticleDataFlags = {}));
|
||||
//# sourceMappingURL=ParticleDataFlags.js.map
|
||||
1
dist/enums/ParticleDataFlags.js.map
vendored
Normal file
1
dist/enums/ParticleDataFlags.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ParticleDataFlags.js","sourceRoot":"","sources":["../../lib/enums/ParticleDataFlags.ts"],"names":[],"mappings":";;AAAA,IAAY,iBAgBX;AAhBD,WAAY,iBAAiB;IAEzB,yDAAQ,CAAA;IACR,uEAAmB,CAAA;IACnB,uEAAmB,CAAA;IACnB,6DAAc,CAAA;IACd,yDAAY,CAAA;IACZ,oEAAiB,CAAA;IACjB,8EAAsB,CAAA;IACtB,oEAAiB,CAAA;IACjB,2EAAoB,CAAA;IACpB,mEAAgB,CAAA;IAChB,2DAAY,CAAA;IACZ,gEAAc,CAAA;IACd,qEAAkB,CAAA;IAClB,wEAAmB,CAAA;AACvB,CAAC,EAhBW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAgB5B"}
|
||||
8
dist/enums/SourcePattern.d.ts
vendored
Normal file
8
dist/enums/SourcePattern.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export declare enum SourcePattern {
|
||||
None = 0,
|
||||
Drop = 1,
|
||||
Explode = 2,
|
||||
Angle = 4,
|
||||
AngleCone = 8,
|
||||
AngleConeEmpty = 16
|
||||
}
|
||||
12
dist/enums/SourcePattern.js
vendored
Normal file
12
dist/enums/SourcePattern.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var SourcePattern;
|
||||
(function (SourcePattern) {
|
||||
SourcePattern[SourcePattern["None"] = 0] = "None";
|
||||
SourcePattern[SourcePattern["Drop"] = 1] = "Drop";
|
||||
SourcePattern[SourcePattern["Explode"] = 2] = "Explode";
|
||||
SourcePattern[SourcePattern["Angle"] = 4] = "Angle";
|
||||
SourcePattern[SourcePattern["AngleCone"] = 8] = "AngleCone";
|
||||
SourcePattern[SourcePattern["AngleConeEmpty"] = 16] = "AngleConeEmpty";
|
||||
})(SourcePattern = exports.SourcePattern || (exports.SourcePattern = {}));
|
||||
//# sourceMappingURL=SourcePattern.js.map
|
||||
1
dist/enums/SourcePattern.js.map
vendored
Normal file
1
dist/enums/SourcePattern.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SourcePattern.js","sourceRoot":"","sources":["../../lib/enums/SourcePattern.ts"],"names":[],"mappings":";;AAAA,IAAY,aAQX;AARD,WAAY,aAAa;IAErB,iDAAQ,CAAA;IACR,iDAAW,CAAA;IACX,uDAAc,CAAA;IACd,mDAAY,CAAA;IACZ,2DAAgB,CAAA;IAChB,sEAAqB,CAAA;AACzB,CAAC,EARW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAQxB"}
|
||||
15
dist/enums/TextureFlags.d.ts
vendored
Normal file
15
dist/enums/TextureFlags.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export declare enum TextureFlags {
|
||||
None = 0,
|
||||
TextureID = 1,
|
||||
RGBA = 2,
|
||||
RepeatU = 4,
|
||||
RepeatV = 8,
|
||||
OffsetU = 16,
|
||||
OffsetV = 32,
|
||||
Rotation = 64,
|
||||
Material = 128,
|
||||
Media = 256,
|
||||
Glow = 512,
|
||||
MaterialID = 1024,
|
||||
All = 4294967295
|
||||
}
|
||||
19
dist/enums/TextureFlags.js
vendored
Normal file
19
dist/enums/TextureFlags.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var TextureFlags;
|
||||
(function (TextureFlags) {
|
||||
TextureFlags[TextureFlags["None"] = 0] = "None";
|
||||
TextureFlags[TextureFlags["TextureID"] = 1] = "TextureID";
|
||||
TextureFlags[TextureFlags["RGBA"] = 2] = "RGBA";
|
||||
TextureFlags[TextureFlags["RepeatU"] = 4] = "RepeatU";
|
||||
TextureFlags[TextureFlags["RepeatV"] = 8] = "RepeatV";
|
||||
TextureFlags[TextureFlags["OffsetU"] = 16] = "OffsetU";
|
||||
TextureFlags[TextureFlags["OffsetV"] = 32] = "OffsetV";
|
||||
TextureFlags[TextureFlags["Rotation"] = 64] = "Rotation";
|
||||
TextureFlags[TextureFlags["Material"] = 128] = "Material";
|
||||
TextureFlags[TextureFlags["Media"] = 256] = "Media";
|
||||
TextureFlags[TextureFlags["Glow"] = 512] = "Glow";
|
||||
TextureFlags[TextureFlags["MaterialID"] = 1024] = "MaterialID";
|
||||
TextureFlags[TextureFlags["All"] = 4294967295] = "All";
|
||||
})(TextureFlags = exports.TextureFlags || (exports.TextureFlags = {}));
|
||||
//# sourceMappingURL=TextureFlags.js.map
|
||||
1
dist/enums/TextureFlags.js.map
vendored
Normal file
1
dist/enums/TextureFlags.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TextureFlags.js","sourceRoot":"","sources":["../../lib/enums/TextureFlags.ts"],"names":[],"mappings":";;AAAA,IAAY,YAeX;AAfD,WAAY,YAAY;IAEpB,+CAAQ,CAAA;IACR,yDAAkB,CAAA;IAClB,+CAAa,CAAA;IACb,qDAAgB,CAAA;IAChB,qDAAgB,CAAA;IAChB,sDAAgB,CAAA;IAChB,sDAAgB,CAAA;IAChB,wDAAiB,CAAA;IACjB,yDAAiB,CAAA;IACjB,mDAAc,CAAA;IACd,iDAAa,CAAA;IACb,8DAAoB,CAAA;IACpB,sDAAgB,CAAA;AACpB,CAAC,EAfW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAevB"}
|
||||
6
dist/index.d.ts
vendored
6
dist/index.d.ts
vendored
@@ -49,4 +49,8 @@ import { FriendRemovedEvent } from './events/FriendRemovedEvent';
|
||||
import { GlobalPosition } from './classes/public/interfaces/GlobalPosition';
|
||||
import { MapLocation } from './classes/public/interfaces/MapLocation';
|
||||
import { Vector2 } from './classes/Vector2';
|
||||
export { Bot, LoginParameters, AssetType, HTTPAssets, ClientEvents, BVH, ChatSourceType, BotOptionFlags, UUID, Vector3, Vector2, AgentFlags, CompressedFlags, ControlFlags, DecodeFlags, InstantMessageEventFlags, InventoryItemFlags, LoginFlags, MessageFlags, ParcelInfoFlags, PacketFlags, RegionProtocolFlags, SoundFlags, TeleportFlags, RegionFlags, RightsFlags, ChatEvent, DisconnectEvent, FriendRequestEvent, FriendResponseEvent, GroupChatEvent, GroupChatSessionAgentListEvent, GroupChatSessionJoinEvent, GroupInviteEvent, InstantMessageEvent, InventoryOfferedEvent, LureEvent, MapInfoRangeReplyEvent, MapInfoReplyEvent, ParcelInfoReplyEvent, RegionInfoReplyEvent, TeleportEvent, ScriptDialogEvent, EventQueueStateChangeEvent, FriendOnlineEvent, FriendRightsEvent, FriendRemovedEvent, Avatar, Friend, GlobalPosition, MapLocation };
|
||||
import { ParticleDataFlags } from './enums/ParticleDataFlags';
|
||||
import { TextureFlags } from './enums/TextureFlags';
|
||||
import { SourcePattern } from './enums/SourcePattern';
|
||||
import { BlendFunc } from './enums/BlendFunc';
|
||||
export { Bot, LoginParameters, AssetType, HTTPAssets, ClientEvents, BVH, ChatSourceType, BotOptionFlags, UUID, Vector3, Vector2, AgentFlags, CompressedFlags, ControlFlags, DecodeFlags, InstantMessageEventFlags, InventoryItemFlags, LoginFlags, MessageFlags, ParcelInfoFlags, PacketFlags, RegionProtocolFlags, SoundFlags, TeleportFlags, RegionFlags, RightsFlags, ParticleDataFlags, TextureFlags, SourcePattern, BlendFunc, ChatEvent, DisconnectEvent, FriendRequestEvent, FriendResponseEvent, GroupChatEvent, GroupChatSessionAgentListEvent, GroupChatSessionJoinEvent, GroupInviteEvent, InstantMessageEvent, InventoryOfferedEvent, LureEvent, MapInfoRangeReplyEvent, MapInfoReplyEvent, ParcelInfoReplyEvent, RegionInfoReplyEvent, TeleportEvent, ScriptDialogEvent, EventQueueStateChangeEvent, FriendOnlineEvent, FriendRightsEvent, FriendRemovedEvent, Avatar, Friend, GlobalPosition, MapLocation };
|
||||
|
||||
8
dist/index.js
vendored
8
dist/index.js
vendored
@@ -98,4 +98,12 @@ const FriendRemovedEvent_1 = require("./events/FriendRemovedEvent");
|
||||
exports.FriendRemovedEvent = FriendRemovedEvent_1.FriendRemovedEvent;
|
||||
const Vector2_1 = require("./classes/Vector2");
|
||||
exports.Vector2 = Vector2_1.Vector2;
|
||||
const ParticleDataFlags_1 = require("./enums/ParticleDataFlags");
|
||||
exports.ParticleDataFlags = ParticleDataFlags_1.ParticleDataFlags;
|
||||
const TextureFlags_1 = require("./enums/TextureFlags");
|
||||
exports.TextureFlags = TextureFlags_1.TextureFlags;
|
||||
const SourcePattern_1 = require("./enums/SourcePattern");
|
||||
exports.SourcePattern = SourcePattern_1.SourcePattern;
|
||||
const BlendFunc_1 = require("./enums/BlendFunc");
|
||||
exports.BlendFunc = BlendFunc_1.BlendFunc;
|
||||
//# sourceMappingURL=index.js.map
|
||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;AAAA,+BAA0B;AAsDtB,cAtDI,SAAG,CAsDJ;AArDP,+DAA0D;AAsDtD,0BAtDI,iCAAe,CAsDJ;AArDnB,yDAAoD;AAwDhD,uBAxDI,2BAAY,CAwDJ;AAvDhB,uCAAkC;AAwD9B,cAxDI,SAAG,CAwDJ;AAtDP,iDAA4C;AAmDxC,oBAnDI,qBAA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black: Color4 = new Color4(0.0, 0.0, 0.0, 1.0);
|
||||
static white: Color4 = new Color4(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
constructor(public red: number | Buffer, public green: number, public blue: number | boolean, public alpha: number | boolean = 0)
|
||||
{
|
||||
if (red instanceof Buffer && typeof blue === 'boolean')
|
||||
{
|
||||
const buf = red;
|
||||
const pos = green;
|
||||
const inverted = blue;
|
||||
let alphaInverted = false;
|
||||
if (typeof alpha === 'boolean' && alpha === true)
|
||||
{
|
||||
alphaInverted = true;
|
||||
}
|
||||
|
||||
this.red = 0.0;
|
||||
this.green = 0.0;
|
||||
this.blue = 0.0;
|
||||
this.alpha = 0.0;
|
||||
|
||||
const quanta: number = 1.0 / 255.0;
|
||||
if (inverted)
|
||||
{
|
||||
this.red = (255 - buf[pos]) * quanta;
|
||||
this.green = (255 - buf[pos + 1]) * quanta;
|
||||
this.blue = (255 - buf[pos + 2]) * quanta;
|
||||
this.alpha = (255 - buf[pos + 3]) * quanta;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.red = buf[pos] * quanta;
|
||||
this.green = buf[pos + 1] * quanta;
|
||||
this.blue = buf[pos + 2] * quanta;
|
||||
this.alpha = buf[pos + 3] * quanta;
|
||||
}
|
||||
if (alphaInverted)
|
||||
{
|
||||
this.alpha = 1.0 - this.alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,10 @@ import {NameValue} from './NameValue';
|
||||
import {IGameObject} from './interfaces/IGameObject';
|
||||
import {SoundFlags} from '..';
|
||||
import {ITreeBoundingBox} from './interfaces/ITreeBoundingBox';
|
||||
import {Vector4} from './Vector4';
|
||||
import {TextureEntry} from './TextureEntry';
|
||||
import {Color4} from './Color4';
|
||||
import {ParticleSystem} from './ParticleSystem';
|
||||
|
||||
export class GameObjectFull implements IGameObject
|
||||
{
|
||||
@@ -41,11 +45,11 @@ export class GameObjectFull implements IGameObject
|
||||
ProfileBegin: number;
|
||||
ProfileEnd: number;
|
||||
ProfileHollow: number;
|
||||
TextureEntry: Buffer;
|
||||
TextureEntry: TextureEntry;
|
||||
TextureAnim: Buffer;
|
||||
Data: Buffer;
|
||||
Text: string;
|
||||
TextColor: Buffer;
|
||||
TextColor: Color4;
|
||||
MediaURL: string;
|
||||
PSBlock: Buffer;
|
||||
OwnerID: UUID;
|
||||
@@ -54,6 +58,9 @@ export class GameObjectFull implements IGameObject
|
||||
JointAxisOrAnchor: Vector3;
|
||||
Position: Vector3;
|
||||
Rotation: Quaternion;
|
||||
CollisionPlane: Vector4;
|
||||
Velocity: Vector3;
|
||||
Acceleration: Vector3;
|
||||
AngularVelocity: Vector3;
|
||||
TreeSpecies: Tree;
|
||||
Sound: UUID;
|
||||
@@ -62,6 +69,7 @@ export class GameObjectFull implements IGameObject
|
||||
SoundRadius: number;
|
||||
IsAttachment: boolean;
|
||||
NameValue: {[key: string]: NameValue};
|
||||
Particles: ParticleSystem;
|
||||
constructor()
|
||||
{
|
||||
this.Position = Vector3.getZero();
|
||||
|
||||
@@ -21,9 +21,12 @@ import {IObjectStore} from './interfaces/IObjectStore';
|
||||
import {GameObjectFull} from './GameObjectFull';
|
||||
import {IGameObject} from './interfaces/IGameObject';
|
||||
import {BotOptionFlags, CompressedFlags} from '..';
|
||||
import {BBox, RBush3D} from 'rbush-3d/dist';
|
||||
import {RBush3D} from 'rbush-3d/dist';
|
||||
import {ITreeBoundingBox} from './interfaces/ITreeBoundingBox';
|
||||
import {GameObjectLite} from './GameObjectLite';
|
||||
import {Vector4} from './Vector4';
|
||||
import {TextureEntry} from './TextureEntry';
|
||||
import {Color4} from './Color4';
|
||||
import {ParticleSystem} from './ParticleSystem';
|
||||
|
||||
export class ObjectStoreFull implements IObjectStore
|
||||
{
|
||||
@@ -92,7 +95,95 @@ export class ObjectStoreFull implements IObjectStore
|
||||
obj.Material = objData.Material;
|
||||
obj.ClickAction = objData.ClickAction;
|
||||
obj.Scale = objData.Scale;
|
||||
obj.ObjectData = objData.ObjectData; // TODO: DECODE
|
||||
obj.ObjectData = objData.ObjectData;
|
||||
const data: Buffer = objData.ObjectData;
|
||||
let dataPos = 0;
|
||||
|
||||
// noinspection FallThroughInSwitchStatementJS, TsLint
|
||||
switch (data.length)
|
||||
{
|
||||
case 76:
|
||||
// Avatar collision normal;
|
||||
obj.CollisionPlane = new Vector4(objData.ObjectData, dataPos);
|
||||
dataPos += 16;
|
||||
case 60:
|
||||
// Position
|
||||
obj.Position = new Vector3(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
obj.Velocity = new Vector3(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
obj.Acceleration = new Vector3(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
obj.Rotation = new Quaternion(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
obj.AngularVelocity = new Vector3(objData.ObjectData, dataPos);
|
||||
dataPos += 12;
|
||||
break;
|
||||
case 48:
|
||||
obj.CollisionPlane = new Vector4(objData.ObjectData, dataPos);
|
||||
dataPos += 16;
|
||||
case 32:
|
||||
obj.Position = new Vector3([
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -0.5 * 256.0, 1.5 * 256.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -0.5 * 256.0, 1.5 * 256.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -256.0, 3.0 * 256.0)
|
||||
]);
|
||||
dataPos += 6;
|
||||
obj.Velocity = new Vector3([
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -256.0, 256.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
||||
]);
|
||||
dataPos += 6;
|
||||
obj.Acceleration = new Vector3([
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -256.0, 256.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
||||
]);
|
||||
dataPos += 6;
|
||||
obj.Rotation = new Quaternion([
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -1.0, 1.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -1.0, 1.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -1.0, 1.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -1.0, 1.0)
|
||||
]);
|
||||
dataPos += 8;
|
||||
obj.AngularVelocity = new Vector3([
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos), -256.0, 256.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
||||
Utils.UInt16ToFloat(objData.ObjectData.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
||||
]);
|
||||
dataPos += 6;
|
||||
break;
|
||||
case 16:
|
||||
obj.Position = new Vector3([
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0)
|
||||
]);
|
||||
obj.Velocity = new Vector3([
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0)
|
||||
]);
|
||||
obj.Acceleration = new Vector3([
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0)
|
||||
]);
|
||||
obj.Rotation = new Quaternion([
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -1.0, 1.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -1.0, 1.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -1.0, 1.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -1.0, 1.0)
|
||||
]);
|
||||
obj.AngularVelocity = new Vector3([
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0),
|
||||
Utils.ByteToFloat(objData.ObjectData.readUInt8(dataPos++), -256.0, 256.0)
|
||||
]);
|
||||
break;
|
||||
}
|
||||
obj.ParentID = objData.ParentID;
|
||||
obj.Flags = objData.UpdateFlags;
|
||||
obj.PathCurve = objData.PathCurve;
|
||||
@@ -113,11 +204,11 @@ export class ObjectStoreFull implements IObjectStore
|
||||
obj.ProfileBegin = objData.ProfileBegin;
|
||||
obj.ProfileEnd = objData.ProfileEnd;
|
||||
obj.ProfileHollow = objData.ProfileHollow;
|
||||
obj.TextureEntry = objData.TextureEntry; // TODO: DECODE
|
||||
obj.TextureEntry = new TextureEntry(objData.TextureEntry);
|
||||
obj.TextureAnim = objData.TextureAnim;
|
||||
obj.Data = objData.Data; // TODO: DECODE
|
||||
const pcodeData = objData.Data;
|
||||
obj.Text = Utils.BufferToStringSimple(objData.Text);
|
||||
obj.TextColor = objData.TextColor; // TODO: DECODE
|
||||
obj.TextColor = new Color4(objData.TextColor, 0, false, true);
|
||||
obj.MediaURL = Utils.BufferToStringSimple(objData.MediaURL);
|
||||
obj.PSBlock = objData.PSBlock;
|
||||
obj.Sound = objData.Sound;
|
||||
@@ -129,6 +220,18 @@ export class ObjectStoreFull implements IObjectStore
|
||||
obj.JointPivot = objData.JointPivot;
|
||||
obj.JointAxisOrAnchor = objData.JointAxisOrAnchor;
|
||||
|
||||
switch (obj.PCode)
|
||||
{
|
||||
case PCode.Grass:
|
||||
case PCode.Tree:
|
||||
case PCode.NewTree:
|
||||
if (pcodeData.length === 1)
|
||||
{
|
||||
obj.TreeSpecies = pcodeData[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.objects[localID].PCode === PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString())
|
||||
{
|
||||
this.agent.localID = localID;
|
||||
@@ -194,6 +297,7 @@ export class ObjectStoreFull implements IObjectStore
|
||||
}
|
||||
break;
|
||||
case Message.ObjectUpdateCached:
|
||||
{
|
||||
const objectUpdateCached = packet.message as ObjectUpdateCachedMessage;
|
||||
const rmo = new RequestMultipleObjectsMessage();
|
||||
rmo.AgentData = {
|
||||
@@ -201,15 +305,22 @@ export class ObjectStoreFull implements IObjectStore
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
rmo.ObjectData = [];
|
||||
objectUpdateCached.ObjectData.forEach((obj) =>
|
||||
for (const obj of objectUpdateCached.ObjectData)
|
||||
{
|
||||
rmo.ObjectData.push({
|
||||
CacheMissType: 0,
|
||||
ID: obj.ID
|
||||
});
|
||||
});
|
||||
circuit.sendMessage(rmo, 0);
|
||||
if (!this.objects[obj.ID])
|
||||
{
|
||||
rmo.ObjectData.push({
|
||||
CacheMissType: 0,
|
||||
ID: obj.ID
|
||||
});
|
||||
}
|
||||
}
|
||||
if (rmo.ObjectData.length > 0)
|
||||
{
|
||||
circuit.sendMessage(rmo, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Message.ObjectUpdateCompressed:
|
||||
{
|
||||
const objectUpdateCompressed = packet.message as ObjectUpdateCompressedMessage;
|
||||
@@ -313,7 +424,7 @@ export class ObjectStoreFull implements IObjectStore
|
||||
|
||||
pos += result.readLength;
|
||||
o.Text = result.result;
|
||||
o.TextColor = buf.slice(pos, pos + 4);
|
||||
o.TextColor = new Color4(buf, pos, false, true);
|
||||
pos = pos + 4;
|
||||
}
|
||||
else
|
||||
@@ -329,7 +440,7 @@ export class ObjectStoreFull implements IObjectStore
|
||||
}
|
||||
if (compressedflags & CompressedFlags.HasParticles)
|
||||
{
|
||||
// TODO: Particle system block
|
||||
o.Particles = new ParticleSystem(buf.slice(pos, pos + 86), 0);
|
||||
pos += 86;
|
||||
}
|
||||
|
||||
@@ -377,7 +488,7 @@ export class ObjectStoreFull implements IObjectStore
|
||||
pos = pos + 2;
|
||||
const textureEntryLength = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
// TODO: Properly parse textureentry;
|
||||
o.TextureEntry = new TextureEntry(buf.slice(pos, pos + textureEntryLength));
|
||||
pos = pos + textureEntryLength;
|
||||
|
||||
if (compressedflags & CompressedFlags.TextureAnimation)
|
||||
@@ -394,9 +505,82 @@ export class ObjectStoreFull implements IObjectStore
|
||||
break;
|
||||
}
|
||||
case Message.ImprovedTerseObjectUpdate:
|
||||
{
|
||||
const objectUpdateTerse = packet.message as ImprovedTerseObjectUpdateMessage;
|
||||
// TODO: ImprovedTerseObjectUpdate
|
||||
const dilation = objectUpdateTerse.RegionData.TimeDilation / 65535.0;
|
||||
|
||||
for (let i = 0; i < objectUpdateTerse.ObjectData.length; i++)
|
||||
{
|
||||
const objectData = objectUpdateTerse.ObjectData[i];
|
||||
if (!(this.options & BotOptionFlags.StoreMyAttachmentsOnly))
|
||||
{
|
||||
let pos = 0;
|
||||
const localID = objectData.Data.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
if (this.objects[localID])
|
||||
{
|
||||
this.objects[localID].State = objectData.Data.readUInt8(pos++);
|
||||
const avatar: boolean = (objectData.Data.readUInt8(pos++) !== 0);
|
||||
if (avatar)
|
||||
{
|
||||
this.objects[localID].CollisionPlane = new Vector4(objectData.Data, pos);
|
||||
pos += 16;
|
||||
}
|
||||
this.objects[localID].Position = new Vector3(objectData.Data, pos);
|
||||
pos += 12;
|
||||
this.objects[localID].Velocity = new Vector3([
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos), -128.0, 128.0),
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 2), -128.0, 128.0),
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 4), -128.0, 128.0)
|
||||
]);
|
||||
pos += 6;
|
||||
this.objects[localID].Acceleration = new Vector3([
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos), -64.0, 64.0),
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 2), -64.0, 64.0),
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 4), -64.0, 64.0)
|
||||
]);
|
||||
pos += 6;
|
||||
this.objects[localID].Rotation = new Quaternion([
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos), -1.0, 1.0),
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 2), -1.0, 1.0),
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 4), -1.0, 1.0),
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 6), -1.0, 1.0)
|
||||
]);
|
||||
pos += 8;
|
||||
this.objects[localID].AngularVelocity = new Vector3([
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos), -64.0, 64.0),
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 2), -64.0, 64.0),
|
||||
Utils.UInt16ToFloat(objectData.Data.readUInt16LE(pos + 4), -64.0, 64.0)
|
||||
]);
|
||||
pos += 6;
|
||||
|
||||
if (objectData.TextureEntry.length > 0)
|
||||
{
|
||||
// No idea why the first four bytes are skipped here.
|
||||
this.objects[localID].TextureEntry = new TextureEntry(objectData.TextureEntry.slice(4));
|
||||
}
|
||||
this.insertIntoRtree(this.objects[localID]);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Received terse update for object ' + localID + ' which is not in the store, so requesting the object');
|
||||
// We don't know about this object, so request it
|
||||
const rmo = new RequestMultipleObjectsMessage();
|
||||
rmo.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
rmo.ObjectData = [];
|
||||
rmo.ObjectData.push({
|
||||
CacheMissType: 0,
|
||||
ID: localID
|
||||
});
|
||||
circuit.sendMessage(rmo, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Message.MultipleObjectUpdate:
|
||||
const multipleObjectUpdate = packet.message as MultipleObjectUpdateMessage;
|
||||
// TODO: multipleObjectUpdate
|
||||
@@ -509,6 +693,29 @@ export class ObjectStoreFull implements IObjectStore
|
||||
return result;
|
||||
}
|
||||
|
||||
getObjectByUUID(fullID: UUID | string): IGameObject
|
||||
{
|
||||
if (fullID instanceof UUID)
|
||||
{
|
||||
fullID = fullID.toString();
|
||||
}
|
||||
if (!this.objectsByUUID[fullID])
|
||||
{
|
||||
throw new Error('No object found with that UUID');
|
||||
}
|
||||
const localID: number = this.objectsByUUID[fullID];
|
||||
return this.objects[localID];
|
||||
}
|
||||
|
||||
getObjectByLocalID(localID: number): IGameObject
|
||||
{
|
||||
if (!this.objects[localID])
|
||||
{
|
||||
throw new Error('No object found with that UUID');
|
||||
}
|
||||
return this.objects[localID];
|
||||
}
|
||||
|
||||
parseNameValues(str: string): { [key: string]: NameValue }
|
||||
{
|
||||
const nv: { [key: string]: NameValue } = {};
|
||||
|
||||
@@ -457,4 +457,27 @@ export class ObjectStoreLite implements IObjectStore
|
||||
{
|
||||
throw new Error('GetObjectsInArea not available with the Lite object store.');
|
||||
}
|
||||
|
||||
getObjectByUUID(fullID: UUID | string): IGameObject
|
||||
{
|
||||
if (fullID instanceof UUID)
|
||||
{
|
||||
fullID = fullID.toString();
|
||||
}
|
||||
if (!this.objectsByUUID[fullID])
|
||||
{
|
||||
throw new Error('No object found with that UUID');
|
||||
}
|
||||
const localID: number = this.objectsByUUID[fullID];
|
||||
return this.objects[localID];
|
||||
}
|
||||
|
||||
getObjectByLocalID(localID: number): IGameObject
|
||||
{
|
||||
if (!this.objects[localID])
|
||||
{
|
||||
throw new Error('No object found with that UUID');
|
||||
}
|
||||
return this.objects[localID];
|
||||
}
|
||||
}
|
||||
|
||||
186
lib/classes/ParticleSystem.ts
Normal file
186
lib/classes/ParticleSystem.ts
Normal file
@@ -0,0 +1,186 @@
|
||||
import {BlendFunc} from '../enums/BlendFunc';
|
||||
import {SourcePattern} from '../enums/SourcePattern';
|
||||
import {Vector3} from './Vector3';
|
||||
import {UUID} from './UUID';
|
||||
import {ParticleDataFlags} from '../enums/ParticleDataFlags';
|
||||
import {Color4} from './Color4';
|
||||
|
||||
export class ParticleSystem
|
||||
{
|
||||
startGlow = 0.0;
|
||||
endGlow = 0.0;
|
||||
blendFuncSource: BlendFunc = BlendFunc.SourceAlpha;
|
||||
blendFuncDest: BlendFunc = BlendFunc.OneMinusSourceAlpha;
|
||||
crc = 0;
|
||||
pattern: SourcePattern = SourcePattern.None;
|
||||
maxAge = 0.0;
|
||||
startAge = 0.0;
|
||||
innerAngle = 0.0;
|
||||
outerAngle = 0.0;
|
||||
burstRate = 0.0;
|
||||
burstRadius = 0.0;
|
||||
burstSpeedMin = 0.0;
|
||||
burstSpeedMax = 0.0;
|
||||
burstPartCount = 0;
|
||||
angularVelocity = Vector3.getZero();
|
||||
acceleration = Vector3.getZero();
|
||||
texture = UUID.zero();
|
||||
target = UUID.zero();
|
||||
dataFlags: ParticleDataFlags = ParticleDataFlags.None;
|
||||
partMaxAge = 0.0;
|
||||
startColor = Color4.black;
|
||||
endColor = Color4.black;
|
||||
startScaleX = 0.0;
|
||||
startScaleY = 0.0;
|
||||
endScaleX = 0.0;
|
||||
endScaleY = 0.0;
|
||||
flags = 0;
|
||||
|
||||
static unpackFixed(buf: Buffer, pos: number, signed: boolean, intBits: number, fracBits: number): number
|
||||
{
|
||||
let totalBits = intBits + fracBits;
|
||||
let fixedVal = 0.0;
|
||||
if (signed)
|
||||
{
|
||||
totalBits++;
|
||||
}
|
||||
const maxVal = 1 << intBits;
|
||||
|
||||
if (totalBits <= 8)
|
||||
{
|
||||
fixedVal = buf.readUInt8(pos);
|
||||
}
|
||||
else if (totalBits <= 16)
|
||||
{
|
||||
fixedVal = buf.readUInt16LE(pos);
|
||||
}
|
||||
else if (totalBits <= 31)
|
||||
{
|
||||
fixedVal = buf.readUInt32LE(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
fixedVal /= (1 << fracBits);
|
||||
|
||||
if (signed)
|
||||
{
|
||||
fixedVal -= maxVal;
|
||||
}
|
||||
return fixedVal;
|
||||
}
|
||||
|
||||
constructor(buf: Buffer, pos: number)
|
||||
{
|
||||
const size = buf.length - pos;
|
||||
if (size === 86) // Legacy data block size
|
||||
{
|
||||
pos = this.unpackSystem(buf, pos);
|
||||
pos = this.unpackLegacyData(buf, pos);
|
||||
}
|
||||
else if (size > 86 && size <= 98)
|
||||
{
|
||||
const sysSize = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
if (sysSize !== 68)
|
||||
{
|
||||
console.error('Particle system block size ' + sysSize + ' different from expected 68 bytes');
|
||||
return;
|
||||
}
|
||||
pos = this.unpackSystem(buf, pos);
|
||||
const dataSize = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
pos = this.unpackLegacyData(buf, pos);
|
||||
|
||||
if ((this.dataFlags & ParticleDataFlags.DataGlow) === ParticleDataFlags.DataGlow)
|
||||
{
|
||||
let glow = buf.readUInt8(pos++);
|
||||
this.startGlow = glow / 255.0;
|
||||
glow = buf.readUInt8(pos++);
|
||||
this.endGlow = glow / 255.0;
|
||||
}
|
||||
if ((this.dataFlags & ParticleDataFlags.DataBlend) === ParticleDataFlags.DataBlend)
|
||||
{
|
||||
this.blendFuncSource = buf.readUInt8(pos++);
|
||||
this.blendFuncDest = buf.readUInt8(pos++);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error('WARNING: Paricle system size of ' + size + ' bytes exceeds maximum block size of 98');
|
||||
}
|
||||
}
|
||||
|
||||
unpackSystem(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.crc = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.flags = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.pattern = buf.readUInt8(pos++);
|
||||
this.maxAge = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.startAge = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.innerAngle = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.outerAngle = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.burstRate = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.burstRadius = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.burstSpeedMin = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.burstSpeedMax = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.burstPartCount = buf.readUInt8(pos++);
|
||||
this.angularVelocity = new Vector3([
|
||||
ParticleSystem.unpackFixed(buf, pos, true, 8, 7),
|
||||
ParticleSystem.unpackFixed(buf, pos + 2, true, 8, 7),
|
||||
ParticleSystem.unpackFixed(buf, pos + 4, true, 8, 7),
|
||||
]);
|
||||
pos = pos + 6;
|
||||
this.acceleration = new Vector3([
|
||||
ParticleSystem.unpackFixed(buf, pos, true, 8, 7),
|
||||
ParticleSystem.unpackFixed(buf, pos + 2, true, 8, 7),
|
||||
ParticleSystem.unpackFixed(buf, pos + 4, true, 8, 7),
|
||||
]);
|
||||
pos = pos + 6;
|
||||
this.texture = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.target = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
if (pos - startPos !== 68)
|
||||
{
|
||||
console.log('INVALID SIZE: ' + (pos - startPos));
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
unpackLegacyData(buf: Buffer, pos: number): number
|
||||
{
|
||||
this.dataFlags = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.partMaxAge = ParticleSystem.unpackFixed(buf, pos, false, 8, 8);
|
||||
pos += 2;
|
||||
this.startColor = new Color4(
|
||||
buf.readUInt8(pos++),
|
||||
buf.readUInt8(pos++),
|
||||
buf.readUInt8(pos++),
|
||||
buf.readUInt8(pos++),
|
||||
);
|
||||
this.endColor = new Color4(
|
||||
buf.readUInt8(pos++),
|
||||
buf.readUInt8(pos++),
|
||||
buf.readUInt8(pos++),
|
||||
buf.readUInt8(pos++),
|
||||
);
|
||||
this.startScaleX = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.startScaleY = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.endScaleX = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
this.endScaleY = ParticleSystem.unpackFixed(buf, pos++, false, 3, 5);
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
362
lib/classes/TextureEntry.ts
Normal file
362
lib/classes/TextureEntry.ts
Normal file
@@ -0,0 +1,362 @@
|
||||
import {TextureEntryFace} from './TextureEntryFace';
|
||||
import {UUID} from './UUID';
|
||||
import {Color4} from './Color4';
|
||||
import {Utils} from './Utils';
|
||||
|
||||
export class TextureEntry
|
||||
{
|
||||
defaultTexture: TextureEntryFace | null;
|
||||
faces: TextureEntryFace[] = [];
|
||||
|
||||
static readFaceBitfield(buf: Buffer, pos: number): {
|
||||
result: boolean,
|
||||
pos: number,
|
||||
faceBits: number,
|
||||
bitfieldSize: number
|
||||
}
|
||||
{
|
||||
const result = {
|
||||
result: false,
|
||||
pos: pos,
|
||||
faceBits: 0,
|
||||
bitfieldSize: 0
|
||||
};
|
||||
if (result.pos >= buf.length)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
let b = 0;
|
||||
do
|
||||
{
|
||||
b = buf.readUInt8(result.pos);
|
||||
result.faceBits = (result.faceBits << 7) | (b & 0x7F);
|
||||
result.bitfieldSize += 7;
|
||||
result.pos++;
|
||||
}
|
||||
while ((b & 0x80) !== 0);
|
||||
result.result = (result.faceBits !== 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
constructor(buf: Buffer)
|
||||
{
|
||||
if (buf.length < 16)
|
||||
{
|
||||
this.defaultTexture = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.defaultTexture = new TextureEntryFace(null);
|
||||
let pos = 0;
|
||||
let i = pos;
|
||||
|
||||
// Texture
|
||||
{
|
||||
this.defaultTexture.textureID = new UUID(buf, i);
|
||||
i += 16;
|
||||
|
||||
let done = false;
|
||||
while (!done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const uuid = new UUID(buf, i);
|
||||
i += 16;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].textureID = uuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Colour
|
||||
{
|
||||
this.defaultTexture.rgba = new Color4(buf, i, true);
|
||||
i += 4;
|
||||
|
||||
let done = false;
|
||||
while (!done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const tmpColor = new Color4(buf, i, true);
|
||||
i += 4;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].rgba = tmpColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RepeatU
|
||||
{
|
||||
this.defaultTexture.repeatU = buf.readFloatLE(i);
|
||||
i += 4;
|
||||
|
||||
let done = false;
|
||||
while (!done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const tmpFloat = buf.readFloatLE(i);
|
||||
i += 4;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].repeatU = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RepeatV
|
||||
{
|
||||
this.defaultTexture.repeatV = buf.readFloatLE(i);
|
||||
i += 4;
|
||||
|
||||
let done = false;
|
||||
while (!done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const tmpFloat = buf.readFloatLE(i);
|
||||
i += 4;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].repeatV = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OffsetU
|
||||
{
|
||||
this.defaultTexture.offsetU = Utils.ReadOffsetFloat(buf, i);
|
||||
i += 2;
|
||||
|
||||
let done = false;
|
||||
while (!done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const tmpFloat = Utils.ReadOffsetFloat(buf, i);
|
||||
i += 2;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].offsetU = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OffsetV
|
||||
{
|
||||
this.defaultTexture.offsetV = Utils.ReadOffsetFloat(buf, i);
|
||||
i += 2;
|
||||
|
||||
let done = false;
|
||||
while (!done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const tmpFloat = Utils.ReadOffsetFloat(buf, i);
|
||||
i += 2;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].offsetV = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Rotation
|
||||
{
|
||||
this.defaultTexture.rotation = Utils.ReadRotationFloat(buf, i);
|
||||
i += 2;
|
||||
|
||||
let done = false;
|
||||
while (!done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const tmpFloat = Utils.ReadRotationFloat(buf, i);
|
||||
i += 2;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].rotation = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Material
|
||||
{
|
||||
this.defaultTexture.materialb = buf[i++];
|
||||
|
||||
let done = false;
|
||||
while (!done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const tmpByte = buf[i++];
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].materialb = tmpByte;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Media
|
||||
{
|
||||
this.defaultTexture.mediab = buf[i++];
|
||||
|
||||
let done = false;
|
||||
while (i - pos < buf.length && !done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const tmpByte = buf[i++];
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].mediab = tmpByte;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Glow
|
||||
{
|
||||
this.defaultTexture.glow = Utils.ReadGlowFloat(buf, i++);
|
||||
|
||||
let done = false;
|
||||
while (!done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const tmpFloat = Utils.ReadGlowFloat(buf, i++);
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].glow = tmpFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MaterialID
|
||||
{
|
||||
const len = i - pos + 16;
|
||||
if (i - pos + 16 <= buf.length)
|
||||
{
|
||||
this.defaultTexture.materialID = new UUID(buf, i);
|
||||
i += 16;
|
||||
|
||||
let done = false;
|
||||
while (i - pos + 16 <= buf.length && !done)
|
||||
{
|
||||
const result = TextureEntry.readFaceBitfield(buf, i);
|
||||
done = !result.result;
|
||||
i = result.pos;
|
||||
if (!done)
|
||||
{
|
||||
const uuid = new UUID(buf, i);
|
||||
i += 16;
|
||||
for (let face = 0, bit = 1; face < result.bitfieldSize; face++, bit <<= 1)
|
||||
{
|
||||
if ((result.faceBits & bit) !== 0)
|
||||
{
|
||||
this.createFace(face);
|
||||
this.faces[face].materialID = uuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private createFace(face: number)
|
||||
{
|
||||
if (face > 32)
|
||||
{
|
||||
console.error('Warning: Face number exceeds maximum number of faces: 32');
|
||||
}
|
||||
while (this.faces.length <= face)
|
||||
{
|
||||
this.faces.push(new TextureEntryFace(this.defaultTexture));
|
||||
}
|
||||
}
|
||||
}
|
||||
43
lib/classes/TextureEntryFace.ts
Normal file
43
lib/classes/TextureEntryFace.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import {UUID} from './UUID';
|
||||
import {Color4} from './Color4';
|
||||
import {TextureFlags} from '../enums/TextureFlags';
|
||||
|
||||
export class TextureEntryFace
|
||||
{
|
||||
private BUMP_MASK = 0x1F;
|
||||
private FULLBRIGHT_MASK = 0x20;
|
||||
private SHINY_MASK = 0xC0;
|
||||
private MEDIA_MASK = 0x01;
|
||||
private TEX_MAP_MASK = 0x06;
|
||||
|
||||
textureID: UUID;
|
||||
rgba: Color4;
|
||||
repeatU: number;
|
||||
repeatV: number;
|
||||
offsetU: number;
|
||||
offsetV: number;
|
||||
rotation: number;
|
||||
materialb: number;
|
||||
mediab: number;
|
||||
glow: number;
|
||||
materialID: UUID;
|
||||
|
||||
private hasAttribute: TextureFlags;
|
||||
private defaultTexture: TextureEntryFace | null;
|
||||
|
||||
constructor(def: TextureEntryFace | null)
|
||||
{
|
||||
this.rgba = Color4.white;
|
||||
this.repeatU = 1.0;
|
||||
this.repeatV = 1.0;
|
||||
this.defaultTexture = def;
|
||||
if (this.defaultTexture == null)
|
||||
{
|
||||
this.hasAttribute = TextureFlags.All;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hasAttribute = TextureFlags.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,6 +115,23 @@ export class Utils
|
||||
}
|
||||
}
|
||||
|
||||
static ByteToFloat(byte: number, lower: number, upper: number)
|
||||
{
|
||||
const ONE_OVER_BYTEMAX: number = 1.0 / 255;
|
||||
|
||||
let fval: number = byte * ONE_OVER_BYTEMAX;
|
||||
const delta: number = (upper - lower);
|
||||
fval *= delta;
|
||||
fval += lower;
|
||||
|
||||
const error: number = delta * ONE_OVER_BYTEMAX;
|
||||
if (Math.abs(fval) < error)
|
||||
{
|
||||
fval = 0.0;
|
||||
}
|
||||
return fval;
|
||||
}
|
||||
|
||||
static UInt16ToFloat(val: number, lower: number, upper: number)
|
||||
{
|
||||
const ONE_OVER_U16_MAX = 1.0 / 65535;
|
||||
@@ -148,4 +165,17 @@ export class Utils
|
||||
}
|
||||
return new Long(parseInt(hex.substr(8), 16), parseInt(hex.substr(0, 8), 16));
|
||||
}
|
||||
}
|
||||
static ReadRotationFloat(buf: Buffer, pos: number): number
|
||||
{
|
||||
return ((buf[pos] | (buf[pos + 1] << 8)) / 32768.0) * (2 * Math.PI);
|
||||
}
|
||||
static ReadGlowFloat(buf: Buffer, pos: number): number
|
||||
{
|
||||
return buf[pos] / 255;
|
||||
}
|
||||
static ReadOffsetFloat(buf: Buffer, pos: number): number
|
||||
{
|
||||
const offset = buf.readInt16LE(pos);
|
||||
return offset / 32767.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,39 +5,170 @@ import {RegionHandleRequestMessage} from '../messages/RegionHandleRequest';
|
||||
import {Message} from '../../enums/Message';
|
||||
import {FilterResponse} from '../../enums/FilterResponse';
|
||||
import {RegionIDAndHandleReplyMessage} from '../messages/RegionIDAndHandleReply';
|
||||
import {PacketFlags} from '../..';
|
||||
import {PacketFlags, Vector3} from '../..';
|
||||
import {IGameObject} from '../interfaces/IGameObject';
|
||||
import {ObjectGrabMessage} from '../messages/ObjectGrab';
|
||||
import {ObjectDeGrabMessage} from '../messages/ObjectDeGrab';
|
||||
import {ObjectGrabUpdateMessage} from '../messages/ObjectGrabUpdate';
|
||||
|
||||
export class RegionCommands extends CommandsBase
|
||||
{
|
||||
getRegionHandle(regionID: UUID): Promise<Long>
|
||||
async getRegionHandle(regionID: UUID): Promise<Long>
|
||||
{
|
||||
return new Promise<Long>((resolve, reject) =>
|
||||
const circuit = this.currentRegion.circuit;
|
||||
const msg: RegionHandleRequestMessage = new RegionHandleRequestMessage();
|
||||
msg.RequestBlock = {
|
||||
RegionID: regionID,
|
||||
};
|
||||
circuit.sendMessage(msg, PacketFlags.Reliable);
|
||||
const responseMsg: RegionIDAndHandleReplyMessage = await circuit.waitForMessage<RegionIDAndHandleReplyMessage>(Message.RegionIDAndHandleReply, 10000, (filterMsg: RegionIDAndHandleReplyMessage): FilterResponse =>
|
||||
{
|
||||
const circuit = this.currentRegion.circuit;
|
||||
const msg: RegionHandleRequestMessage = new RegionHandleRequestMessage();
|
||||
msg.RequestBlock = {
|
||||
RegionID: regionID,
|
||||
};
|
||||
circuit.sendMessage(msg, PacketFlags.Reliable);
|
||||
circuit.waitForMessage<RegionIDAndHandleReplyMessage>(Message.RegionIDAndHandleReply, 10000, (filterMsg: RegionIDAndHandleReplyMessage): FilterResponse =>
|
||||
if (filterMsg.ReplyBlock.RegionID.toString() === regionID.toString())
|
||||
{
|
||||
if (filterMsg.ReplyBlock.RegionID.toString() === regionID.toString())
|
||||
{
|
||||
return FilterResponse.Finish;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FilterResponse.NoMatch;
|
||||
}
|
||||
}).then((responseMsg: RegionIDAndHandleReplyMessage) =>
|
||||
return FilterResponse.Finish;
|
||||
}
|
||||
else
|
||||
{
|
||||
resolve(responseMsg.ReplyBlock.RegionHandle);
|
||||
});
|
||||
return FilterResponse.NoMatch;
|
||||
}
|
||||
});
|
||||
return responseMsg.ReplyBlock.RegionHandle;
|
||||
}
|
||||
|
||||
getObjectsInArea(minX: number, maxX: number, minY: number, maxY: number, minZ: number, maxZ: number): IGameObject[]
|
||||
{
|
||||
return this.currentRegion.objects.getObjectsInArea(minX, maxX, minY, maxY, minZ, maxZ);
|
||||
}
|
||||
|
||||
async grabObject(localID: number | UUID,
|
||||
grabOffset: Vector3 = Vector3.getZero(),
|
||||
uvCoordinate: Vector3 = Vector3.getZero(),
|
||||
stCoordinate: Vector3 = Vector3.getZero(),
|
||||
faceIndex: number = 0,
|
||||
position: Vector3 = Vector3.getZero(),
|
||||
normal: Vector3 = Vector3.getZero(),
|
||||
binormal: Vector3 = Vector3.getZero())
|
||||
{
|
||||
if (localID instanceof UUID)
|
||||
{
|
||||
const obj: IGameObject = this.currentRegion.objects.getObjectByUUID(localID);
|
||||
localID = obj.ID;
|
||||
}
|
||||
const msg = new ObjectGrabMessage();
|
||||
msg.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
msg.ObjectData = {
|
||||
LocalID: localID,
|
||||
GrabOffset: grabOffset
|
||||
};
|
||||
msg.SurfaceInfo = [
|
||||
{
|
||||
UVCoord: uvCoordinate,
|
||||
STCoord: stCoordinate,
|
||||
FaceIndex: faceIndex,
|
||||
Position: position,
|
||||
Normal: normal,
|
||||
Binormal: binormal
|
||||
}
|
||||
];
|
||||
const seqID = this.circuit.sendMessage(msg, PacketFlags.Reliable);
|
||||
await this.circuit.waitForAck(seqID, 10000);
|
||||
}
|
||||
|
||||
async deGrabObject(localID: number | UUID,
|
||||
grabOffset: Vector3 = Vector3.getZero(),
|
||||
uvCoordinate: Vector3 = Vector3.getZero(),
|
||||
stCoordinate: Vector3 = Vector3.getZero(),
|
||||
faceIndex: number = 0,
|
||||
position: Vector3 = Vector3.getZero(),
|
||||
normal: Vector3 = Vector3.getZero(),
|
||||
binormal: Vector3 = Vector3.getZero())
|
||||
{
|
||||
if (localID instanceof UUID)
|
||||
{
|
||||
const obj: IGameObject = this.currentRegion.objects.getObjectByUUID(localID);
|
||||
localID = obj.ID;
|
||||
}
|
||||
const msg = new ObjectDeGrabMessage();
|
||||
msg.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
msg.ObjectData = {
|
||||
LocalID: localID
|
||||
};
|
||||
msg.SurfaceInfo = [
|
||||
{
|
||||
UVCoord: uvCoordinate,
|
||||
STCoord: stCoordinate,
|
||||
FaceIndex: faceIndex,
|
||||
Position: position,
|
||||
Normal: normal,
|
||||
Binormal: binormal
|
||||
}
|
||||
];
|
||||
const seqID = this.circuit.sendMessage(msg, PacketFlags.Reliable);
|
||||
await this.circuit.waitForAck(seqID, 10000);
|
||||
}
|
||||
|
||||
async dragGrabbedObject(localID: number | UUID,
|
||||
grabPosition: Vector3,
|
||||
grabOffset: Vector3 = Vector3.getZero(),
|
||||
uvCoordinate: Vector3 = Vector3.getZero(),
|
||||
stCoordinate: Vector3 = Vector3.getZero(),
|
||||
faceIndex: number = 0,
|
||||
position: Vector3 = Vector3.getZero(),
|
||||
normal: Vector3 = Vector3.getZero(),
|
||||
binormal: Vector3 = Vector3.getZero())
|
||||
{
|
||||
// For some reason this message takes a UUID when the others take a LocalID - wtf?
|
||||
if (!(localID instanceof UUID))
|
||||
{
|
||||
const obj: IGameObject = this.currentRegion.objects.getObjectByLocalID(localID);
|
||||
localID = obj.FullID;
|
||||
}
|
||||
const msg = new ObjectGrabUpdateMessage();
|
||||
msg.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
msg.ObjectData = {
|
||||
ObjectID: localID,
|
||||
GrabOffsetInitial: grabOffset,
|
||||
GrabPosition: grabPosition,
|
||||
TimeSinceLast: 0
|
||||
};
|
||||
msg.SurfaceInfo = [
|
||||
{
|
||||
UVCoord: uvCoordinate,
|
||||
STCoord: stCoordinate,
|
||||
FaceIndex: faceIndex,
|
||||
Position: position,
|
||||
Normal: normal,
|
||||
Binormal: binormal
|
||||
}
|
||||
];
|
||||
const seqID = this.circuit.sendMessage(msg, PacketFlags.Reliable);
|
||||
await this.circuit.waitForAck(seqID, 10000);
|
||||
}
|
||||
|
||||
async touchObject(localID: number | UUID,
|
||||
grabOffset: Vector3 = Vector3.getZero(),
|
||||
uvCoordinate: Vector3 = Vector3.getZero(),
|
||||
stCoordinate: Vector3 = Vector3.getZero(),
|
||||
faceIndex: number = 0,
|
||||
position: Vector3 = Vector3.getZero(),
|
||||
normal: Vector3 = Vector3.getZero(),
|
||||
binormal: Vector3 = Vector3.getZero())
|
||||
{
|
||||
if (localID instanceof UUID)
|
||||
{
|
||||
const obj: IGameObject = this.currentRegion.objects.getObjectByUUID(localID);
|
||||
localID = obj.ID;
|
||||
}
|
||||
await this.grabObject(localID, grabOffset, uvCoordinate, stCoordinate, faceIndex, position, normal, binormal);
|
||||
await this.deGrabObject(localID, grabOffset, uvCoordinate, stCoordinate, faceIndex, position, normal, binormal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
import {ITreeBoundingBox} from './ITreeBoundingBox';
|
||||
import {UUID} from '../UUID';
|
||||
import {PCode} from '../../enums/PCode';
|
||||
|
||||
export interface IGameObject
|
||||
{
|
||||
ID: number;
|
||||
FullID: UUID;
|
||||
ParentID: number;
|
||||
OwnerID: UUID;
|
||||
IsAttachment: boolean;
|
||||
PCode: PCode;
|
||||
rtreeEntry?: ITreeBoundingBox;
|
||||
hasNameValueEntry(key: string): boolean;
|
||||
getNameValueEntry(key: string): string;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {IGameObject} from './IGameObject';
|
||||
import {RBush3D} from 'rbush-3d/dist';
|
||||
import {GameObjectFull} from '../GameObjectFull';
|
||||
import {UUID} from '../UUID';
|
||||
|
||||
export interface IObjectStore
|
||||
{
|
||||
@@ -8,4 +9,6 @@ export interface IObjectStore
|
||||
getObjectsByParent(parentID: number): IGameObject[];
|
||||
shutdown(): void;
|
||||
getObjectsInArea(minX: number, maxX: number, minY: number, maxY: number, minZ: number, maxZ: number): GameObjectFull[];
|
||||
getObjectByUUID(fullID: UUID): IGameObject;
|
||||
getObjectByLocalID(ID: number): IGameObject;
|
||||
}
|
||||
|
||||
13
lib/enums/BlendFunc.ts
Normal file
13
lib/enums/BlendFunc.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export enum BlendFunc
|
||||
{
|
||||
One = 0,
|
||||
Zero = 1,
|
||||
DestColor = 2,
|
||||
SourceColor = 3,
|
||||
OneMinusDestColor = 4,
|
||||
OneMinusSourceColor = 5,
|
||||
DestAlpha = 6,
|
||||
SourceAlpha = 7,
|
||||
OneMinusDestAlpha = 8,
|
||||
OneMinusSourceAlpha = 9
|
||||
}
|
||||
17
lib/enums/ParticleDataFlags.ts
Normal file
17
lib/enums/ParticleDataFlags.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export enum ParticleDataFlags
|
||||
{
|
||||
None = 0,
|
||||
InterpColor = 0x001,
|
||||
InterpScale = 0x002,
|
||||
Bounce = 0x004,
|
||||
Wind = 0x008,
|
||||
FollowSrc = 0x010,
|
||||
FollowVelocity = 0x020,
|
||||
TargetPos = 0x040,
|
||||
TargetLinear = 0x080,
|
||||
Emissive = 0x100,
|
||||
Beam = 0x200,
|
||||
Ribbon = 0x400,
|
||||
DataGlow = 0x10000,
|
||||
DataBlend = 0x20000
|
||||
}
|
||||
9
lib/enums/SourcePattern.ts
Normal file
9
lib/enums/SourcePattern.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export enum SourcePattern
|
||||
{
|
||||
None = 0,
|
||||
Drop = 0x01,
|
||||
Explode = 0x02,
|
||||
Angle = 0x04,
|
||||
AngleCone = 0x08,
|
||||
AngleConeEmpty = 0x10
|
||||
}
|
||||
16
lib/enums/TextureFlags.ts
Normal file
16
lib/enums/TextureFlags.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export enum TextureFlags
|
||||
{
|
||||
None = 0,
|
||||
TextureID = 1 << 0,
|
||||
RGBA = 1 << 1,
|
||||
RepeatU = 1 << 2,
|
||||
RepeatV = 1 << 3,
|
||||
OffsetU = 1 << 4,
|
||||
OffsetV = 1 << 5,
|
||||
Rotation = 1 << 6,
|
||||
Material = 1 << 7,
|
||||
Media = 1 << 8,
|
||||
Glow = 1 << 9,
|
||||
MaterialID = 1 << 10,
|
||||
All = 0xFFFFFFFF
|
||||
}
|
||||
@@ -50,6 +50,10 @@ import {FriendRemovedEvent} from './events/FriendRemovedEvent';
|
||||
import {GlobalPosition} from './classes/public/interfaces/GlobalPosition';
|
||||
import {MapLocation} from './classes/public/interfaces/MapLocation';
|
||||
import {Vector2} from './classes/Vector2';
|
||||
import {ParticleDataFlags} from './enums/ParticleDataFlags';
|
||||
import {TextureFlags} from './enums/TextureFlags';
|
||||
import {SourcePattern} from './enums/SourcePattern';
|
||||
import {BlendFunc} from './enums/BlendFunc';
|
||||
|
||||
export {
|
||||
Bot,
|
||||
@@ -80,6 +84,10 @@ export {
|
||||
TeleportFlags,
|
||||
RegionFlags,
|
||||
RightsFlags,
|
||||
ParticleDataFlags,
|
||||
TextureFlags,
|
||||
SourcePattern,
|
||||
BlendFunc,
|
||||
|
||||
// Events
|
||||
ChatEvent,
|
||||
|
||||
Reference in New Issue
Block a user