From cc02f78d4e8f0cae4168e6d634f86d0ea9d0b537 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 01:48:38 +0100 Subject: Simplify and streamline telehub editing code. Verify rotations and fix spwan point positioning on rotated telehubs. --- OpenSim/Framework/RegionSettings.cs | 2 +- .../World/Estate/EstateManagementModule.cs | 19 +++--- .../CoreModules/World/Estate/TelehubManager.cs | 69 +++++++--------------- 3 files changed, 31 insertions(+), 59 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index 8322cd6..786638e 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -47,6 +47,7 @@ namespace OpenSim.Framework // 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); @@ -66,7 +67,6 @@ namespace OpenSim.Framework Vector3 dir = new Vector3(1, 0, 0) * p * y; Vector3 offset = dir * (float)Distance; - rot.W = -rot.W; offset *= rot; return pos + offset; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index a8e943a..161cf82 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -623,8 +623,6 @@ namespace OpenSim.Region.CoreModules.World.Estate switch (cmd) { case "info ui": - // Send info: - SendTelehubInfo(client); break; case "connect": @@ -634,32 +632,31 @@ namespace OpenSim.Region.CoreModules.World.Estate return; SceneObjectGroup grp = part.ParentGroup; - if (m_Telehub.Connect(grp)) - SendTelehubInfo(client); + m_Telehub.Connect(grp); break; case "delete": // Disconnect Telehub - if (m_Telehub.Disconnect()) - SendTelehubInfo(client); + m_Telehub.Disconnect(); break; case "spawnpoint add": // Add SpawnPoint to the Telehub part = Scene.GetSceneObjectPart((uint)param1); - if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) - SendTelehubInfo(client); + if (part == null) + return; + m_Telehub.AddSpawnPoint(part.AbsolutePosition); break; case "spawnpoint remove": // Remove SpawnPoint from Telehub - if (m_Telehub.RemoveSpawnPoint((int)param1)) - SendTelehubInfo(client); + m_Telehub.RemoveSpawnPoint((int)param1); break; default: break; } + SendTelehubInfo(client); } private void SendSimulatorBlueBoxMessage( @@ -1358,7 +1355,7 @@ namespace OpenSim.Region.CoreModules.World.Estate foreach (SpawnPoint sp in settings.SpawnPoints()) { - spawnPoints.Add(sp.GetLocation(Vector3.Zero, telehub.GroupRotation)); + spawnPoints.Add(sp.GetLocation(Vector3.Zero, Quaternion.Identity)); } client.SendTelehubInfo(settings.TelehubObject, diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index 3eb7efa..8bc831f 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs @@ -26,15 +26,19 @@ */ 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) @@ -43,78 +47,49 @@ namespace OpenSim.Region.CoreModules.World.Estate } // Connect the Telehub - public bool Connect(SceneObjectGroup grp) + public void Connect(SceneObjectGroup grp) { - try - { - m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); - - m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID; - m_Scene.RegionInfo.RegionSettings.Save(); - } - catch (Exception ex) - { - return false; - } + m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); - return true; + m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID; + m_Scene.RegionInfo.RegionSettings.Save(); } // Disconnect the Telehub: - public bool Disconnect() + public void Disconnect() { if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) - return false; + return; - try - { - m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; - m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); - m_Scene.RegionInfo.RegionSettings.Save(); - } - catch (Exception ex) - { - return false; - } - - return true; + m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; + m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); + m_Scene.RegionInfo.RegionSettings.Save(); } // Add a SpawnPoint to the Telehub - public bool AddSpawnPoint(Vector3 point) + public void AddSpawnPoint(Vector3 point) { if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) - return false; + return; SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject); if (grp == null) - return false; + return; - try - { - SpawnPoint sp = new SpawnPoint(); - sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point); - m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp); - m_Scene.RegionInfo.RegionSettings.Save(); - } - catch (Exception ex) - { - return false; - } - - return true; + 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 bool RemoveSpawnPoint(int spawnpoint) + public void RemoveSpawnPoint(int spawnpoint) { if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) - return false; + return; m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); m_Scene.RegionInfo.RegionSettings.Save(); - - return true; } } } -- cgit v1.1