From 86f6a33bc8cc88c2e883d6741e6c02810d655960 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Apr 2007 15:30:27 +0000 Subject: More cleaning up of SimClient and packet handling --- OpenSim.RegionServer/OpenSimMain.cs | 16 +++--- OpenSim.RegionServer/SimClient.cs | 98 ++++++++++++++++----------------- OpenSim.RegionServer/world/Primitive.cs | 1 - OpenSim.RegionServer/world/World.cs | 3 +- 4 files changed, 58 insertions(+), 60 deletions(-) (limited to 'OpenSim.RegionServer') diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index ed957af..f004f91 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs @@ -350,13 +350,6 @@ namespace OpenSim LocalWorld.Update(); } - protected virtual void RegisterClientPacketHandlers() - { - SimClient.AddPacketHandler(PacketType.ModifyLand, LocalWorld.ModifyTerrain); - SimClient.AddPacketHandler(PacketType.ChatFromViewer, LocalWorld.SimChat); - SimClient.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName); - } - public void RunCmd(string command, string[] cmdparams) { switch (command) @@ -404,6 +397,15 @@ namespace OpenSim } } + protected virtual void RegisterClientPacketHandlers() + { + SimClient.AddPacketHandler(PacketType.ModifyLand, LocalWorld.ModifyTerrain); + SimClient.AddPacketHandler(PacketType.ChatFromViewer, LocalWorld.SimChat); + SimClient.AddPacketHandler(PacketType.RezObject, LocalWorld.RezObject); + SimClient.AddPacketHandler(PacketType.DeRezObject, LocalWorld.DeRezObject); + SimClient.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName); + } + #region Client Packet Handlers public bool RequestUUIDName(SimClient simClient, Packet packet) diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index e9bfd56..ea70d02 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs @@ -125,6 +125,7 @@ namespace OpenSim { this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); + this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); } public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) @@ -273,49 +274,6 @@ namespace OpenSim } } break; - case PacketType.MultipleObjectUpdate: - MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)Pack; - for (int i = 0; i < multipleupdate.ObjectData.Length; i++) - { - if (multipleupdate.ObjectData[i].Type == 9) //change position - { - libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - foreach (Entity ent in m_world.Entities.Values) - { - if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) - { - ((OpenSim.world.Primitive)ent).UpdatePosition(pos); - - } - } - //should update stored position of the prim - } - else if (multipleupdate.ObjectData[i].Type == 10)//rotation - { - libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); - foreach (Entity ent in m_world.Entities.Values) - { - if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) - { - ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); - ((OpenSim.world.Primitive)ent).UpdateFlag = true; - } - } - } - else if (multipleupdate.ObjectData[i].Type == 13)//scale - { - - libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - foreach (Entity ent in m_world.Entities.Values) - { - if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) - { - ((OpenSim.world.Primitive)ent).Scale = scale; - } - } - } - } - break; case PacketType.RequestImage: RequestImagePacket imageRequest = (RequestImagePacket)Pack; for (int i = 0; i < imageRequest.RequestImage.Length; i++) @@ -433,14 +391,6 @@ namespace OpenSim } } break; - case PacketType.DeRezObject: - //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet"); - m_world.DeRezObject(this, Pack); - break; - case PacketType.RezObject: - //Console.WriteLine(Pack.ToString()); - m_world.RezObject(this, Pack); - break; case PacketType.RequestTaskInventory: // Console.WriteLine(Pack.ToString()); RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; @@ -833,6 +783,52 @@ namespace OpenSim return true; } + protected bool MultipleObjUpdate(SimClient simClient, Packet packet) + { + MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; + for (int i = 0; i < multipleupdate.ObjectData.Length; i++) + { + if (multipleupdate.ObjectData[i].Type == 9) //change position + { + libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + foreach (Entity ent in m_world.Entities.Values) + { + if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) + { + ((OpenSim.world.Primitive)ent).UpdatePosition(pos); + + } + } + //should update stored position of the prim + } + else if (multipleupdate.ObjectData[i].Type == 10)//rotation + { + libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); + foreach (Entity ent in m_world.Entities.Values) + { + if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) + { + ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); + ((OpenSim.world.Primitive)ent).UpdateFlag = true; + } + } + } + else if (multipleupdate.ObjectData[i].Type == 13)//scale + { + + libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + foreach (Entity ent in m_world.Entities.Values) + { + if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) + { + ((OpenSim.world.Primitive)ent).Scale = scale; + } + } + } + } + return true; + } + #endregion private AgentInventory CreateInventory(LLUUID baseFolder) diff --git a/OpenSim.RegionServer/world/Primitive.cs b/OpenSim.RegionServer/world/Primitive.cs index 2c55004..cbffa7e 100644 --- a/OpenSim.RegionServer/world/Primitive.cs +++ b/OpenSim.RegionServer/world/Primitive.cs @@ -12,7 +12,6 @@ namespace OpenSim.world { public class Primitive : Entity { - //private static object physicsLock = new object(); protected float mesh_cutbegin; protected float mesh_cutend; protected PrimData primData; diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 7f4ecac..aea889d 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs @@ -308,7 +308,7 @@ namespace OpenSim.world this._primCount++; } - public void DeRezObject(SimClient simClient, Packet packet) + public bool DeRezObject(SimClient simClient, Packet packet) { DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; // Console.WriteLine(DeRezPacket); @@ -393,6 +393,7 @@ namespace OpenSim.world } } } + return true; } public bool Backup() -- cgit v1.1