From d5406fe77309770234524f6afa38ae1502f01eab Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 17 Apr 2007 12:03:52 +0000 Subject: A few fixes and stopped sim crossing being attempted in sandbox mode --- OpenSim.RegionServer/OpenSimMain.cs | 59 +++--- OpenSim.RegionServer/RegionInfo.cs | 12 +- OpenSim.RegionServer/SimClient.cs | 293 +++++++++++++++-------------- OpenSim.RegionServer/world/Avatar.cs | 6 +- OpenSim.RegionServer/world/AvatarUpdate.cs | 47 +++-- OpenSim.RegionServer/world/World.cs | 6 +- 6 files changed, 228 insertions(+), 195 deletions(-) diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index 7f2032d..ea6088b 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs @@ -67,7 +67,7 @@ namespace OpenSim //private Dictionary ClientThreads = new Dictionary(); private Dictionary clientCircuits = new Dictionary(); private DateTime startuptime; - public RegionInfo regionData; + private RegionInfo regionData; public Socket Server; private IPEndPoint ServerIncoming; @@ -206,23 +206,29 @@ namespace OpenSim agent_data.firstname = (string)requestData["firstname"]; agent_data.lastname = (string)requestData["lastname"]; agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); - agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); - if(requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) { - agent_data.child=true; - } 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)) { - ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode]=agent_data; - } else { - ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); - } + agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); + if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) + { + agent_data.child = true; + } + 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)) + { + ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode] = agent_data; + } + else + { + ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); + } return new XmlRpcResponse(); }); - + httpServer.AddXmlRPCHandler("agent_crossing", delegate(XmlRpcRequest request) { @@ -230,18 +236,19 @@ namespace OpenSim AgentCircuitData agent_data = new AgentCircuitData(); agent_data.firstname = (string)requestData["firstname"]; agent_data.lastname = (string)requestData["lastname"]; - 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"])); - - 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].lastname = agent_data.lastname; - ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; - } + 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"])); + + 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].lastname = agent_data.lastname; + ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; + } return new XmlRpcResponse(); }); - + httpServer.AddRestHandler("GET", "/simstatus/", delegate(string request, string path, string param) { @@ -313,7 +320,7 @@ namespace OpenSim pluginAssembly = null; return config; } - + private void OnReceivedData(IAsyncResult result) { ipeSender = new IPEndPoint(IPAddress.Any, 0); @@ -342,7 +349,7 @@ namespace OpenSim { 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)) { newuser.UserServer = this.GridServers.UserServer; diff --git a/OpenSim.RegionServer/RegionInfo.cs b/OpenSim.RegionServer/RegionInfo.cs index abc674f..0d5e980 100644 --- a/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim.RegionServer/RegionInfo.cs @@ -44,7 +44,7 @@ namespace OpenSim //we really want to keep any server connection code out of here and out of the code code // and put it in the server connection classes (those inheriting from IGridServer etc) string reqtext; - reqtext = ""; + reqtext = ""; reqtext += "" + this.GridSendKey + ""; reqtext += ""; reqtext += "" + this.SimUUID.ToString() + ""; @@ -55,9 +55,9 @@ namespace OpenSim reqtext += "" + this.RegionLocY.ToString() + ""; reqtext += "1"; reqtext += ""; - reqtext += ""; - - byte[] reqdata = (new System.Text.ASCIIEncoding()).GetBytes(reqtext); + reqtext += ""; + + byte[] reqdata = (new System.Text.ASCIIEncoding()).GetBytes(reqtext); WebRequest GridSaveReq = WebRequest.Create(this.GridURL + "sims/" + this.SimUUID.ToString()); GridSaveReq.Method = "POST"; @@ -68,11 +68,11 @@ namespace OpenSim stOut.Write(reqdata,0,reqdata.Length); stOut.Close(); - WebResponse gridresp = GridSaveReq.GetResponse(); + WebResponse gridresp = GridSaveReq.GetResponse(); StreamReader stIn = new StreamReader(gridresp.GetResponseStream(), Encoding.ASCII); string GridResponse = stIn.ReadToEnd(); stIn.Close(); - gridresp.Close(); + gridresp.Close(); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse); } diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 52074b5..b729c6c 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs @@ -29,7 +29,7 @@ using System.Collections; using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; -using Nwc.XmlRpc; +using Nwc.XmlRpc; using System.Net; using System.Net.Sockets; using System.IO; @@ -55,13 +55,13 @@ namespace OpenSim public LLUUID AgentID; public LLUUID SessionID; public LLUUID SecureSessionID = LLUUID.Zero; - public bool m_child; + public bool m_child; public uint CircuitCode; public world.Avatar ClientAvatar; private UseCircuitCodePacket cirpack; public Thread ClientThread; - public EndPoint userEP; - public LLVector3 startpos; + public EndPoint userEP; + public LLVector3 startpos; private BlockingQueue PacketQueue; private Dictionary PendingAcks = new Dictionary(); private Dictionary NeedAck = new Dictionary(); @@ -82,8 +82,9 @@ namespace OpenSim private IUserServer m_userServer = null; private OpenSimNetworkHandler m_application; private InventoryCache m_inventoryCache; - private bool m_sandboxMode; + public bool m_sandboxMode; private int cachedtextureserial = 0; + private RegionInfo m_regionData; protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients @@ -97,7 +98,7 @@ namespace OpenSim } } - public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child) + public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat) { m_world = world; m_clientThreads = clientThreads; @@ -106,16 +107,20 @@ namespace OpenSim m_application = application; m_inventoryCache = inventoryCache; 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"); cirpack = initialcirpack; userEP = remoteEP; - if(m_gridServer.GetName() == "Remote") { - this.startpos=((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos; - } else { - this.startpos=new LLVector3(128.0f,128.0f,60f); - } + if (m_gridServer.GetName() == "Remote") + { + this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos; + } + 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(); this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); @@ -137,115 +142,128 @@ namespace OpenSim this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); } - public void CrossSimBorder(LLVector3 avatarpos) { // VERY VERY BASIC - LLVector3 newpos = avatarpos; - uint neighbourx=((OpenSimMain)m_application).regionData.RegionLocX; - uint neighboury=((OpenSimMain)m_application).regionData.RegionLocY; - - if(avatarpos.X<0) { - neighbourx-=1; - newpos.X=254; - } - if(avatarpos.X>255) { - neighbourx+=1; - newpos.X=1; - } - if(avatarpos.Y<0) { - neighboury-=1; - newpos.Y=254; - } - if(avatarpos.Y>255) { - neighbourx+=1; - newpos.Y=1; - } - OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]"); - - Hashtable SimParams; - ArrayList SendParams; - XmlRpcRequest GridReq; - XmlRpcResponse GridResp; - foreach(Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) { - if(((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) { - SimParams = new Hashtable(); - SimParams["firstname"] = this.ClientAvatar.firstname; - SimParams["lastname"] = this.ClientAvatar.lastname; - SimParams["circuit_code"] = this.CircuitCode.ToString(); - SimParams["pos_x"] = newpos.X.ToString(); - SimParams["pos_y"] = newpos.Y.ToString(); - SimParams["pos_z"] = newpos.Z.ToString(); - SendParams = new ArrayList(); - SendParams.Add(SimParams); - - GridReq = new XmlRpcRequest("agent_crossing", SendParams); - GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000); - - CrossedRegionPacket NewSimPack = new CrossedRegionPacket(); - NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); - NewSimPack.AgentData.AgentID=this.AgentID; - NewSimPack.AgentData.SessionID=this.SessionID; - NewSimPack.Info = new CrossedRegionPacket.InfoBlock(); - NewSimPack.Info.Position=newpos; - 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.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"]); - byte[] byteIP = neighbourIP.GetAddressBytes(); - NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; - NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; - NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; - NewSimPack.RegionData.SimIP += (uint)byteIP[0]; - NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]); - NewSimPack.RegionData.SeedCapability = new byte[0]; - lock(PacketQueue) { - ProcessOutPacket(NewSimPack); - DowngradeClient(); - } - } - } - } - - public void UpgradeClient() { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - upgrading child to full agent"); - this.m_child=false; - this.m_world.RemoveViewerAgent(this); - this.startpos=((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].startpos; - ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].child=false; - this.InitNewClient(); - } - - public void DowngradeClient() { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - changing full agent to child"); - this.m_child=true; - this.m_world.RemoveViewerAgent(this); - this.m_world.AddViewerAgent(this); - } - - public void KillClient() { - KillObjectPacket kill = new KillObjectPacket(); - kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; - kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); - kill.ObjectData[0].ID = this.ClientAvatar.localid; - foreach (SimClient client in m_clientThreads.Values) - { - client.OutPacket(kill); - } - if (this.m_userServer != null) - { - this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); - } - else - { - this.m_inventoryCache.ClientLeaving(this.AgentID, null); - } - - m_world.RemoveViewerAgent(this); - - m_clientThreads.Remove(this.CircuitCode); - m_application.RemoveClientCircuit(this.CircuitCode); - this.ClientThread.Abort(); - } - + public void CrossSimBorder(LLVector3 avatarpos) + { // VERY VERY BASIC + LLVector3 newpos = this.m_regionData.RegionLocX; + uint neighboury = this.m_regionData.RegionLocY; + + if (avatarpos.X < 0) + { + neighbourx -= 1; + newpos.X = 254; + } + if (avatarpos.X > 255) + { + neighbourx += 1; + newpos.X = 1; + } + if (avatarpos.Y < 0) + { + neighboury -= 1; + newpos.Y = 254; + } + if (avatarpos.Y > 255) + { + neighbourx += 1; + newpos.Y = 1; + } + OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]"); + + Hashtable SimParams; + ArrayList SendParams; + XmlRpcRequest GridReq; + XmlRpcResponse GridResp; + foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours) + { + if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString())) + { + SimParams = new Hashtable(); + SimParams["firstname"] = this.ClientAvatar.firstname; + SimParams["lastname"] = this.ClientAvatar.lastname; + SimParams["circuit_code"] = this.CircuitCode.ToString(); + SimParams["pos_x"] = newpos.X.ToString(); + SimParams["pos_y"] = newpos.Y.ToString(); + SimParams["pos_z"] = newpos.Z.ToString(); + SendParams = new ArrayList(); + SendParams.Add(SimParams); + + GridReq = new XmlRpcRequest("agent_crossing", SendParams); + GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000); + + CrossedRegionPacket NewSimPack = new CrossedRegionPacket(); + NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); + NewSimPack.AgentData.AgentID = this.AgentID; + NewSimPack.AgentData.SessionID = this.SessionID; + NewSimPack.Info = new CrossedRegionPacket.InfoBlock(); + NewSimPack.Info.Position = newpos; + 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.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"]); + byte[] byteIP = neighbourIP.GetAddressBytes(); + NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; + NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; + NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; + NewSimPack.RegionData.SimIP += (uint)byteIP[0]; + NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]); + NewSimPack.RegionData.SeedCapability = new byte[0]; + lock (PacketQueue) + { + ProcessOutPacket(NewSimPack); + DowngradeClient(); + } + } + } + } + + public void UpgradeClient() + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - upgrading child to full agent"); + this.m_child = false; + this.m_world.RemoveViewerAgent(this); + if (!this.m_sandboxMode) + { + this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].startpos; + ((RemoteGridBase)m_gridServer).agentcircuits[CircuitCode].child = false; + } + this.InitNewClient(); + } + + public void DowngradeClient() + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimClient.cs:UpgradeClient() - changing full agent to child"); + this.m_child = true; + this.m_world.RemoveViewerAgent(this); + this.m_world.AddViewerAgent(this); + } + + public void KillClient() + { + KillObjectPacket kill = new KillObjectPacket(); + kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; + kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); + kill.ObjectData[0].ID = this.ClientAvatar.localid; + foreach (SimClient client in m_clientThreads.Values) + { + client.OutPacket(kill); + } + if (this.m_userServer != null) + { + this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); + } + else + { + this.m_inventoryCache.ClientLeaving(this.AgentID, null); + } + + m_world.RemoveViewerAgent(this); + + m_clientThreads.Remove(this.CircuitCode); + m_application.RemoveClientCircuit(this.CircuitCode); + this.ClientThread.Abort(); + } + public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) { bool result = false; @@ -346,9 +364,9 @@ namespace OpenSim switch (Pack.Type) { case PacketType.CompleteAgentMovement: - if(this.m_child) this.UpgradeClient(); - ClientAvatar.CompleteMovement(m_world); - ClientAvatar.SendInitialPosition(); + if (this.m_child) this.UpgradeClient(); + ClientAvatar.CompleteMovement(m_world); + ClientAvatar.SendInitialPosition(); break; case PacketType.RegionHandshakeReply: m_world.SendLayerData(this); @@ -595,18 +613,19 @@ namespace OpenSim } break; case PacketType.AgentAnimation: - if(!m_child) { - AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; - for (int i = 0; i < AgentAni.AnimationList.Length; i++) - { - if (AgentAni.AnimationList[i].StartAnim) - { - ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID; - ClientAvatar.anim_seq = 1; - ClientAvatar.SendAnimPack(); - } - } - } + if (!m_child) + { + AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; + for (int i = 0; i < AgentAni.AnimationList.Length; i++) + { + if (AgentAni.AnimationList[i].StartAnim) + { + ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID; + ClientAvatar.anim_seq = 1; + ClientAvatar.SendAnimPack(); + } + } + } break; case PacketType.ObjectSelect: ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; @@ -912,7 +931,7 @@ namespace OpenSim } } #region Packet handlers - + protected virtual bool Logout(SimClient simClient, Packet packet) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index b6b8282..54043fc 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs @@ -44,7 +44,7 @@ namespace OpenSim.world OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); ControllingClient = TheClient; localid = 8880000 + (this.m_world._localNumber++); - Pos = ControllingClient.startpos; + Pos = ControllingClient.startpos; visualParams = new byte[218]; for (int i = 0; i < 218; i++) { @@ -59,7 +59,7 @@ namespace OpenSim.world this.Wearables[0].ItemID = LLUUID.Random(); this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); - + } public PhysicsActor PhysActor @@ -307,7 +307,7 @@ namespace OpenSim.world handshake.RegionInfo.TerrainStartHeight11 = 10; handshake.RegionInfo.SimAccess = 13; handshake.RegionInfo.WaterHeight = 20; - handshake.RegionInfo.RegionFlags = 72458694 -32; + handshake.RegionInfo.RegionFlags = 72458694 - 32; handshake.RegionInfo.SimName = _enc.GetBytes(m_regionName + "\0"); handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); diff --git a/OpenSim.RegionServer/world/AvatarUpdate.cs b/OpenSim.RegionServer/world/AvatarUpdate.cs index c2f2456..6c0ace7 100644 --- a/OpenSim.RegionServer/world/AvatarUpdate.cs +++ b/OpenSim.RegionServer/world/AvatarUpdate.cs @@ -59,24 +59,31 @@ namespace OpenSim.world } } - this.positionLastFrame = pos2; - - if(this._physActor.Position.X < 0) { - ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z)); - } - - if(this._physActor.Position.Y < 0) { - ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z)); - } - - if(this._physActor.Position.X > 255) { - ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z)); - } - - if(this._physActor.Position.Y > 255) { - ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X,this._physActor.Position.Y,this._physActor.Position.Z)); - } - + this.positionLastFrame = pos2; + + 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)); + } + + if (pos2.Y < 0) + { + ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); + } + + if (pos2.X > 255) + { + ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); + } + + if (pos2.Y > 255) + { + ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); + } + } + } public ObjectUpdatePacket CreateUpdatePacket() @@ -106,8 +113,8 @@ namespace OpenSim.world { System.Text.Encoding _enc = System.Text.Encoding.ASCII; //send a objectupdate packet with information about the clients avatar - - ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); + + ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); objupdate.RegionData.RegionHandle = m_regionHandle; objupdate.RegionData.TimeDilation = 64096; objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 425a135..749305f 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs @@ -371,13 +371,13 @@ namespace OpenSim.world OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); newAvatar.SendRegionHandshake(this); - if(!agentClient.m_child) { + if(!agentClient.m_child) { PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); lock (this.LockPhysicsEngine) { newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); } - } + } lock (Entities) { this.Entities.Add(agentClient.AgentID, newAvatar); @@ -385,7 +385,7 @@ namespace OpenSim.world lock (Avatars) { this.Avatars.Add(agentClient.AgentID, newAvatar); - } + } } -- cgit v1.1