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; {
} else { agent_data.child = true;
agent_data.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]),Convert.ToUInt32(requestData["startpos_y"]),Convert.ToUInt32(requestData["startpos_z"])); }
agent_data.child=false; else
{
agent_data.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"]));
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; {
} else { ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode] = agent_data;
}
else
{
((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
} }
@ -231,9 +237,10 @@ namespace OpenSim
agent_data.firstname = (string)requestData["firstname"]; agent_data.firstname = (string)requestData["firstname"];
agent_data.lastname = (string)requestData["lastname"]; agent_data.lastname = (string)requestData["lastname"];
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;
@ -106,15 +107,19 @@ namespace OpenSim
m_application = application; m_application = application;
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; {
} else { this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos;
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,26 +142,30 @@ 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; {
newpos.X=254; neighbourx -= 1;
newpos.X = 254;
} }
if(avatarpos.X>255) { if (avatarpos.X > 255)
neighbourx+=1; {
newpos.X=1; neighbourx += 1;
newpos.X = 1;
} }
if(avatarpos.Y<0) { if (avatarpos.Y < 0)
neighboury-=1; {
newpos.Y=254; neighboury -= 1;
newpos.Y = 254;
} }
if(avatarpos.Y>255) { if (avatarpos.Y > 255)
neighbourx+=1; {
newpos.Y=1; neighbourx += 1;
newpos.Y = 1;
} }
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]");
@ -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;
@ -181,13 +192,13 @@ namespace OpenSim
CrossedRegionPacket NewSimPack = new CrossedRegionPacket(); CrossedRegionPacket NewSimPack = new CrossedRegionPacket();
NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
NewSimPack.AgentData.AgentID=this.AgentID; NewSimPack.AgentData.AgentID = this.AgentID;
NewSimPack.AgentData.SessionID=this.SessionID; NewSimPack.AgentData.SessionID = this.SessionID;
NewSimPack.Info = new CrossedRegionPacket.InfoBlock(); NewSimPack.Info = new CrossedRegionPacket.InfoBlock();
NewSimPack.Info.Position=newpos; NewSimPack.Info.Position = newpos;
NewSimPack.Info.LookAt=new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock(); NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock();
NewSimPack.RegionData.RegionHandle=Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256)); NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256));
System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]); System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]);
byte[] byteIP = neighbourIP.GetAddressBytes(); byte[] byteIP = neighbourIP.GetAddressBytes();
@ -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);
this.startpos=((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].startpos; if (!this.m_sandboxMode)
((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].child=false; {
this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].startpos;
((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();
@ -346,7 +364,7 @@ namespace OpenSim
switch (Pack.Type) switch (Pack.Type)
{ {
case PacketType.CompleteAgentMovement: case PacketType.CompleteAgentMovement:
if(this.m_child) this.UpgradeClient(); if (this.m_child) this.UpgradeClient();
ClientAvatar.CompleteMovement(m_world); ClientAvatar.CompleteMovement(m_world);
ClientAvatar.SendInitialPosition(); ClientAvatar.SendInitialPosition();
break; break;
@ -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

@ -307,7 +307,7 @@ namespace OpenSim.world
handshake.RegionInfo.TerrainStartHeight11 = 10; handshake.RegionInfo.TerrainStartHeight11 = 10;
handshake.RegionInfo.SimAccess = 13; handshake.RegionInfo.SimAccess = 13;
handshake.RegionInfo.WaterHeight = 20; handshake.RegionInfo.WaterHeight = 20;
handshake.RegionInfo.RegionFlags = 72458694 -32; handshake.RegionInfo.RegionFlags = 72458694 - 32;
handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0");
handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");

View File

@ -61,20 +61,27 @@ namespace OpenSim.world
} }
this.positionLastFrame = pos2; this.positionLastFrame = pos2;
if(this._physActor.Position.X < 0) { if (!this.ControllingClient.m_sandboxMode)
ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z)); {
if (pos2.X < 0)
{
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));
}
} }
} }