diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 3d647ca38c..3dd46cbdf6 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -210,7 +210,6 @@ namespace OpenSim.Data.MySQL } LoadBanList(es); - es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 6d14b82075..31d17f1a29 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -846,6 +846,8 @@ namespace OpenSim.Data.MySQL } } + LoadSpawnPoints(rs); + return rs; } @@ -994,7 +996,9 @@ namespace OpenSim.Data.MySQL "use_estate_sun, fixed_sun, sun_position, " + "covenant, Sandbox, sunvectorx, sunvectory, " + "sunvectorz, loaded_creation_datetime, " + - "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " + + "loaded_creation_id, map_tile_ID, " + + "TelehubObject) " + + "values (?RegionUUID, ?BlockTerraform, " + "?BlockFly, ?AllowDamage, ?RestrictPushing, " + "?AllowLandResell, ?AllowLandJoinDivide, " + "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + @@ -1009,7 +1013,7 @@ namespace OpenSim.Data.MySQL "?SunPosition, ?Covenant, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + "?LoadedCreationDateTime, ?LoadedCreationID, " + - "?TerrainImageID)"; + "?TerrainImageID, ?TelehubObject) "; FillRegionSettingsCommand(cmd, rs); @@ -1017,6 +1021,7 @@ namespace OpenSim.Data.MySQL } } } + SaveSpawnPoints(rs); } public List LoadLandObjects(UUID regionUUID) @@ -1296,6 +1301,7 @@ namespace OpenSim.Data.MySQL newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); + newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); return newSettings; } @@ -1626,7 +1632,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); - + cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); } /// @@ -1828,5 +1834,72 @@ namespace OpenSim.Data.MySQL } } } + + private void LoadSpawnPoints(RegionSettings rs) + { + rs.ClearSpawnPoints(); + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select Yaw, Pitch, Distance from spawn_points where RegionID = ?RegionID"; + cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); + + using (IDataReader r = cmd.ExecuteReader()) + { + while (r.Read()) + { + SpawnPoint sp = new SpawnPoint(); + + sp.Yaw = (float)r["Yaw"]; + sp.Pitch = (float)r["Pitch"]; + sp.Distance = (float)r["Distance"]; + + rs.AddSpawnPoint(sp); + } + } + } + } + } + } + + private void SaveSpawnPoints(RegionSettings rs) + { + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID"; + cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); + + cmd.ExecuteNonQuery(); + + cmd.Parameters.Clear(); + + cmd.CommandText = "insert into spawn_points (RegionID, Yaw, Pitch, Distance) values ( ?RegionID, ?Yaw, ?Pitch, ?Distance)"; + + foreach (SpawnPoint p in rs.SpawnPoints()) + { + cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString()); + cmd.Parameters.AddWithValue("?Yaw", p.Yaw); + cmd.Parameters.AddWithValue("?Pitch", p.Pitch); + cmd.Parameters.AddWithValue("?Distance", p.Distance); + + cmd.ExecuteNonQuery(); + cmd.Parameters.Clear(); + } + } + } + } + } } } diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 987625bbf0..720e200310 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -841,4 +841,19 @@ alter table regionban ENGINE = MyISAM; alter table regionsettings ENGINE = MyISAM; alter table terrain ENGINE = MyISAM; -COMMIT; \ No newline at end of file +COMMIT; + +:VERSION 39 #--------------- Telehub support + +BEGIN; +CREATE TABLE IF NOT EXISTS `spawn_points` ( + `RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL, + `Yaw` float NOT NULL, + `Pitch` float NOT NULL, + `Distance` float NOT NULL, + KEY `RegionID` (`RegionID`) +) ENGINE=Innodb; + +ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; +COMMIT; + diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 29a69c31f7..1326fe9dd6 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -358,6 +358,8 @@ namespace OpenSim.Framework public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2); + public delegate void EstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, UInt32 param1); + public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName); public delegate void BakeTerrain(IClientAPI remoteClient); @@ -769,6 +771,7 @@ namespace OpenSim.Framework event ModifyTerrain OnModifyTerrain; event BakeTerrain OnBakeTerrain; event EstateChangeInfo OnEstateChangeInfo; + event EstateManageTelehub OnEstateManageTelehub; // [Obsolete("LLClientView Specific.")] event SetAppearance OnSetAppearance; // [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")] @@ -1141,6 +1144,8 @@ namespace OpenSim.Framework void SendTaskInventory(UUID taskID, short serial, byte[] fileName); + void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint); + /// /// Used by the server to inform the client of new inventory items and folders. /// diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index 673cf203f8..e115432baa 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -26,11 +26,53 @@ */ using System; +using System.Collections.Generic; using System.IO; using OpenMetaverse; namespace OpenSim.Framework { + public struct SpawnPoint + { + public float Yaw; + public float Pitch; + public float Distance; + + public void SetLocation(Vector3 pos, Quaternion rot, Vector3 point) + { + // The point is an absolute position, so we need the relative + // location to the spawn point + Vector3 offset = point - pos; + Distance = Vector3.Mag(offset); + + // Next we need to rotate this vector into the spawn point's + // coordinate system + rot.W = -rot.W; + offset = offset * rot; + + Vector3 dir = Vector3.Normalize(offset); + + // Get the bearing (yaw) + Yaw = (float)Math.Atan2(dir.Y, dir.X); + + // Get the elevation (pitch) + Pitch = (float)-Math.Atan2(dir.Z, Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y)); + } + + public Vector3 GetLocation(Vector3 pos, Quaternion rot) + { + Quaternion y = Quaternion.CreateFromEulers(0, 0, Yaw); + Quaternion p = Quaternion.CreateFromEulers(0, Pitch, 0); + + Vector3 dir = new Vector3(1, 0, 0) * p * y; + Vector3 offset = dir * (float)Distance; + + offset *= rot; + + return pos + offset; + } + } + public class RegionSettings { public delegate void SaveDelegate(RegionSettings rs); @@ -397,5 +439,49 @@ namespace OpenSim.Framework set { m_LoadedCreationID = value; } } + // Connected Telehub object + private UUID m_TelehubObject; + public UUID TelehubObject + { + get + { + return m_TelehubObject; + } + set + { + m_TelehubObject = value; + } + } + + // Our Connected Telehub's SpawnPoints + public List l_SpawnPoints = new List(); + + // Add a SpawnPoint + // ** These are not region coordinates ** + // They are relative to the Telehub coordinates + // + public void AddSpawnPoint(SpawnPoint point) + { + l_SpawnPoints.Add(point); + } + + // Remove a SpawnPoint + public void RemoveSpawnPoint(int point_index) + { + l_SpawnPoints.RemoveAt(point_index); + } + + // Return the List of SpawnPoints + public List SpawnPoints() + { + return l_SpawnPoints; + + } + + // Clear the SpawnPoints List of all entries + public void ClearSpawnPoints() + { + l_SpawnPoints.Clear(); + } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4ba441ed80..29ad966316 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -219,6 +219,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event BakeTerrain OnBakeTerrain; public event RequestTerrain OnUploadTerrain; public event EstateChangeInfo OnEstateChangeInfo; + public event EstateManageTelehub OnEstateManageTelehub; public event EstateRestartSimRequest OnEstateRestartSimRequest; public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; @@ -4482,6 +4483,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } + public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint) + { + TelehubInfoPacket packet = (TelehubInfoPacket)PacketPool.Instance.GetPacket(PacketType.TelehubInfo); + packet.TelehubBlock.ObjectID = ObjectID; + packet.TelehubBlock.ObjectName = Utils.StringToBytes(ObjectName); + packet.TelehubBlock.TelehubPos = ObjectPos; + packet.TelehubBlock.TelehubRot = ObjectRot; + + packet.SpawnPointBlock = new TelehubInfoPacket.SpawnPointBlockBlock[SpawnPoint.Count]; + for (int n = 0; n < SpawnPoint.Count; n++) + { + packet.SpawnPointBlock[n] = new TelehubInfoPacket.SpawnPointBlockBlock{SpawnPointPos = SpawnPoint[n]}; + } + + OutPacket(packet, ThrottleOutPacketType.Task); + } + #endregion #region Land Data Sending Methods @@ -8920,7 +8938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack) { EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; - //m_log.Debug(messagePacket.ToString()); + // m_log.InfoFormat("[LLCLIENTVIEW]: Packet: {0}", Utils.BytesToString(messagePacket.MethodData.Method)); GodLandStatRequest handlerLandStatRequest; #region Packet Session and User Check @@ -9219,6 +9237,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; + case "telehub": + if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) + { + UUID invoice = messagePacket.MethodData.Invoice; + UUID SenderID = messagePacket.AgentData.AgentID; + UInt32 param1 = 0u; + + string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter); + + if (command != "info ui") + { + try + { + param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); + } + catch (Exception ex) + { + + } + } + + EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub; + if (handlerEstateManageTelehub != null) + { + handlerEstateManageTelehub(this, invoice, SenderID, command, param1); + } + } + return true; + default: m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); return true; @@ -9230,8 +9277,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts //lsrp.RequestData.RequestFlags; //lsrp.RequestData.Filter; - -// return true; } private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 58d94557e7..2e1487f42b 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -53,6 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Estate protected EstateManagementCommands m_commands; private EstateTerrainXferHandler TerrainUploader; + public TelehubManager m_Telehub; public event ChangeDelegate OnRegionInfoChange; public event ChangeDelegate OnEstateInfoChange; @@ -599,6 +600,50 @@ namespace OpenSim.Region.CoreModules.World.Estate } } + public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) + { + uint ObjectLocalID; + SceneObjectPart part; + + switch (cmd) + { + case "info ui": + break; + + case "connect": + // Add the Telehub + part = Scene.GetSceneObjectPart((uint)param1); + if (part == null) + return; + SceneObjectGroup grp = part.ParentGroup; + + m_Telehub.Connect(grp); + break; + + case "delete": + // Disconnect Telehub + m_Telehub.Disconnect(); + break; + + case "spawnpoint add": + // Add SpawnPoint to the Telehub + part = Scene.GetSceneObjectPart((uint)param1); + if (part == null) + return; + m_Telehub.AddSpawnPoint(part.AbsolutePosition); + break; + + case "spawnpoint remove": + // Remove SpawnPoint from Telehub + m_Telehub.RemoveSpawnPoint((int)param1); + break; + + default: + break; + } + SendTelehubInfo(client); + } + private void SendSimulatorBlueBoxMessage( IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) { @@ -1055,7 +1100,9 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegisterModuleInterface(this); Scene.EventManager.OnNewClient += EventManager_OnNewClient; Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; - + + m_Telehub = new TelehubManager(scene); + m_commands = new EstateManagementCommands(this); m_commands.Initialise(); } @@ -1109,6 +1156,7 @@ namespace OpenSim.Region.CoreModules.World.Estate client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; client.OnEstateChangeInfo += handleEstateChangeInfo; + client.OnEstateManageTelehub += handleOnEstateManageTelehub; client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; @@ -1243,5 +1291,39 @@ namespace OpenSim.Region.CoreModules.World.Estate if (onmessage != null) onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message); } + + + private void SendTelehubInfo(IClientAPI client) + { + RegionSettings settings = + this.Scene.RegionInfo.RegionSettings; + + SceneObjectGroup telehub = null; + if (settings.TelehubObject != UUID.Zero && + (telehub = Scene.GetSceneObjectGroup(settings.TelehubObject)) != null) + { + List spawnPoints = new List(); + + foreach (SpawnPoint sp in settings.SpawnPoints()) + { + spawnPoints.Add(sp.GetLocation(Vector3.Zero, Quaternion.Identity)); + } + + client.SendTelehubInfo(settings.TelehubObject, + telehub.Name, + telehub.AbsolutePosition, + telehub.GroupRotation, + spawnPoints); + } + else + { + client.SendTelehubInfo(UUID.Zero, + String.Empty, + Vector3.Zero, + Quaternion.Identity, + new List()); + } + } } } + diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs new file mode 100644 index 0000000000..8bc831f221 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs @@ -0,0 +1,95 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using OpenMetaverse; +using System.Collections.Generic; +using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; +using log4net; + +namespace OpenSim.Region.CoreModules.World.Estate +{ + public class TelehubManager + { + // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + Scene m_Scene; + + public TelehubManager(Scene scene) + { + m_Scene = scene; + } + + // Connect the Telehub + public void Connect(SceneObjectGroup grp) + { + m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); + + m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID; + m_Scene.RegionInfo.RegionSettings.Save(); + } + + // Disconnect the Telehub: + public void Disconnect() + { + if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) + return; + + m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; + m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); + m_Scene.RegionInfo.RegionSettings.Save(); + } + + // Add a SpawnPoint to the Telehub + public void AddSpawnPoint(Vector3 point) + { + if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) + return; + + SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject); + if (grp == null) + return; + + SpawnPoint sp = new SpawnPoint(); + sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point); + m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp); + m_Scene.RegionInfo.RegionSettings.Save(); + } + + // Remove a SpawnPoint from the Telehub + public void RemoveSpawnPoint(int spawnpoint) + { + if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) + return; + + m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); + m_Scene.RegionInfo.RegionSettings.Save(); + } + } +} diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c66f30e7a5..5c56150003 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3835,8 +3835,61 @@ namespace OpenSim.Region.Framework.Scenes } } + private void CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos) + { + if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == + (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || + (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || + (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || + (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) + { + if (GodLevel < 200 && + ((!m_scene.Permissions.IsGod(m_uuid) && + !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || + (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || + (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) + { + SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); + if (spawnPoints.Length == 0) + return; + + float distance = 9999; + int closest = -1; + + for (int i = 0 ; i < spawnPoints.Length ; i++) + { + Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + Vector3 offset = spawnPosition - pos; + float d = Vector3.Mag(offset); + if (d >= distance) + continue; + ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); + if (land == null) + continue; + if (land.IsEitherBannedOrRestricted(UUID)) + continue; + distance = d; + closest = i; + } + if (closest == -1) + return; + + pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + } + } + } + private void CheckAndAdjustLandingPoint(ref Vector3 pos) { + SceneObjectGroup telehub = null; + if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) + { + if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) + { + CheckAndAdjustTelehub(telehub, ref pos); + return; + } + } ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 32de85f6ab..bbf3729114 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -658,6 +658,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event ModifyTerrain OnModifyTerrain; public event BakeTerrain OnBakeTerrain; public event EstateChangeInfo OnEstateChangeInfo; + public event EstateManageTelehub OnEstateManageTelehub; public event SetAppearance OnSetAppearance; public event AvatarNowWearing OnAvatarNowWearing; public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; @@ -1530,6 +1531,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } + public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint) + { + + } + public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) { diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 5f4f937811..6a6c4c3136 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -32,6 +32,7 @@ using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.CoreModules.World.Estate; namespace OpenSim.Region.OptionalModules.World.NPC { @@ -334,6 +335,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest; public event EstateChangeInfo OnEstateChangeInfo; + public event EstateManageTelehub OnEstateManageTelehub; public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; @@ -923,6 +925,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void SendEstateCovenantInformation(UUID covenant) { } + public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint) + { + } public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) { } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index fad757ae6a..ab89fe02b4 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -194,6 +194,7 @@ namespace OpenSim.Tests.Common.Mock public event RegionInfoRequest OnRegionInfoRequest; public event EstateCovenantRequest OnEstateCovenantRequest; public event EstateChangeInfo OnEstateChangeInfo; + public event EstateManageTelehub OnEstateManageTelehub; public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; @@ -951,6 +952,10 @@ namespace OpenSim.Tests.Common.Mock { } + public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint) + { + } + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } diff --git a/TESTING.txt b/TESTING.txt index 54fc976e95..08a0698d2f 100644 --- a/TESTING.txt +++ b/TESTING.txt @@ -69,3 +69,6 @@ Example nunit-console2 OpenSim.Framework.Tests.dll (on linux) nunit-console OpenSim.Framework.Tests.dll (on windows) + +See the file OpenSim/Data/Tests/Resources/TestDataConnections.ini +for information to setup testing for data