diff --git a/libsecondlife-cs/NetworkManager.cs b/libsecondlife-cs/NetworkManager.cs index 1cb7a617..275e24d7 100644 --- a/libsecondlife-cs/NetworkManager.cs +++ b/libsecondlife-cs/NetworkManager.cs @@ -1168,6 +1168,8 @@ namespace libsecondlife /// private void Shutdown() { + Client.Log("NetworkManager shutdown initiated", Helpers.LogLevel.Info); + lock (Simulators) { // Disconnect all simulators except the current one diff --git a/libsecondlife-cs/ObjectManager.cs b/libsecondlife-cs/ObjectManager.cs index 0637a2d9..a4680ecc 100644 --- a/libsecondlife-cs/ObjectManager.cs +++ b/libsecondlife-cs/ObjectManager.cs @@ -150,8 +150,11 @@ namespace libsecondlife /// public enum PermissionWho { + /// Group = 4, + /// Everyone = 8, + /// NextOwner = 16 } @@ -161,46 +164,151 @@ namespace libsecondlife [Flags] public enum PermissionType { + /// Copy = 0x00008000, + /// Modify = 0x00004000, + /// Move = 0x00080000, + /// Transfer = 0x00002000 } + /// + /// + /// public enum AttachmentPoint { + /// Chest = 1, + /// Skull, + /// LeftShoulder, + /// RightShoulder, + /// LeftHand, + /// RightHand, + /// LeftFoot, + /// RightFoot, + /// Spine, + /// Pelvis, + /// Mouth, + /// Chin, + /// LeftEar, + /// RightEar, + /// LeftEyeball, + /// RightEyeball, + /// Nose, + /// RightUpperArm, + /// RightForarm, + /// LeftUpperArm, + /// LeftForearm, + /// RightHip, + /// RightUpperLeg, + /// RightLowerLeg, + /// LeftHip, + /// LeftUpperLeg, + /// LeftLowerLeg, + /// Stomach, + /// LeftPec, + /// RightPec } + /// + /// + /// + public enum Tree + { + /// + Pine1 = 0, + /// + Oak, + /// + TropicalBush1, + /// + Palm1, + /// + Dogwood, + /// + TropicalBush2, + /// + Palm2, + /// + Cypress1, + /// + Cypress2, + /// + Pine2, + /// + Plumeria, + /// + WinterPine1, + /// + WinterAspen, + /// + WinterPine2, + /// + Eucalyptus, + /// + Fern, + /// + Eelgrass, + /// + SeaSword, + /// + Kelp1, + /// + BeachGrass1, + /// + Kelp2 + } + + /// + /// + /// + public enum Grass + { + /// + Grass0 = 0, + /// + Grass1, + /// + Grass2, + /// + Grass3, + /// + Grass4, + /// + undergrowth_1 + } + /// /// This event will be raised for every ObjectUpdate block that /// contains a new prim. @@ -295,16 +403,16 @@ namespace libsecondlife Client.Network.SendPacket(request, simulator); } - public void AddPrim(Simulator simulator, PrimObject prim, LLVector3 nearPosition, LLUUID groupID) + public void AddPrim(Simulator simulator, PrimObject prim, LLVector3 nearPosition) { ObjectAddPacket packet = new ObjectAddPacket(); packet.AgentData.AgentID = Client.Network.AgentID; packet.AgentData.SessionID = Client.Network.SessionID; - packet.AgentData.GroupID = groupID; + packet.AgentData.GroupID = prim.GroupID; - packet.ObjectData.State = 0; - packet.ObjectData.AddFlags = 2; + packet.ObjectData.State = (byte)prim.State; + packet.ObjectData.AddFlags = 2; // TODO: Why 2? packet.ObjectData.PCode = (byte)PCode.Prim; packet.ObjectData.Material = (byte)prim.Material; @@ -342,6 +450,52 @@ namespace libsecondlife Client.Network.SendPacket(packet, simulator); } + public void AddTree(Simulator simulator, LLVector3 scale, LLQuaternion rotation, LLVector3 position, + Tree treeType, LLUUID groupOwner, bool newTree) + { + ObjectAddPacket add = new ObjectAddPacket(); + + add.AgentData.AgentID = Client.Network.AgentID; + add.AgentData.SessionID = Client.Network.SessionID; + add.AgentData.GroupID = groupOwner; + add.ObjectData.BypassRaycast = 1; + add.ObjectData.Material = 3; + add.ObjectData.PathCurve = 16; + add.ObjectData.PCode = newTree ? (byte)PCode.NewTree : (byte)PCode.Tree; + add.ObjectData.RayEnd = position; + add.ObjectData.RayStart = position; + add.ObjectData.RayTargetID = LLUUID.Zero; + add.ObjectData.Rotation = rotation; + add.ObjectData.Scale = scale; + add.ObjectData.State = (byte)treeType; + add.ObjectData.TextureEntry = new byte[0]; + + Client.Network.SendPacket(add, simulator); + } + + public void AddGrass(Simulator simulator, LLVector3 scale, LLQuaternion rotation, LLVector3 position, + Grass grassType, LLUUID groupOwner) + { + ObjectAddPacket add = new ObjectAddPacket(); + + add.AgentData.AgentID = Client.Network.AgentID; + add.AgentData.SessionID = Client.Network.SessionID; + add.AgentData.GroupID = groupOwner; + add.ObjectData.BypassRaycast = 1; + add.ObjectData.Material = 3; + add.ObjectData.PathCurve = 16; + add.ObjectData.PCode = (byte)PCode.Grass; + add.ObjectData.RayEnd = position; + add.ObjectData.RayStart = position; + add.ObjectData.RayTargetID = LLUUID.Zero; + add.ObjectData.Rotation = rotation; + add.ObjectData.Scale = scale; + add.ObjectData.State = (byte)grassType; + add.ObjectData.TextureEntry = new byte[0]; + + Client.Network.SendPacket(add, simulator); + } + public void LinkPrims(Simulator simulator, List localIDs) { ObjectLinkPacket packet = new ObjectLinkPacket(); diff --git a/libsecondlife-cs/ParticleSystem.cs b/libsecondlife-cs/ParticleSystem.cs index a2449d85..d2485aa8 100644 --- a/libsecondlife-cs/ParticleSystem.cs +++ b/libsecondlife-cs/ParticleSystem.cs @@ -12,13 +12,13 @@ namespace libsecondlife public uint PartStartRGBA; public uint PartEndRGBA; - public LLVector3 PartStartScale; - public LLVector3 PartEndScale; + public LLVector3 PartStartScale = LLVector3.Zero; + public LLVector3 PartEndScale = LLVector3.Zero; public float PartMaxAge; public float SrcMaxAge; - public LLVector3 SrcAccel; + public LLVector3 SrcAccel = LLVector3.Zero; public float SrcAngleBegin; public float SrcAngleEnd; @@ -29,10 +29,10 @@ namespace libsecondlife public float SrcBurstSpeedMin; public float SrcBurstSpeedMax; - public LLVector3 SrcOmega; + public LLVector3 SrcOmega = LLVector3.Zero; - public LLUUID SrcTargetKey; - public LLUUID SrcTexture; + public LLUUID SrcTargetKey = LLUUID.Zero; + public LLUUID SrcTexture = LLUUID.Zero; public SourcePattern SrcPattern; public ParticleFlags PartFlags; @@ -68,6 +68,13 @@ namespace libsecondlife Emissive = 0x100 } + /// + /// + /// + public ParticleSystem() + { + } + /// /// /// diff --git a/libsecondlife-cs/Prims.cs b/libsecondlife-cs/Prims.cs index 76d071f6..b2146768 100644 --- a/libsecondlife-cs/Prims.cs +++ b/libsecondlife-cs/Prims.cs @@ -117,6 +117,9 @@ namespace libsecondlife { Client = client; PCode = ObjectManager.PCode.Prim; + Flexible = new PrimFlexibleData(); + Light = new PrimLightData(); + ParticleSys = new ParticleSystem(); Textures = new TextureEntry(); } @@ -454,7 +457,14 @@ namespace libsecondlife /// public float Tension; /// - public LLVector3 Force; + public LLVector3 Force = LLVector3.Zero; + + /// + /// + /// + public PrimFlexibleData() + { + } /// /// @@ -516,6 +526,13 @@ namespace libsecondlife /// public float Falloff; + /// + /// + /// + public PrimLightData() + { + } + /// /// /// diff --git a/libsecondlife-cs/Textures.cs b/libsecondlife-cs/Textures.cs index 4f2f756c..dc260312 100644 --- a/libsecondlife-cs/Textures.cs +++ b/libsecondlife-cs/Textures.cs @@ -90,9 +90,17 @@ namespace libsecondlife /// /// public TextureEntry() + { + FaceTextures = new Dictionary(); + //DefaultTexture = new TextureEntryFace(null); + DefaultTexture = null; + } + + public TextureEntry(LLUUID textureID) { FaceTextures = new Dictionary(); DefaultTexture = new TextureEntryFace(null); + DefaultTexture.TextureID = textureID; } /// @@ -132,6 +140,11 @@ namespace libsecondlife /// public byte[] ToBytes() { + if (DefaultTexture == null) + { + return new byte[0]; + } + MemoryStream memStream = new MemoryStream(); BinaryWriter binWriter = new BinaryWriter(memStream);