diff --git a/Common/OpenGrid.Framework.Communications/CommunicationsManager.cs b/Common/OpenGrid.Framework.Communications/CommunicationsManager.cs index 10fe251db4..2ed4fd20ee 100644 --- a/Common/OpenGrid.Framework.Communications/CommunicationsManager.cs +++ b/Common/OpenGrid.Framework.Communications/CommunicationsManager.cs @@ -41,7 +41,7 @@ namespace OpenGrid.Framework.Communications { public IUserServices UserServer; public IGridServices GridServer; - public IInterRegionCommunications InterSims; + public IInterRegionCommunications InterRegion; public CommunicationsManager() { diff --git a/Common/OpenGrid.Framework.Communications/IGridServices.cs b/Common/OpenGrid.Framework.Communications/IGridServices.cs index 9466647cae..b4bc3b656b 100644 --- a/Common/OpenGrid.Framework.Communications/IGridServices.cs +++ b/Common/OpenGrid.Framework.Communications/IGridServices.cs @@ -36,8 +36,9 @@ namespace OpenGrid.Framework.Communications { public interface IGridServices { - RegionCommsHostBase RegisterRegion(RegionInfo regionInfo); + RegionCommsListener RegisterRegion(RegionInfo regionInfo); List RequestNeighbours(RegionInfo regionInfo); RegionInfo RequestNeighbourInfo(ulong regionHandle); + List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); } } diff --git a/Common/OpenSim.Framework/IRegionCommsHost.cs b/Common/OpenSim.Framework/IRegionCommsListener.cs similarity index 96% rename from Common/OpenSim.Framework/IRegionCommsHost.cs rename to Common/OpenSim.Framework/IRegionCommsListener.cs index 658afe6207..0e80941b4e 100644 --- a/Common/OpenSim.Framework/IRegionCommsHost.cs +++ b/Common/OpenSim.Framework/IRegionCommsListener.cs @@ -37,7 +37,7 @@ namespace OpenSim.Framework public delegate void UpdateNeighbours(List neighbours); public delegate void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position); - public interface IRegionCommsHost + public interface IRegionCommsListener { event ExpectUserDelegate OnExpectUser; event GenericCall2 OnExpectChildAgent; diff --git a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs index 45d73efdf6..6e758b2b43 100644 --- a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs +++ b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs @@ -41,12 +41,16 @@ namespace OpenSim.Framework.Interfaces public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); public delegate void StartAnim(LLUUID animID, int seq); public delegate void LinkObjects(uint parent, List children); + public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY); + public delegate void TeleportLocationRequest(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags); + public delegate void GenericCall(IClientAPI remoteClient); public delegate void GenericCall2(); public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary. public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); public delegate void GenericCall5(IClientAPI remoteClient, bool status); public delegate void GenericCall6(LLUUID uid); + public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); @@ -72,6 +76,9 @@ namespace OpenSim.Framework.Interfaces event SetAppearance OnSetAppearance; event StartAnim OnStartAnim; event LinkObjects OnLinkObjects; + event RequestMapBlocks OnRequestMapBlocks; + event TeleportLocationRequest OnTeleportLocationRequest; + event GenericCall4 OnDeRezObject; event GenericCall OnRegionHandShakeReply; event GenericCall OnRequestWearables; @@ -79,6 +86,7 @@ namespace OpenSim.Framework.Interfaces event UpdateAgent OnAgentUpdate; event GenericCall OnRequestAvatarsData; event GenericCall4 OnAddPrim; + event UpdateShape OnUpdatePrimShape; event ObjectSelect OnObjectSelect; event UpdatePrimFlags OnUpdatePrimFlags; @@ -125,10 +133,15 @@ namespace OpenSim.Framework.Interfaces void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); void SendLayerData(float[] map); - void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos); + void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort); AgentCircuitData RequestClientInfo(); void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort); + void SendMapBlock(List mapBlocks); + void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags); + void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags); + void SendTeleportCancel(); + void SendTeleportLocationStart(); void SendAvatarData(RegionInfo regionInfo, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos); void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity); diff --git a/Common/OpenSim.Framework/OpenSim.Framework.csproj b/Common/OpenSim.Framework/OpenSim.Framework.csproj index 4939b59a61..060e471f9e 100644 --- a/Common/OpenSim.Framework/OpenSim.Framework.csproj +++ b/Common/OpenSim.Framework/OpenSim.Framework.csproj @@ -99,13 +99,13 @@ Code - + Code Code - + Code @@ -183,6 +183,9 @@ Code + + Code + Code diff --git a/Common/OpenSim.Framework/OpenSim.Framework.dll.build b/Common/OpenSim.Framework/OpenSim.Framework.dll.build index 65a58dc4a9..524255c3e6 100644 --- a/Common/OpenSim.Framework/OpenSim.Framework.dll.build +++ b/Common/OpenSim.Framework/OpenSim.Framework.dll.build @@ -14,9 +14,9 @@ - + - + @@ -42,6 +42,7 @@ + diff --git a/Common/OpenSim.Framework/RegionCommsHostBase.cs b/Common/OpenSim.Framework/RegionCommsListener.cs similarity index 95% rename from Common/OpenSim.Framework/RegionCommsHostBase.cs rename to Common/OpenSim.Framework/RegionCommsListener.cs index 88751b80b9..3fec93768d 100644 --- a/Common/OpenSim.Framework/RegionCommsHostBase.cs +++ b/Common/OpenSim.Framework/RegionCommsListener.cs @@ -33,7 +33,7 @@ using OpenSim.Framework.Types; namespace OpenSim.Framework { - public class RegionCommsHostBase :IRegionCommsHost + public class RegionCommsListener :IRegionCommsListener { public event ExpectUserDelegate OnExpectUser; public event GenericCall2 OnExpectChildAgent; diff --git a/Common/OpenSim.Framework/Types/MapBlockData.cs b/Common/OpenSim.Framework/Types/MapBlockData.cs new file mode 100644 index 0000000000..2e6f56ef4d --- /dev/null +++ b/Common/OpenSim.Framework/Types/MapBlockData.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Framework.Types +{ + public class MapBlockData + { + public uint Flags; + public ushort X; + public ushort Y; + public byte Agents; + public byte Access; + public byte WaterHeight; + public LLUUID MapImageId; + public String Name; + public uint RegionFlags; + + public MapBlockData() + { + + } + } +} diff --git a/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs b/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs index 1cb5f6f2f4..2293608208 100644 --- a/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs +++ b/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs @@ -45,7 +45,7 @@ namespace OpenSim.LocalCommunications { UserServer = null; GridServer = SandManager; - InterSims = SandManager; + InterRegion = SandManager; } } } diff --git a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs index dfc4505137..46ace9c34d 100644 --- a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs +++ b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs @@ -36,11 +36,10 @@ using OpenSim.Framework; namespace OpenSim.LocalCommunications { - public class LocalBackEndServices : IGridServices, IInterRegionCommunications { protected Dictionary regions = new Dictionary(); - protected Dictionary regionHosts = new Dictionary(); + protected Dictionary regionHosts = new Dictionary(); public LocalBackEndServices() { @@ -52,14 +51,14 @@ namespace OpenSim.LocalCommunications /// /// /// - public RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) + public RegionCommsListener RegisterRegion(RegionInfo regionInfo) { //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) { //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); this.regions.Add(regionInfo.RegionHandle, regionInfo); - RegionCommsHostBase regionHost = new RegionCommsHostBase(); + RegionCommsListener regionHost = new RegionCommsListener(); this.regionHosts.Add(regionInfo.RegionHandle, regionHost); return regionHost; @@ -110,6 +109,36 @@ namespace OpenSim.LocalCommunications return null; } + /// + /// + /// + /// + /// + /// + /// + /// + public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) + { + List mapBlocks = new List(); + foreach(RegionInfo regInfo in this.regions.Values) + { + if (((regInfo.RegionLocX > minX) && (regInfo.RegionLocX < maxX)) && ((regInfo.RegionLocY > minY) && (regInfo.RegionLocY < maxY))) + { + MapBlockData map = new MapBlockData(); + map.Name = regInfo.RegionName; + map.X = (ushort)regInfo.RegionLocX; + map.Y = (ushort)regInfo.RegionLocY; + map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; + map.MapImageId = new LLUUID("00000000-0000-0000-9999-000000000007"); + map.Agents = 1; + map.RegionFlags = 72458694; + map.Access = 13; + mapBlocks.Add(map); + } + } + return mapBlocks; + } + /// /// /// diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.csproj b/OpenSim/OpenSim.Region/OpenSim.Region.csproj index e53a4f48da..94efbedf65 100644 --- a/OpenSim/OpenSim.Region/OpenSim.Region.csproj +++ b/OpenSim/OpenSim.Region/OpenSim.Region.csproj @@ -86,6 +86,12 @@ {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} False + + OpenSim.Caches + {1938EB12-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build index 5b9ba1a221..6d47576439 100644 --- a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build +++ b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build @@ -39,6 +39,7 @@ + diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs index d46bf0fbc2..5d70bc1585 100644 --- a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs +++ b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs @@ -43,36 +43,24 @@ namespace OpenSim.Region.Scenes /// public override void update() { - if (this.newForce) + if (this.childAvatar == false) { - this.SendTerseUpdateToALLClients(); - _updateCount = 0; - } - else if (movementflag != 0) - { - _updateCount++; - if (_updateCount > 3) + if (this.newForce) { this.SendTerseUpdateToALLClients(); _updateCount = 0; } - } + else if (movementflag != 0) + { + _updateCount++; + if (_updateCount > 3) + { + this.SendTerseUpdateToALLClients(); + _updateCount = 0; + } + } - LLVector3 pos2 = this.Pos; - LLVector3 vel = this.Velocity; - - float timeStep = 0.3f; - pos2.X = pos2.X + (vel.X * timeStep); - pos2.Y = pos2.Y + (vel.Y * timeStep); - pos2.Z = pos2.Z + (vel.Z * timeStep); - if ((pos2.X < 0) || (pos2.X > 256)) - { - this.CrossToNewRegion(); - } - - if ((pos2.Y < 0) || (pos2.Y > 256)) - { - this.CrossToNewRegion(); + this.CheckBorderCrossing(); } } @@ -165,10 +153,35 @@ namespace OpenSim.Region.Scenes } - private void CrossToNewRegion() + /// + /// + /// + protected void CheckBorderCrossing() + { + LLVector3 pos2 = this.Pos; + LLVector3 vel = this.Velocity; + + float timeStep = 0.3f; + pos2.X = pos2.X + (vel.X * timeStep); + pos2.Y = pos2.Y + (vel.Y * timeStep); + pos2.Z = pos2.Z + (vel.Z * timeStep); + + if ((pos2.X < 0) || (pos2.X > 256)) + { + this.CrossToNewRegion(); + } + + if ((pos2.Y < 0) || (pos2.Y > 256)) + { + this.CrossToNewRegion(); + } + } + + /// + /// + /// + protected void CrossToNewRegion() { - - // Console.WriteLine("crossing to new region from region " + this.m_regionInfo.RegionLocX + " , "+ this.m_regionInfo.RegionLocY); LLVector3 pos = this.Pos; LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); uint neighbourx = this.m_regionInfo.RegionLocX; @@ -196,14 +209,14 @@ namespace OpenSim.Region.Scenes } LLVector3 vel = this.velocity; - // Console.WriteLine("new region should be " + neighbourx + " , " + neighboury); ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256)); RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); if (neighbourRegion != null) { - // Console.WriteLine("current region port is "+ this.m_regionInfo.IPListenPort + " now crossing to new region with port " + neighbourRegion.IPListenPort); this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos); + this.DownGradeAvatar(); this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort); + } } diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.cs index 98d7564694..d40e213c0f 100644 --- a/OpenSim/OpenSim.Region/Scenes/Avatar.cs +++ b/OpenSim/OpenSim.Region/Scenes/Avatar.cs @@ -103,7 +103,7 @@ namespace OpenSim.Region.Scenes ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition); ControllingClient.OnAgentUpdate += new UpdateAgent(this.HandleAgentUpdate); // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); - ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); + // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); } @@ -138,7 +138,34 @@ namespace OpenSim.Region.Scenes } } - + + /// + /// + /// + /// + public void UpGradeAvatar(LLVector3 pos) + { + //this.childAvatar = false; + this.Pos = pos; + } + + protected void DownGradeAvatar() + { + this.Velocity = new LLVector3(0, 0, 0); + this.Pos = new LLVector3(128, 128, 70); + this.childAvatar = true; + } + + /// + /// + /// + /// + public void Teleport(LLVector3 pos) + { + this.Pos = pos; + this.SendTerseUpdateToALLClients(); + } + /// /// /// @@ -189,7 +216,16 @@ namespace OpenSim.Region.Scenes /// public void CompleteMovement() { - this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos); + LLVector3 look = this.Velocity; + if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) + { + look = new LLVector3(0.99f, 0.042f, 0); + } + this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look); + if (this.childAvatar) + { + this.childAvatar = false; + } } /// diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs index c0eebd483f..eb942c2147 100644 --- a/OpenSim/OpenSim.Region/Scenes/Scene.cs +++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs @@ -42,7 +42,7 @@ using OpenSim.Framework; using OpenSim.Region.Scripting; using OpenSim.Terrain; using OpenGrid.Framework.Communications; - +using OpenSim.Caches; namespace OpenSim.Region.Scenes { @@ -64,8 +64,9 @@ namespace OpenSim.Region.Scenes private Mutex updateLock; public string m_datastore; protected AuthenticateSessionsBase authenticateHandler; - protected RegionCommsHostBase regionCommsHost; + protected RegionCommsListener regionCommsHost; protected CommunicationsManager commsManager; + public ParcelManager parcelManager; public EstateManager estateManager; @@ -95,13 +96,14 @@ namespace OpenSim.Region.Scenes /// Dictionary to contain client threads /// Region Handle for this region /// Region Name for this region - public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan) + public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach) { try { updateLock = new Mutex(false); this.authenticateHandler = authen; this.commsManager = commsMan; + this.assetCache = assetCach; m_clientThreads = clientThreads; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; @@ -507,8 +509,10 @@ namespace OpenSim.Region.Scenes remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours); remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim); remoteClient.OnUpdatePrimPosition += new UpdatePrimVector(this.UpdatePrimPosition); - - /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); + remoteClient.OnRequestMapBlocks += new RequestMapBlocks(this.RequestMapBlocks); + remoteClient.OnTeleportLocationRequest += new TeleportLocationRequest(this.RequestTeleportLocation); + + /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); @@ -562,51 +566,7 @@ namespace OpenSim.Region.Scenes return; } - /// - /// - /// - protected void InformClientOfNeighbours(IClientAPI remoteClient) - { - // Console.WriteLine("informing client of neighbouring regions"); - List neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); - - //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); - if (neighbours != null) - { - for (int i = 0; i < neighbours.Count; i++) - { - // Console.WriteLine("sending neighbours data"); - AgentCircuitData agent = remoteClient.RequestClientInfo(); - agent.BaseFolder = LLUUID.Zero; - agent.InventoryFolder = LLUUID.Zero; - agent.startpos = new LLVector3(128, 128, 70); - agent.child = true; - this.commsManager.InterSims.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent); - remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort); - } - } - } - - /// - /// - /// - /// - /// - public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) - { - return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); - } - - /// - /// - /// - /// - /// - /// - public void InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) - { - this.commsManager.InterSims.ExpectAvatarCrossing(regionhandle, agentID, position); - } + /// /// @@ -725,11 +685,97 @@ namespace OpenSim.Region.Scenes { if (this.Avatars.ContainsKey(agentID)) { - this.Avatars[agentID].Pos = position; + this.Avatars[agentID].UpGradeAvatar(position); } } } + /// + /// + /// + protected void InformClientOfNeighbours(IClientAPI remoteClient) + { + // Console.WriteLine("informing client of neighbouring regions"); + List neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); + + //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); + if (neighbours != null) + { + for (int i = 0; i < neighbours.Count; i++) + { + // Console.WriteLine("sending neighbours data"); + AgentCircuitData agent = remoteClient.RequestClientInfo(); + agent.BaseFolder = LLUUID.Zero; + agent.InventoryFolder = LLUUID.Zero; + agent.startpos = new LLVector3(128, 128, 70); + agent.child = true; + this.commsManager.InterRegion.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent); + remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort); + } + } + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) + { + return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); + } + + /// + /// + /// + /// + /// + /// + /// + public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) + { + List mapBlocks; + mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); + + remoteClient.SendMapBlock(mapBlocks); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) + { + if (regionHandle == this.m_regionHandle) + { + if (this.Avatars.ContainsKey(remoteClient.AgentId)) + { + remoteClient.SendTeleportLocationStart(); + remoteClient.SendLocalTeleport(position, lookAt, flags); + this.Avatars[remoteClient.AgentId].Teleport(position); + } + } + else + { + remoteClient.SendTeleportCancel(); + } + } + + /// + /// + /// + /// + /// + /// + public void InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) + { + this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); + } + #endregion /// diff --git a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs index d9d07b04a7..05c2aba1fd 100644 --- a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs +++ b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs @@ -39,6 +39,7 @@ using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Region.Scripting; using OpenSim.Terrain; +using OpenSim.Caches; namespace OpenSim.Region.Scenes { @@ -54,6 +55,7 @@ namespace OpenSim.Region.Scenes protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine protected object m_syncRoot = new object(); private uint m_nextLocalId = 8880000; + protected AssetCache assetCache; #region Update Methods /// diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs index 0ace92cf43..80719d6f6c 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs @@ -63,6 +63,8 @@ namespace OpenSim public event GenericCall2 OnStopMovement; public event NewAvatar OnNewAvatar; public event GenericCall6 OnRemoveAvatar; + public event RequestMapBlocks OnRequestMapBlocks; + public event TeleportLocationRequest OnTeleportLocationRequest; public event ParcelPropertiesRequest OnParcelPropertiesRequest; public event ParcelDivideRequest OnParcelDivideRequest; @@ -155,7 +157,7 @@ namespace OpenSim handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3; handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0; handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1; - handshake.RegionInfo.TerrainDetail2 =regionInfo.estateSettings.terrainDetail2; + handshake.RegionInfo.TerrainDetail2 = regionInfo.estateSettings.terrainDetail2; handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3; handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? @@ -166,7 +168,7 @@ namespace OpenSim /// /// /// - public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos) + public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); mov.AgentData.SessionID = this.SessionID; @@ -182,16 +184,16 @@ namespace OpenSim { mov.Data.Position = this.startpos; } - mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); + mov.Data.LookAt = look; OutPacket(mov); } public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { - SendChatMessage( Helpers.StringToField( message ), type, fromPos, fromName, fromAgentID); + SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID); } - + /// /// /// @@ -216,7 +218,7 @@ namespace OpenSim this.OutPacket(reply); } - + /// /// Send the region heightmap to the client /// @@ -272,7 +274,7 @@ namespace OpenSim OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); } } - + /// /// /// @@ -314,8 +316,8 @@ namespace OpenSim public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, System.Net.IPAddress newRegionIP, ushort newRegionPort) { - LLVector3 look = new LLVector3(lookAt.X *10, lookAt.Y *10, lookAt.Z *10); - + LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10); + CrossedRegionPacket newSimPack = new CrossedRegionPacket(); newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); newSimPack.AgentData.AgentID = this.AgentID; @@ -334,7 +336,86 @@ namespace OpenSim newSimPack.RegionData.SeedCapability = new byte[0]; this.OutPacket(newSimPack); - this.DowngradeClient(); + //this.DowngradeClient(); + } + + public void SendMapBlock(List mapBlocks) + { + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + + MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); + mapReply.AgentData.AgentID = this.AgentID; + mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; + mapReply.AgentData.Flags = 0; + + for (int i = 0; i < mapBlocks.Count; i++) + { + mapReply.Data[i] = new MapBlockReplyPacket.DataBlock(); + mapReply.Data[i].MapImageID = mapBlocks[i].MapImageId; + mapReply.Data[i].X = mapBlocks[i].X; + mapReply.Data[i].Y = mapBlocks[i].Y; + mapReply.Data[i].WaterHeight = mapBlocks[i].WaterHeight; + mapReply.Data[i].Name = _enc.GetBytes(mapBlocks[i].Name); + mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags; + mapReply.Data[i].Access = mapBlocks[i].Access; + mapReply.Data[i].Agents = mapBlocks[i].Agents; + } + this.OutPacket(mapReply); + } + + public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) + { + TeleportLocalPacket tpLocal2 = new TeleportLocalPacket(); + tpLocal2.Info.AgentID = this.AgentID; + tpLocal2.Info.TeleportFlags = flags; + tpLocal2.Info.LocationID = 2; + tpLocal2.Info.LookAt = lookAt; + tpLocal2.Info.Position = position; + OutPacket(tpLocal2); + } + + public void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags) + { + TeleportFinishPacket Teleport = new TeleportFinishPacket(); + Teleport.Info.AgentID = this.AgentID; + Teleport.Info.RegionHandle = regionHandle; + Teleport.Info.SimAccess = simAccess; + Teleport.Info.SeedCapability = new byte[0]; + + System.Net.IPAddress oIP = System.Net.IPAddress.Parse(ipAddress); + byte[] byteIP = oIP.GetAddressBytes(); + uint ip = (uint)byteIP[3] << 24; + ip += (uint)byteIP[2] << 16; + ip += (uint)byteIP[1] << 8; + ip += (uint)byteIP[0]; + + Teleport.Info.SimIP = ip; + Teleport.Info.SimPort = ipPort; + Teleport.Info.LocationID = 4; + Teleport.Info.TeleportFlags = 1 << 4; + OutPacket(Teleport); + } + + /// + /// + /// + public void SendTeleportCancel() + { + TeleportCancelPacket tpCancel = new TeleportCancelPacket(); + tpCancel.Info.SessionID = this.SessionID; + tpCancel.Info.AgentID = this.AgentID; + + OutPacket(tpCancel); + } + + /// + /// + /// + public void SendTeleportLocationStart() + { + TeleportStartPacket tpStart = new TeleportStartPacket(); + tpStart.Info.TeleportFlags = 16; // Teleport via location + OutPacket(tpStart); } #region Appearance/ Wearables Methods @@ -511,7 +592,7 @@ namespace OpenSim outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID); outPacket.ObjectData[0].ID = localID; - outPacket.ObjectData[0].FullID = primData.FullID; + outPacket.ObjectData[0].FullID = primData.FullID; byte[] pb = pos.GetBytes(); Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); @@ -570,7 +651,7 @@ namespace OpenSim ushort InternVelocityY; ushort InternVelocityZ; Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0); - + internDirec = new Axiom.MathLib.Vector3(velocity.X, velocity.Y, velocity.Z); internDirec = internDirec / 128.0f; diff --git a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs index aaac4d0505..a173c47f3a 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs @@ -191,6 +191,8 @@ namespace OpenSim } this.OutPacket(mbReply); * */ + + } diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs index 4cf6ac2eb3..f8425da2de 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs @@ -158,7 +158,6 @@ namespace OpenSim } break; case PacketType.CompleteAgentMovement: - if (this.m_child) this.UpgradeClient(); if (OnCompleteMovementToRegion != null) { OnCompleteMovementToRegion(); @@ -396,8 +395,11 @@ namespace OpenSim break; case PacketType.MapBlockRequest: MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; - - this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); + if (OnRequestMapBlocks != null) + { + OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); + } + //this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); break; case PacketType.TeleportLandmarkRequest: TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; @@ -449,16 +451,25 @@ namespace OpenSim break; case PacketType.TeleportLocationRequest: TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; - Console.WriteLine(tpLocReq.ToString()); + // Console.WriteLine(tpLocReq.ToString()); - tpStart = new TeleportStartPacket(); - tpStart.Info.TeleportFlags = 16; // Teleport via location - Console.WriteLine(tpStart.ToString()); - OutPacket(tpStart); - - if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle) + if (OnTeleportLocationRequest != null) { - /* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */ + OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); + } + else + { + //no event handler so cancel request + TeleportCancelPacket tpCancel = new TeleportCancelPacket(); + tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; + tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; + + OutPacket(tpCancel); + } + + /* if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle) + { + // m_gridServer.getRegion(tpLocReq.Info.RegionHandle); Console.WriteLine("Inter-sim teleport not yet implemented"); TeleportCancelPacket tpCancel = new TeleportCancelPacket(); tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; @@ -469,15 +480,15 @@ namespace OpenSim else { Console.WriteLine("Local teleport"); - TeleportLocalPacket tpLocal = new TeleportLocalPacket(); - tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID; - tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags; - tpLocal.Info.LocationID = 2; - tpLocal.Info.LookAt = tpLocReq.Info.LookAt; - tpLocal.Info.Position = tpLocReq.Info.Position; - OutPacket(tpLocal); + TeleportLocalPacket tpLocal2 = new TeleportLocalPacket(); + tpLocal2.Info.AgentID = tpLocReq.AgentData.AgentID; + tpLocal2.Info.TeleportFlags = tpStart.Info.TeleportFlags; + tpLocal2.Info.LocationID = 2; + tpLocal2.Info.LookAt = tpLocReq.Info.LookAt; + tpLocal2.Info.Position = tpLocReq.Info.Position; + OutPacket(tpLocal2); - } + }*/ break; #endregion diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs index 29c871e8c0..74dbc1a288 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.cs @@ -95,7 +95,7 @@ namespace OpenSim cirpack = initialcirpack; userEP = remoteEP; - this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code); + //this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code); this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); PacketQueue = new BlockingQueue(); @@ -113,27 +113,6 @@ namespace OpenSim } # region Client Methods - public void UpgradeClient() - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent"); - this.m_child = false; - //this.startpos = m_authenticateSessionsHandler.GetPosition(CircuitCode); - m_authenticateSessionsHandler.UpdateAgentChildStatus(CircuitCode, false); - if (OnChildAgentStatus != null) - { - OnChildAgentStatus(this.m_child); - } - } - - public void DowngradeClient() - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child"); - this.m_child = true; - if (OnChildAgentStatus != null) - { - OnChildAgentStatus(this.m_child); - } - } public void KillClient() { @@ -147,9 +126,7 @@ namespace OpenSim } this.m_inventoryCache.ClientLeaving(this.AgentID, null); - - - // m_world.RemoveViewerAgent(this); + m_world.RemoveAvatar(this.AgentId); m_clientThreads.Remove(this.CircuitCode); m_networkServer.RemoveClientCircuit(this.CircuitCode); diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index 5915b81e31..fb8511da3e 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -236,7 +236,7 @@ namespace OpenSim m_console.componentname = "Region " + regionData.RegionName; */ - LocalWorld = new Scene(udpServer.PacketServer.ClientAPIs, regionDat, authenBase, commsManager); + LocalWorld = new Scene(udpServer.PacketServer.ClientAPIs, regionDat, authenBase, commsManager, this.AssetCache); this.m_localWorld.Add(LocalWorld); //LocalWorld.InventoryCache = InventoryCache; //LocalWorld.AssetCache = AssetCache; diff --git a/bin/assets/base_shape.dat b/bin/assets/base_shape.dat new file mode 100644 index 0000000000..920c7758c4 --- /dev/null +++ b/bin/assets/base_shape.dat @@ -0,0 +1,105 @@ +LLWearable version 22 +Female Shape and Outfit 3 Shape +Created by system from avatar's appearance. + permissions 0 + { + base_mask 00082000 + owner_mask 00082000 + group_mask 00082000 + everyone_mask 00082000 + next_owner_mask 00082000 + creator_id 3d924400-038e-6ad9-920b-cfbb9b40585c + owner_id 542ffb8e-8932-49b9-8664-58f53e442797 + last_owner_id 3d924400-038e-6ad9-920b-cfbb9b40585c + group_id 00000000-0000-0000-0000-000000000000 + } + sale_info 0 + { + sale_type not + sale_price 0 + } +type 0 +parameters 82 +1 .21 +2 -.5 +4 -.11 +5 -.1 +6 -.3 +7 -.4 +8 -.5 +10 .7 +11 .34 +12 -.5 +13 0 +14 .04 +15 .58 +17 .56 +18 -.26 +19 -.73 +20 -.34 +21 -.01 +22 1 +23 -.5 +24 -.63 +25 .44 +27 .05 +33 -.24 +34 -.7 +35 -.16 +36 -.2 +37 -.98 +38 -.5 +80 0 +105 .07 +155 -.22 +157 0 +185 -1 +193 .86 +196 -.74 +505 .65 +506 .12 +507 -1.5 +515 0 +517 .16 +518 .8 +629 0 +637 0 +646 .4 +647 1 +649 .36 +650 .85 +652 .49 +653 -1 +656 0 +659 .65 +662 .5 +663 0 +664 0 +665 0 +675 -.15 +676 .26 +678 .28 +682 .27 +683 -.19 +684 -.09 +685 0 +690 .45 +692 .4 +693 -0 +753 -.5 +756 -.08 +758 .24 +759 .6 +760 .11 +764 -.38 +765 -.3 +769 .42 +773 .51 +795 .16 +796 .11 +799 .36 +841 0 +842 -.82 +879 0 +880 0 +textures 0 diff --git a/bin/assets/bricks.jp2 b/bin/assets/bricks.jp2 new file mode 100644 index 0000000000..09c65abd53 Binary files /dev/null and b/bin/assets/bricks.jp2 differ diff --git a/bin/assets/granite.jp2 b/bin/assets/granite.jp2 new file mode 100644 index 0000000000..b842eb877a Binary files /dev/null and b/bin/assets/granite.jp2 differ diff --git a/bin/assets/hardwood.jp2 b/bin/assets/hardwood.jp2 new file mode 100644 index 0000000000..8ae695ea49 Binary files /dev/null and b/bin/assets/hardwood.jp2 differ diff --git a/bin/assets/map1.jp2 b/bin/assets/map1.jp2 new file mode 100644 index 0000000000..cd2fd94422 Binary files /dev/null and b/bin/assets/map1.jp2 differ diff --git a/bin/assets/map_base.jp2 b/bin/assets/map_base.jp2 new file mode 100644 index 0000000000..5ad1fd0f43 Binary files /dev/null and b/bin/assets/map_base.jp2 differ diff --git a/bin/assets/plywood.jp2 b/bin/assets/plywood.jp2 new file mode 100644 index 0000000000..1643ff1b1f Binary files /dev/null and b/bin/assets/plywood.jp2 differ diff --git a/bin/assets/rocks.jp2 b/bin/assets/rocks.jp2 new file mode 100644 index 0000000000..f0bbd89f6c Binary files /dev/null and b/bin/assets/rocks.jp2 differ diff --git a/bin/assets/testpic2.jp2 b/bin/assets/testpic2.jp2 new file mode 100644 index 0000000000..e6840e2139 Binary files /dev/null and b/bin/assets/testpic2.jp2 differ diff --git a/prebuild.xml b/prebuild.xml index 3b88ba9a7f..a66dab4ce4 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -517,6 +517,7 @@ +