More cleaning up of SimClient and packet handling
parent
f0a3edfb34
commit
86f6a33bc8
|
@ -350,13 +350,6 @@ namespace OpenSim
|
||||||
LocalWorld.Update();
|
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)
|
public void RunCmd(string command, string[] cmdparams)
|
||||||
{
|
{
|
||||||
switch (command)
|
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
|
#region Client Packet Handlers
|
||||||
|
|
||||||
public bool RequestUUIDName(SimClient simClient, Packet packet)
|
public bool RequestUUIDName(SimClient simClient, Packet packet)
|
||||||
|
|
|
@ -125,6 +125,7 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout);
|
this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout);
|
||||||
this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached);
|
this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached);
|
||||||
|
this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool AddPacketHandler(PacketType packetType, PacketMethod handler)
|
public static bool AddPacketHandler(PacketType packetType, PacketMethod handler)
|
||||||
|
@ -273,49 +274,6 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case PacketType.RequestImage:
|
||||||
RequestImagePacket imageRequest = (RequestImagePacket)Pack;
|
RequestImagePacket imageRequest = (RequestImagePacket)Pack;
|
||||||
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
|
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
|
||||||
|
@ -433,14 +391,6 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case PacketType.RequestTaskInventory:
|
||||||
// Console.WriteLine(Pack.ToString());
|
// Console.WriteLine(Pack.ToString());
|
||||||
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
|
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
|
||||||
|
@ -833,6 +783,52 @@ namespace OpenSim
|
||||||
return true;
|
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
|
#endregion
|
||||||
|
|
||||||
private AgentInventory CreateInventory(LLUUID baseFolder)
|
private AgentInventory CreateInventory(LLUUID baseFolder)
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
public class Primitive : Entity
|
public class Primitive : Entity
|
||||||
{
|
{
|
||||||
//private static object physicsLock = new object();
|
|
||||||
protected float mesh_cutbegin;
|
protected float mesh_cutbegin;
|
||||||
protected float mesh_cutend;
|
protected float mesh_cutend;
|
||||||
protected PrimData primData;
|
protected PrimData primData;
|
||||||
|
|
|
@ -308,7 +308,7 @@ namespace OpenSim.world
|
||||||
this._primCount++;
|
this._primCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeRezObject(SimClient simClient, Packet packet)
|
public bool DeRezObject(SimClient simClient, Packet packet)
|
||||||
{
|
{
|
||||||
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
|
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
|
||||||
// Console.WriteLine(DeRezPacket);
|
// Console.WriteLine(DeRezPacket);
|
||||||
|
@ -393,6 +393,7 @@ namespace OpenSim.world
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Backup()
|
public bool Backup()
|
||||||
|
|
Loading…
Reference in New Issue