More cleaning up of SimClient and packet handling

0.1-prestable
MW 2007-04-01 15:30:27 +00:00
parent f0a3edfb34
commit 86f6a33bc8
4 changed files with 58 additions and 60 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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;

View File

@ -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()