A few fixes and stopped sim crossing being attempted in sandbox mode

0.1-prestable
MW 2007-04-17 12:03:52 +00:00
parent 3e86870f7f
commit d5406fe773
6 changed files with 224 additions and 191 deletions

View File

@ -67,7 +67,7 @@ namespace OpenSim
//private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>(); //private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
private DateTime startuptime; private DateTime startuptime;
public RegionInfo regionData; private RegionInfo regionData;
public Socket Server; public Socket Server;
private IPEndPoint ServerIncoming; private IPEndPoint ServerIncoming;
@ -207,16 +207,22 @@ namespace OpenSim
agent_data.lastname = (string)requestData["lastname"]; agent_data.lastname = (string)requestData["lastname"];
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
if(requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) { if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
{
agent_data.child = true; agent_data.child = true;
} else { }
else
{
agent_data.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); agent_data.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"]));
agent_data.child = false; agent_data.child = false;
} }
if(((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) { if (((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode))
{
((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode] = agent_data; ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode] = agent_data;
} else { }
else
{
((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
} }
@ -233,7 +239,8 @@ namespace OpenSim
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"])); agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"]));
if(((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) { if (((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode))
{
((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname; ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname;
((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname; ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname;
((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos;
@ -342,7 +349,7 @@ namespace OpenSim
{ {
isChildAgent = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child; isChildAgent = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child;
} }
SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox, isChildAgent); SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox, isChildAgent, this.regionData);
if ((this.GridServers.UserServer != null) && (user_accounts)) if ((this.GridServers.UserServer != null) && (user_accounts))
{ {
newuser.UserServer = this.GridServers.UserServer; newuser.UserServer = this.GridServers.UserServer;

View File

@ -82,8 +82,9 @@ namespace OpenSim
private IUserServer m_userServer = null; private IUserServer m_userServer = null;
private OpenSimNetworkHandler m_application; private OpenSimNetworkHandler m_application;
private InventoryCache m_inventoryCache; private InventoryCache m_inventoryCache;
private bool m_sandboxMode; public bool m_sandboxMode;
private int cachedtextureserial = 0; private int cachedtextureserial = 0;
private RegionInfo m_regionData;
protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
@ -97,7 +98,7 @@ namespace OpenSim
} }
} }
public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child) public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat)
{ {
m_world = world; m_world = world;
m_clientThreads = clientThreads; m_clientThreads = clientThreads;
@ -107,14 +108,18 @@ namespace OpenSim
m_inventoryCache = inventoryCache; m_inventoryCache = inventoryCache;
m_sandboxMode = sandboxMode; m_sandboxMode = sandboxMode;
m_child = child; m_child = child;
m_regionData = regionDat;
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
cirpack = initialcirpack; cirpack = initialcirpack;
userEP = remoteEP; userEP = remoteEP;
if(m_gridServer.GetName() == "Remote") { if (m_gridServer.GetName() == "Remote")
{
this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos; this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos;
} else { }
this.startpos=new LLVector3(128.0f,128.0f,60f); else
{
this.startpos = new LLVector3(128, 128, m_world.Terrain[(int)128, (int)128] + 1.0f); // new LLVector3(128.0f, 128.0f, 60f);
} }
PacketQueue = new BlockingQueue<QueItem>(); PacketQueue = new BlockingQueue<QueItem>();
@ -137,24 +142,28 @@ namespace OpenSim
this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
} }
public void CrossSimBorder(LLVector3 avatarpos) { // VERY VERY BASIC public void CrossSimBorder(LLVector3 avatarpos)
LLVector3 newpos = avatarpos; { // VERY VERY BASIC
uint neighbourx=((OpenSimMain)m_application).regionData.RegionLocX; LLVector3 newpos = this.m_regionData.RegionLocX;
uint neighboury=((OpenSimMain)m_application).regionData.RegionLocY; uint neighboury = this.m_regionData.RegionLocY;
if(avatarpos.X<0) { if (avatarpos.X < 0)
{
neighbourx -= 1; neighbourx -= 1;
newpos.X = 254; newpos.X = 254;
} }
if(avatarpos.X>255) { if (avatarpos.X > 255)
{
neighbourx += 1; neighbourx += 1;
newpos.X = 1; newpos.X = 1;
} }
if(avatarpos.Y<0) { if (avatarpos.Y < 0)
{
neighboury -= 1; neighboury -= 1;
newpos.Y = 254; newpos.Y = 254;
} }
if(avatarpos.Y>255) { if (avatarpos.Y > 255)
{
neighbourx += 1; neighbourx += 1;
newpos.Y = 1; newpos.Y = 1;
} }
@ -164,8 +173,10 @@ namespace OpenSim
ArrayList SendParams; ArrayList SendParams;
XmlRpcRequest GridReq; XmlRpcRequest GridReq;
XmlRpcResponse GridResp; XmlRpcResponse GridResp;
foreach(Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) { foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours)
if(((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) { {
if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString()))
{
SimParams = new Hashtable(); SimParams = new Hashtable();
SimParams["firstname"] = this.ClientAvatar.firstname; SimParams["firstname"] = this.ClientAvatar.firstname;
SimParams["lastname"] = this.ClientAvatar.lastname; SimParams["lastname"] = this.ClientAvatar.lastname;
@ -197,7 +208,8 @@ namespace OpenSim
NewSimPack.RegionData.SimIP += (uint)byteIP[0]; NewSimPack.RegionData.SimIP += (uint)byteIP[0];
NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]); NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]);
NewSimPack.RegionData.SeedCapability = new byte[0]; NewSimPack.RegionData.SeedCapability = new byte[0];
lock(PacketQueue) { lock (PacketQueue)
{
ProcessOutPacket(NewSimPack); ProcessOutPacket(NewSimPack);
DowngradeClient(); DowngradeClient();
} }
@ -205,23 +217,29 @@ namespace OpenSim
} }
} }
public void UpgradeClient() { public void UpgradeClient()
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - upgrading child to full agent"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - upgrading child to full agent");
this.m_child = false; this.m_child = false;
this.m_world.RemoveViewerAgent(this); this.m_world.RemoveViewerAgent(this);
if (!this.m_sandboxMode)
{
this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].startpos; this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].startpos;
((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].child = false; ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].child = false;
}
this.InitNewClient(); this.InitNewClient();
} }
public void DowngradeClient() { public void DowngradeClient()
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - changing full agent to child"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - changing full agent to child");
this.m_child = true; this.m_child = true;
this.m_world.RemoveViewerAgent(this); this.m_world.RemoveViewerAgent(this);
this.m_world.AddViewerAgent(this); this.m_world.AddViewerAgent(this);
} }
public void KillClient() { public void KillClient()
{
KillObjectPacket kill = new KillObjectPacket(); KillObjectPacket kill = new KillObjectPacket();
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
@ -595,7 +613,8 @@ namespace OpenSim
} }
break; break;
case PacketType.AgentAnimation: case PacketType.AgentAnimation:
if(!m_child) { if (!m_child)
{
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
for (int i = 0; i < AgentAni.AnimationList.Length; i++) for (int i = 0; i < AgentAni.AnimationList.Length; i++)
{ {

View File

@ -61,21 +61,28 @@ namespace OpenSim.world
} }
this.positionLastFrame = pos2; this.positionLastFrame = pos2;
if(this._physActor.Position.X < 0) { if (!this.ControllingClient.m_sandboxMode)
{
if (pos2.X < 0)
{
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
} }
if(this._physActor.Position.Y < 0) { if (pos2.Y < 0)
{
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
} }
if(this._physActor.Position.X > 255) { if (pos2.X > 255)
{
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
} }
if(this._physActor.Position.Y > 255) { if (pos2.Y > 255)
{
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
} }
}
} }