aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-04-01 15:30:27 +0000
committerMW2007-04-01 15:30:27 +0000
commit86f6a33bc8cc88c2e883d6741e6c02810d655960 (patch)
tree5065223a9cef27225000867dce50e033fe22adbe
parentMoved more packet types to handlers (diff)
downloadopensim-SC_OLD-86f6a33bc8cc88c2e883d6741e6c02810d655960.zip
opensim-SC_OLD-86f6a33bc8cc88c2e883d6741e6c02810d655960.tar.gz
opensim-SC_OLD-86f6a33bc8cc88c2e883d6741e6c02810d655960.tar.bz2
opensim-SC_OLD-86f6a33bc8cc88c2e883d6741e6c02810d655960.tar.xz
More cleaning up of SimClient and packet handling
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs16
-rw-r--r--OpenSim.RegionServer/SimClient.cs98
-rw-r--r--OpenSim.RegionServer/world/Primitive.cs1
-rw-r--r--OpenSim.RegionServer/world/World.cs3
4 files changed, 58 insertions, 60 deletions
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
350 LocalWorld.Update(); 350 LocalWorld.Update();
351 } 351 }
352 352
353 protected virtual void RegisterClientPacketHandlers()
354 {
355 SimClient.AddPacketHandler(PacketType.ModifyLand, LocalWorld.ModifyTerrain);
356 SimClient.AddPacketHandler(PacketType.ChatFromViewer, LocalWorld.SimChat);
357 SimClient.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName);
358 }
359
360 public void RunCmd(string command, string[] cmdparams) 353 public void RunCmd(string command, string[] cmdparams)
361 { 354 {
362 switch (command) 355 switch (command)
@@ -404,6 +397,15 @@ namespace OpenSim
404 } 397 }
405 } 398 }
406 399
400 protected virtual void RegisterClientPacketHandlers()
401 {
402 SimClient.AddPacketHandler(PacketType.ModifyLand, LocalWorld.ModifyTerrain);
403 SimClient.AddPacketHandler(PacketType.ChatFromViewer, LocalWorld.SimChat);
404 SimClient.AddPacketHandler(PacketType.RezObject, LocalWorld.RezObject);
405 SimClient.AddPacketHandler(PacketType.DeRezObject, LocalWorld.DeRezObject);
406 SimClient.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName);
407 }
408
407 #region Client Packet Handlers 409 #region Client Packet Handlers
408 410
409 public bool RequestUUIDName(SimClient simClient, Packet packet) 411 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
125 { 125 {
126 this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); 126 this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout);
127 this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); 127 this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached);
128 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
128 } 129 }
129 130
130 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) 131 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler)
@@ -273,49 +274,6 @@ namespace OpenSim
273 } 274 }
274 } 275 }
275 break; 276 break;
276 case PacketType.MultipleObjectUpdate:
277 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)Pack;
278 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
279 {
280 if (multipleupdate.ObjectData[i].Type == 9) //change position
281 {
282 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
283 foreach (Entity ent in m_world.Entities.Values)
284 {
285 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
286 {
287 ((OpenSim.world.Primitive)ent).UpdatePosition(pos);
288
289 }
290 }
291 //should update stored position of the prim
292 }
293 else if (multipleupdate.ObjectData[i].Type == 10)//rotation
294 {
295 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
296 foreach (Entity ent in m_world.Entities.Values)
297 {
298 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
299 {
300 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
301 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
302 }
303 }
304 }
305 else if (multipleupdate.ObjectData[i].Type == 13)//scale
306 {
307
308 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
309 foreach (Entity ent in m_world.Entities.Values)
310 {
311 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
312 {
313 ((OpenSim.world.Primitive)ent).Scale = scale;
314 }
315 }
316 }
317 }
318 break;
319 case PacketType.RequestImage: 277 case PacketType.RequestImage:
320 RequestImagePacket imageRequest = (RequestImagePacket)Pack; 278 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
321 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 279 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
@@ -433,14 +391,6 @@ namespace OpenSim
433 } 391 }
434 } 392 }
435 break; 393 break;
436 case PacketType.DeRezObject:
437 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet");
438 m_world.DeRezObject(this, Pack);
439 break;
440 case PacketType.RezObject:
441 //Console.WriteLine(Pack.ToString());
442 m_world.RezObject(this, Pack);
443 break;
444 case PacketType.RequestTaskInventory: 394 case PacketType.RequestTaskInventory:
445 // Console.WriteLine(Pack.ToString()); 395 // Console.WriteLine(Pack.ToString());
446 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 396 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
@@ -833,6 +783,52 @@ namespace OpenSim
833 return true; 783 return true;
834 } 784 }
835 785
786 protected bool MultipleObjUpdate(SimClient simClient, Packet packet)
787 {
788 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
789 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
790 {
791 if (multipleupdate.ObjectData[i].Type == 9) //change position
792 {
793 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
794 foreach (Entity ent in m_world.Entities.Values)
795 {
796 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
797 {
798 ((OpenSim.world.Primitive)ent).UpdatePosition(pos);
799
800 }
801 }
802 //should update stored position of the prim
803 }
804 else if (multipleupdate.ObjectData[i].Type == 10)//rotation
805 {
806 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
807 foreach (Entity ent in m_world.Entities.Values)
808 {
809 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
810 {
811 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
812 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
813 }
814 }
815 }
816 else if (multipleupdate.ObjectData[i].Type == 13)//scale
817 {
818
819 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
820 foreach (Entity ent in m_world.Entities.Values)
821 {
822 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
823 {
824 ((OpenSim.world.Primitive)ent).Scale = scale;
825 }
826 }
827 }
828 }
829 return true;
830 }
831
836 #endregion 832 #endregion
837 833
838 private AgentInventory CreateInventory(LLUUID baseFolder) 834 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
12{ 12{
13 public class Primitive : Entity 13 public class Primitive : Entity
14 { 14 {
15 //private static object physicsLock = new object();
16 protected float mesh_cutbegin; 15 protected float mesh_cutbegin;
17 protected float mesh_cutend; 16 protected float mesh_cutend;
18 protected PrimData primData; 17 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
308 this._primCount++; 308 this._primCount++;
309 } 309 }
310 310
311 public void DeRezObject(SimClient simClient, Packet packet) 311 public bool DeRezObject(SimClient simClient, Packet packet)
312 { 312 {
313 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 313 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
314 // Console.WriteLine(DeRezPacket); 314 // Console.WriteLine(DeRezPacket);
@@ -393,6 +393,7 @@ namespace OpenSim.world
393 } 393 }
394 } 394 }
395 } 395 }
396 return true;
396 } 397 }
397 398
398 public bool Backup() 399 public bool Backup()