From b6f3de5028ab9a288f60b020a0dffda079dc550d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 20 Jan 2012 23:50:37 -0500 Subject: Telehub Support: Support for viewer side of telehub management. Can manupulate Telehubs and SpawnPoints from the viewer estate managemnt tools. This is a work in progress and does not yet persist or affect teleport routing. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 39 ++++++- .../World/Estate/EstateManagementModule.cs | 65 ++++++++++- .../CoreModules/World/Estate/TelehubManager.cs | 130 +++++++++++++++++++++ .../Server/IRCClientView.cs | 6 + .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 5 + 5 files changed, 241 insertions(+), 4 deletions(-) create mode 100644 OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4ba441e..a94fb20 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,23 @@ 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 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); + + string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter); + + 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 +9265,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 58d9455..0d4df6c 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; + private TelehubManager m_Telehub; public event ChangeDelegate OnRegionInfoChange; public event ChangeDelegate OnEstateInfoChange; @@ -599,6 +600,65 @@ namespace OpenSim.Region.CoreModules.World.Estate } } + private void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) + { + uint ObjectLocalID; + SceneObjectPart part; + // UUID EstateID = Scene.RegionInfo.EstateSettings.EstateID; + TelehubManager.Telehub telehub; + + switch (cmd) + { + case "info ui": + // Send info: + if (m_Telehub.HasTelehub) + { + telehub = m_Telehub.TelehubVals(); + client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, + telehub.ObjectRotation, telehub.SpawnPoint); + } + else + { + return; + } + break; + + case "connect": + // Add the Telehub + part = Scene.GetSceneObjectPart((uint)param1); + telehub = m_Telehub.Connect(part); + client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, + telehub.ObjectRotation, telehub.SpawnPoint); + break; + + case "delete": + // Disconnect Telehub + part = Scene.GetSceneObjectPart((uint)param1); + telehub = m_Telehub.DisConnect(part); + client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, + telehub.ObjectRotation, telehub.SpawnPoint); + break; + + case "spawnpoint add": + // Add SpawnPoint to the Telehub + part = Scene.GetSceneObjectPart((uint)param1); + telehub = m_Telehub.AddSpawnPoint(part.AbsolutePosition); + client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, + telehub.ObjectRotation, telehub.SpawnPoint); + break; + + case "spawnpoint remove": + // Remove SpawnPoint from Telehub + telehub = m_Telehub.RemoveSpawnPoint((int)param1); + client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, + telehub.ObjectRotation, telehub.SpawnPoint); + break; + + default: + break; + } + } + private void SendSimulatorBlueBoxMessage( IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) { @@ -1055,7 +1115,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 +1171,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; diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs new file mode 100644 index 0000000..c99c9ba --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs @@ -0,0 +1,130 @@ +/* + * 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 OpenMetaverse; +using System.Collections.Generic; +using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.CoreModules.World.Estate +{ + public class TelehubManager + { + public struct Telehub + { + public UUID ObjectID; + public string ObjectName; + public Vector3 ObjectPosition; + public Quaternion ObjectRotation; + public List SpawnPoint; + }; + + private UUID ObjectID; + private string ObjectName; + private Vector3 ObjectPosition; + Quaternion ObjectRotation; + List SpawnPoint = new List(); + UUID EstateID; + bool m_HasTelehub = false; + Scene m_Scene; + // This will get an option... + Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,-3.0f); + + public bool HasTelehub + { + get { return m_HasTelehub; } + } + + public TelehubManager(Scene scene) + { + m_Scene = scene; + } + + // Fill our Telehub struct with values + public Telehub TelehubVals() + { + Telehub telehub = new Telehub(); + + telehub.ObjectID = ObjectID; + telehub.ObjectName = ObjectName; + telehub.ObjectPosition = ObjectPosition; + telehub.ObjectRotation = ObjectRotation; + telehub.SpawnPoint = SpawnPoint; + return telehub; + } + + // Connect the Telehub + public Telehub Connect(SceneObjectPart part) + { + ObjectID = part.UUID; + ObjectName = part.Name; + ObjectPosition = part.AbsolutePosition; + ObjectRotation = part.GetWorldRotation(); + // Clear this for now + SpawnPoint.Clear(); + SpawnPoint.Add(InitialSpawnPoint); + m_HasTelehub = true; + + return TelehubVals(); + } + + // Disconnect the Telehub + public Telehub DisConnect(SceneObjectPart part) + { + ObjectID = UUID.Zero; + ObjectName = String.Empty; + ObjectPosition = Vector3.Zero; + ObjectRotation = Quaternion.Identity; + SpawnPoint.Clear(); + m_HasTelehub = false; + + return TelehubVals(); + } + + // Add a SpawnPoint to the Telehub + public Telehub AddSpawnPoint(Vector3 point) + { + float dist = (float) Util.GetDistanceTo(ObjectPosition, point); + + Vector3 nvec = Util.GetNormalizedVector(point - ObjectPosition); + + Vector3 spoint = nvec * dist; + + SpawnPoint.Add(spoint); + return TelehubVals(); + } + + // Remove a SpawnPoint from the Telehub + public Telehub RemoveSpawnPoint(int spawnpoint) + { + SpawnPoint.RemoveAt(spawnpoint); + + return TelehubVals(); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 32de85f..bbf3729 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 5f4f937..6a6c4c3 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) { } -- cgit v1.1 From 32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 21 Jan 2012 23:26:27 -0500 Subject: Telehub Support: Telehub settings now persist to the database and are saved across sim restarts. So-far this only works on MySQL. this is a work in progress, teleport routing is not yet implemented. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 14 ++- .../World/Estate/EstateManagementModule.cs | 50 ++++++---- .../CoreModules/World/Estate/TelehubManager.cs | 111 ++++++++++++--------- 3 files changed, 105 insertions(+), 70 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a94fb20..29ad966 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -9242,10 +9242,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP { UUID invoice = messagePacket.MethodData.Invoice; UUID SenderID = messagePacket.AgentData.AgentID; - UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); + 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) { diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 0d4df6c..6a02ffe 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Estate protected EstateManagementCommands m_commands; private EstateTerrainXferHandler TerrainUploader; - private TelehubManager m_Telehub; + public TelehubManager m_Telehub; public event ChangeDelegate OnRegionInfoChange; public event ChangeDelegate OnEstateInfoChange; @@ -600,22 +600,20 @@ namespace OpenSim.Region.CoreModules.World.Estate } } - private void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) + public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) { uint ObjectLocalID; SceneObjectPart part; - // UUID EstateID = Scene.RegionInfo.EstateSettings.EstateID; - TelehubManager.Telehub telehub; switch (cmd) { case "info ui": // Send info: - if (m_Telehub.HasTelehub) + if (Scene.RegionInfo.EstateSettings.HasTelehub) { - telehub = m_Telehub.TelehubVals(); - client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, - telehub.ObjectRotation, telehub.SpawnPoint); + EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, + settings.TelehubRot, settings.SpawnPoints()); } else { @@ -626,32 +624,44 @@ namespace OpenSim.Region.CoreModules.World.Estate case "connect": // Add the Telehub part = Scene.GetSceneObjectPart((uint)param1); - telehub = m_Telehub.Connect(part); - client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, - telehub.ObjectRotation, telehub.SpawnPoint); + if (m_Telehub.Connect(part)) + { + EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, + settings.TelehubRot, settings.SpawnPoints()); + } break; case "delete": // Disconnect Telehub part = Scene.GetSceneObjectPart((uint)param1); - telehub = m_Telehub.DisConnect(part); - client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, - telehub.ObjectRotation, telehub.SpawnPoint); + if (m_Telehub.DisConnect(part)) + { + EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, + settings.TelehubRot, settings.SpawnPoints()); + } break; case "spawnpoint add": // Add SpawnPoint to the Telehub part = Scene.GetSceneObjectPart((uint)param1); - telehub = m_Telehub.AddSpawnPoint(part.AbsolutePosition); - client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, - telehub.ObjectRotation, telehub.SpawnPoint); + if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) + { + EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, + settings.TelehubRot, settings.SpawnPoints()); + } break; case "spawnpoint remove": // Remove SpawnPoint from Telehub - telehub = m_Telehub.RemoveSpawnPoint((int)param1); - client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, - telehub.ObjectRotation, telehub.SpawnPoint); + if (m_Telehub.RemoveSpawnPoint((int)param1)) + { + EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, + settings.TelehubRot, settings.SpawnPoints()); + } break; default: diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index c99c9ba..309ef13 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs @@ -35,14 +35,6 @@ namespace OpenSim.Region.CoreModules.World.Estate { public class TelehubManager { - public struct Telehub - { - public UUID ObjectID; - public string ObjectName; - public Vector3 ObjectPosition; - public Quaternion ObjectRotation; - public List SpawnPoint; - }; private UUID ObjectID; private string ObjectName; @@ -52,8 +44,9 @@ namespace OpenSim.Region.CoreModules.World.Estate UUID EstateID; bool m_HasTelehub = false; Scene m_Scene; + EstateSettings m_EstateSettings; // This will get an option... - Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,-3.0f); + Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,0.0f); public bool HasTelehub { @@ -63,68 +56,88 @@ namespace OpenSim.Region.CoreModules.World.Estate public TelehubManager(Scene scene) { m_Scene = scene; + m_EstateSettings = m_Scene.RegionInfo.EstateSettings; } // Fill our Telehub struct with values - public Telehub TelehubVals() - { - Telehub telehub = new Telehub(); - - telehub.ObjectID = ObjectID; - telehub.ObjectName = ObjectName; - telehub.ObjectPosition = ObjectPosition; - telehub.ObjectRotation = ObjectRotation; - telehub.SpawnPoint = SpawnPoint; - return telehub; - } +// public Telehub TelehubVals() +// { +// // Telehub telehub = new Telehub(); +// EstateSettings telehub = m_EstateSettings; +// +// telehub.TelehubObject = ObjectID; +// telehub.TelehubName = ObjectName; +// telehub.TelehubPos = ObjectPosition; +// telehub.TelehubRot = ObjectRotation; +// telehub. = SpawnPoint; +// return telehub; +// } // Connect the Telehub - public Telehub Connect(SceneObjectPart part) + public bool Connect(SceneObjectPart part) { - ObjectID = part.UUID; - ObjectName = part.Name; - ObjectPosition = part.AbsolutePosition; - ObjectRotation = part.GetWorldRotation(); - // Clear this for now - SpawnPoint.Clear(); - SpawnPoint.Add(InitialSpawnPoint); - m_HasTelehub = true; + m_EstateSettings.ClearSpawnPoints(); - return TelehubVals(); + m_EstateSettings.TelehubObject = part.UUID; + m_EstateSettings.TelehubName = part.Name; + m_EstateSettings.TelehubPos = part.AbsolutePosition; + m_EstateSettings.TelehubRot = part.GetWorldRotation(); + + // Clear this for now + m_EstateSettings.AddSpawnPoint(InitialSpawnPoint); + m_EstateSettings.HasTelehub = true; + m_EstateSettings.Save(); + return true; } - // Disconnect the Telehub - public Telehub DisConnect(SceneObjectPart part) + // Disconnect the Telehub: Clear it out for now, look at just disableing + public bool DisConnect(SceneObjectPart part) { - ObjectID = UUID.Zero; - ObjectName = String.Empty; - ObjectPosition = Vector3.Zero; - ObjectRotation = Quaternion.Identity; - SpawnPoint.Clear(); - m_HasTelehub = false; - - return TelehubVals(); + bool result = false; + + try{ + m_EstateSettings.TelehubObject = UUID.Zero; + m_EstateSettings.TelehubName = String.Empty; + m_EstateSettings.TelehubPos = Vector3.Zero; + // This is probably wrong! But, HasTelehub will block access + m_EstateSettings.TelehubRot = Quaternion.Identity; + m_EstateSettings.ClearSpawnPoints(); + m_EstateSettings.HasTelehub = false; + m_EstateSettings.Save(); + result = true; + } + catch (Exception ex) + { + result = false; + } + finally + { + + } + + return result; } // Add a SpawnPoint to the Telehub - public Telehub AddSpawnPoint(Vector3 point) + public bool AddSpawnPoint(Vector3 point) { - float dist = (float) Util.GetDistanceTo(ObjectPosition, point); - - Vector3 nvec = Util.GetNormalizedVector(point - ObjectPosition); + float dist = (float) Util.GetDistanceTo(m_EstateSettings.TelehubPos, point); + Vector3 nvec = Util.GetNormalizedVector(point - m_EstateSettings.TelehubPos); Vector3 spoint = nvec * dist; - SpawnPoint.Add(spoint); - return TelehubVals(); + m_EstateSettings.AddSpawnPoint(spoint); + m_EstateSettings.Save(); + return true; } // Remove a SpawnPoint from the Telehub - public Telehub RemoveSpawnPoint(int spawnpoint) + public bool RemoveSpawnPoint(int spawnpoint) { - SpawnPoint.RemoveAt(spawnpoint); + m_EstateSettings.RemoveSpawnPoint(spawnpoint); + m_EstateSettings.Save(); - return TelehubVals(); + return true; } } } \ No newline at end of file -- cgit v1.1 From 68365c20c0b3a3164881398f3bc3710f7960c52d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 22 Jan 2012 11:36:04 +0000 Subject: Move Telehub tables and data from EstateSettings to RegionSettings. This is damage control es EstateSettings is not the place this can be put. EstateSettings is nt unique to a region and therefore would introduce a hard limit of one telehub per estate, completely shutting off the option of having SL style telehubs, e.g. one per region. Whole estate teleport routing can still be implemented id desiresd, this way all options are open while the other way most options get closed off. --- .../World/Estate/EstateManagementModule.cs | 12 +++--- .../CoreModules/World/Estate/TelehubManager.cs | 46 +++++++++++----------- 2 files changed, 28 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 6a02ffe..cdcea65 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -609,9 +609,9 @@ namespace OpenSim.Region.CoreModules.World.Estate { case "info ui": // Send info: - if (Scene.RegionInfo.EstateSettings.HasTelehub) + if (Scene.RegionInfo.RegionSettings.HasTelehub) { - EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + RegionSettings settings = this.Scene.RegionInfo.RegionSettings; client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, settings.TelehubRot, settings.SpawnPoints()); } @@ -626,7 +626,7 @@ namespace OpenSim.Region.CoreModules.World.Estate part = Scene.GetSceneObjectPart((uint)param1); if (m_Telehub.Connect(part)) { - EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + RegionSettings settings = this.Scene.RegionInfo.RegionSettings; client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, settings.TelehubRot, settings.SpawnPoints()); } @@ -637,7 +637,7 @@ namespace OpenSim.Region.CoreModules.World.Estate part = Scene.GetSceneObjectPart((uint)param1); if (m_Telehub.DisConnect(part)) { - EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + RegionSettings settings = this.Scene.RegionInfo.RegionSettings; client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, settings.TelehubRot, settings.SpawnPoints()); } @@ -648,7 +648,7 @@ namespace OpenSim.Region.CoreModules.World.Estate part = Scene.GetSceneObjectPart((uint)param1); if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) { - EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + RegionSettings settings = this.Scene.RegionInfo.RegionSettings; client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, settings.TelehubRot, settings.SpawnPoints()); } @@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.World.Estate // Remove SpawnPoint from Telehub if (m_Telehub.RemoveSpawnPoint((int)param1)) { - EstateSettings settings = this.Scene.RegionInfo.EstateSettings; + RegionSettings settings = this.Scene.RegionInfo.RegionSettings; client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, settings.TelehubRot, settings.SpawnPoints()); } diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index 309ef13..ee77ae1 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs @@ -44,7 +44,6 @@ namespace OpenSim.Region.CoreModules.World.Estate UUID EstateID; bool m_HasTelehub = false; Scene m_Scene; - EstateSettings m_EstateSettings; // This will get an option... Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,0.0f); @@ -56,7 +55,6 @@ namespace OpenSim.Region.CoreModules.World.Estate public TelehubManager(Scene scene) { m_Scene = scene; - m_EstateSettings = m_Scene.RegionInfo.EstateSettings; } // Fill our Telehub struct with values @@ -76,17 +74,17 @@ namespace OpenSim.Region.CoreModules.World.Estate // Connect the Telehub public bool Connect(SceneObjectPart part) { - m_EstateSettings.ClearSpawnPoints(); + m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); - m_EstateSettings.TelehubObject = part.UUID; - m_EstateSettings.TelehubName = part.Name; - m_EstateSettings.TelehubPos = part.AbsolutePosition; - m_EstateSettings.TelehubRot = part.GetWorldRotation(); + m_Scene.RegionInfo.RegionSettings.TelehubObject = part.UUID; + m_Scene.RegionInfo.RegionSettings.TelehubName = part.Name; + m_Scene.RegionInfo.RegionSettings.TelehubPos = part.AbsolutePosition; + m_Scene.RegionInfo.RegionSettings.TelehubRot = part.GetWorldRotation(); // Clear this for now - m_EstateSettings.AddSpawnPoint(InitialSpawnPoint); - m_EstateSettings.HasTelehub = true; - m_EstateSettings.Save(); + m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(InitialSpawnPoint); + m_Scene.RegionInfo.RegionSettings.HasTelehub = true; + m_Scene.RegionInfo.RegionSettings.Save(); return true; } @@ -96,14 +94,14 @@ namespace OpenSim.Region.CoreModules.World.Estate bool result = false; try{ - m_EstateSettings.TelehubObject = UUID.Zero; - m_EstateSettings.TelehubName = String.Empty; - m_EstateSettings.TelehubPos = Vector3.Zero; + m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; + m_Scene.RegionInfo.RegionSettings.TelehubName = String.Empty; + m_Scene.RegionInfo.RegionSettings.TelehubPos = Vector3.Zero; // This is probably wrong! But, HasTelehub will block access - m_EstateSettings.TelehubRot = Quaternion.Identity; - m_EstateSettings.ClearSpawnPoints(); - m_EstateSettings.HasTelehub = false; - m_EstateSettings.Save(); + m_Scene.RegionInfo.RegionSettings.TelehubRot = Quaternion.Identity; + m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); + m_Scene.RegionInfo.RegionSettings.HasTelehub = false; + m_Scene.RegionInfo.RegionSettings.Save(); result = true; } catch (Exception ex) @@ -122,22 +120,22 @@ namespace OpenSim.Region.CoreModules.World.Estate public bool AddSpawnPoint(Vector3 point) { - float dist = (float) Util.GetDistanceTo(m_EstateSettings.TelehubPos, point); - Vector3 nvec = Util.GetNormalizedVector(point - m_EstateSettings.TelehubPos); + float dist = (float) Util.GetDistanceTo(m_Scene.RegionInfo.RegionSettings.TelehubPos, point); + Vector3 nvec = Util.GetNormalizedVector(point - m_Scene.RegionInfo.RegionSettings.TelehubPos); Vector3 spoint = nvec * dist; - m_EstateSettings.AddSpawnPoint(spoint); - m_EstateSettings.Save(); + m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint); + m_Scene.RegionInfo.RegionSettings.Save(); return true; } // Remove a SpawnPoint from the Telehub public bool RemoveSpawnPoint(int spawnpoint) { - m_EstateSettings.RemoveSpawnPoint(spawnpoint); - m_EstateSettings.Save(); + m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); + m_Scene.RegionInfo.RegionSettings.Save(); return true; } } -} \ No newline at end of file +} -- cgit v1.1 From 39c9b656c871bf0eaba104f197a902123d7d9428 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 23 Jan 2012 09:42:15 -0500 Subject: Cleanup unused parts, add some error handling --- .../CoreModules/World/Estate/TelehubManager.cs | 105 ++++++++++----------- 1 file changed, 52 insertions(+), 53 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index ee77ae1..68b4ba5 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs @@ -35,83 +35,66 @@ namespace OpenSim.Region.CoreModules.World.Estate { public class TelehubManager { - - private UUID ObjectID; - private string ObjectName; - private Vector3 ObjectPosition; - Quaternion ObjectRotation; - List SpawnPoint = new List(); - UUID EstateID; - bool m_HasTelehub = false; Scene m_Scene; - // This will get an option... - Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,0.0f); - - public bool HasTelehub - { - get { return m_HasTelehub; } - } public TelehubManager(Scene scene) { m_Scene = scene; } - // Fill our Telehub struct with values -// public Telehub TelehubVals() -// { -// // Telehub telehub = new Telehub(); -// EstateSettings telehub = m_EstateSettings; -// -// telehub.TelehubObject = ObjectID; -// telehub.TelehubName = ObjectName; -// telehub.TelehubPos = ObjectPosition; -// telehub.TelehubRot = ObjectRotation; -// telehub. = SpawnPoint; -// return telehub; -// } - // Connect the Telehub public bool Connect(SceneObjectPart part) { - m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); + bool result = false; - m_Scene.RegionInfo.RegionSettings.TelehubObject = part.UUID; - m_Scene.RegionInfo.RegionSettings.TelehubName = part.Name; - m_Scene.RegionInfo.RegionSettings.TelehubPos = part.AbsolutePosition; - m_Scene.RegionInfo.RegionSettings.TelehubRot = part.GetWorldRotation(); + if (m_Scene.RegionInfo.RegionSettings.HasTelehub) + return result; - // Clear this for now - m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(InitialSpawnPoint); - m_Scene.RegionInfo.RegionSettings.HasTelehub = true; - m_Scene.RegionInfo.RegionSettings.Save(); - return true; + try + { + m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); + + m_Scene.RegionInfo.RegionSettings.TelehubObject = part.UUID; + m_Scene.RegionInfo.RegionSettings.TelehubName = part.Name; + m_Scene.RegionInfo.RegionSettings.TelehubPos = part.AbsolutePosition; + m_Scene.RegionInfo.RegionSettings.TelehubRot = part.GetWorldRotation(); + m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(new Vector3(0.0f,0.0f,0.0f)); + m_Scene.RegionInfo.RegionSettings.HasTelehub = true; + m_Scene.RegionInfo.RegionSettings.Save(); + + result = true; + } + catch (Exception ex) + { + result = false; + } + + return result; } - // Disconnect the Telehub: Clear it out for now, look at just disableing + // Disconnect the Telehub: public bool DisConnect(SceneObjectPart part) { bool result = false; - try{ + if (!m_Scene.RegionInfo.RegionSettings.HasTelehub) + return result; + + try + { m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; m_Scene.RegionInfo.RegionSettings.TelehubName = String.Empty; m_Scene.RegionInfo.RegionSettings.TelehubPos = Vector3.Zero; - // This is probably wrong! But, HasTelehub will block access - m_Scene.RegionInfo.RegionSettings.TelehubRot = Quaternion.Identity; m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); m_Scene.RegionInfo.RegionSettings.HasTelehub = false; m_Scene.RegionInfo.RegionSettings.Save(); + result = true; } catch (Exception ex) { result = false; } - finally - { - - } return result; } @@ -119,19 +102,35 @@ namespace OpenSim.Region.CoreModules.World.Estate // Add a SpawnPoint to the Telehub public bool AddSpawnPoint(Vector3 point) { + bool result = false; - float dist = (float) Util.GetDistanceTo(m_Scene.RegionInfo.RegionSettings.TelehubPos, point); - Vector3 nvec = Util.GetNormalizedVector(point - m_Scene.RegionInfo.RegionSettings.TelehubPos); - Vector3 spoint = nvec * dist; + if (!m_Scene.RegionInfo.RegionSettings.HasTelehub) + return result; - m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint); - m_Scene.RegionInfo.RegionSettings.Save(); - return true; + try + { + float dist = (float) Util.GetDistanceTo(m_Scene.RegionInfo.RegionSettings.TelehubPos, point); + Vector3 nvec = Util.GetNormalizedVector(point - m_Scene.RegionInfo.RegionSettings.TelehubPos); + Vector3 spoint = nvec * dist; + + m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint); + m_Scene.RegionInfo.RegionSettings.Save(); + result = true; + } + catch (Exception ex) + { + result = false; + } + + return result; } // Remove a SpawnPoint from the Telehub public bool RemoveSpawnPoint(int spawnpoint) { + if (!m_Scene.RegionInfo.RegionSettings.HasTelehub) + return false; + m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); m_Scene.RegionInfo.RegionSettings.Save(); -- cgit v1.1 From 9cfc43005d8d906083b176a2961aa3892193dcb4 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 23 Jan 2012 10:28:18 -0500 Subject: Cleanup --- OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index 68b4ba5..9b92df9 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs @@ -109,10 +109,13 @@ namespace OpenSim.Region.CoreModules.World.Estate try { - float dist = (float) Util.GetDistanceTo(m_Scene.RegionInfo.RegionSettings.TelehubPos, point); - Vector3 nvec = Util.GetNormalizedVector(point - m_Scene.RegionInfo.RegionSettings.TelehubPos); + Vector3 thPos = m_Scene.RegionInfo.RegionSettings.TelehubPos; + Quaternion thRot = m_Scene.RegionInfo.RegionSettings.TelehubRot; + + float dist = (float) Util.GetDistanceTo(thPos, point); + Vector3 nvec = Util.GetNormalizedVector(point - thPos); Vector3 spoint = nvec * dist; - + m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint); m_Scene.RegionInfo.RegionSettings.Save(); result = true; -- cgit v1.1 From 6a85abbd14f36f9d1f1035820730f3e8cd395987 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 23 Jan 2012 14:53:25 -0500 Subject: Add update to Telehub position and rotation before adding SpawnPoints --- OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index 9b92df9..2d7d0ee 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs @@ -109,11 +109,18 @@ namespace OpenSim.Region.CoreModules.World.Estate try { - Vector3 thPos = m_Scene.RegionInfo.RegionSettings.TelehubPos; - Quaternion thRot = m_Scene.RegionInfo.RegionSettings.TelehubRot; + // Need to update the position in case the Telehubn has been moved + UUID TelehubID = m_Scene.RegionInfo.RegionSettings.TelehubObject; + SceneObjectPart part = m_Scene.GetSceneObjectPart(TelehubID); - float dist = (float) Util.GetDistanceTo(thPos, point); - Vector3 nvec = Util.GetNormalizedVector(point - thPos); + Vector3 TelehubPos = part.AbsolutePosition; + Quaternion TelehubRot = part.GetWorldRotation(); + + m_Scene.RegionInfo.RegionSettings.TelehubPos = TelehubPos; + m_Scene.RegionInfo.RegionSettings.TelehubRot = TelehubRot; + + float dist = (float) Util.GetDistanceTo(TelehubPos, point); + Vector3 nvec = Util.GetNormalizedVector(point - TelehubPos); Vector3 spoint = nvec * dist; m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint); -- cgit v1.1 From 87799c1f3ddfbc4b0994cac4e54498520899e4d4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 00:32:10 +0000 Subject: Change Telehubs to store only the data that is really needed and not additional redundant information. --- .../World/Estate/EstateManagementModule.cs | 78 +++++++++++++--------- .../CoreModules/World/Estate/TelehubManager.cs | 70 ++++++------------- 2 files changed, 65 insertions(+), 83 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index cdcea65..2789d5f 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -609,59 +609,37 @@ namespace OpenSim.Region.CoreModules.World.Estate { case "info ui": // Send info: - if (Scene.RegionInfo.RegionSettings.HasTelehub) - { - RegionSettings settings = this.Scene.RegionInfo.RegionSettings; - client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, - settings.TelehubRot, settings.SpawnPoints()); - } - else - { - return; - } + SendTelehubInfo(client); break; case "connect": // Add the Telehub part = Scene.GetSceneObjectPart((uint)param1); - if (m_Telehub.Connect(part)) - { - RegionSettings settings = this.Scene.RegionInfo.RegionSettings; - client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, - settings.TelehubRot, settings.SpawnPoints()); - } + if (part == null) + return; + SceneObjectGroup grp = part.ParentGroup; + + if (m_Telehub.Connect(grp)) + SendTelehubInfo(client); break; case "delete": // Disconnect Telehub - part = Scene.GetSceneObjectPart((uint)param1); - if (m_Telehub.DisConnect(part)) - { - RegionSettings settings = this.Scene.RegionInfo.RegionSettings; - client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, - settings.TelehubRot, settings.SpawnPoints()); - } + if (m_Telehub.Disconnect()) + SendTelehubInfo(client); break; case "spawnpoint add": // Add SpawnPoint to the Telehub part = Scene.GetSceneObjectPart((uint)param1); if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) - { - RegionSettings settings = this.Scene.RegionInfo.RegionSettings; - client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, - settings.TelehubRot, settings.SpawnPoints()); - } + SendTelehubInfo(client); break; case "spawnpoint remove": // Remove SpawnPoint from Telehub if (m_Telehub.RemoveSpawnPoint((int)param1)) - { - RegionSettings settings = this.Scene.RegionInfo.RegionSettings; - client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, - settings.TelehubRot, settings.SpawnPoints()); - } + SendTelehubInfo(client); break; default: @@ -1316,5 +1294,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(telehub.AbsolutePosition, telehub.GroupRotation)); + } + + 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 index 2d7d0ee..3eb7efa 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs @@ -43,102 +43,72 @@ namespace OpenSim.Region.CoreModules.World.Estate } // Connect the Telehub - public bool Connect(SceneObjectPart part) + public bool Connect(SceneObjectGroup grp) { - bool result = false; - - if (m_Scene.RegionInfo.RegionSettings.HasTelehub) - return result; - try { m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); - m_Scene.RegionInfo.RegionSettings.TelehubObject = part.UUID; - m_Scene.RegionInfo.RegionSettings.TelehubName = part.Name; - m_Scene.RegionInfo.RegionSettings.TelehubPos = part.AbsolutePosition; - m_Scene.RegionInfo.RegionSettings.TelehubRot = part.GetWorldRotation(); - m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(new Vector3(0.0f,0.0f,0.0f)); - m_Scene.RegionInfo.RegionSettings.HasTelehub = true; + m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID; m_Scene.RegionInfo.RegionSettings.Save(); - - result = true; } catch (Exception ex) { - result = false; + return false; } - return result; + return true; } // Disconnect the Telehub: - public bool DisConnect(SceneObjectPart part) + public bool Disconnect() { - bool result = false; - - if (!m_Scene.RegionInfo.RegionSettings.HasTelehub) - return result; + if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) + return false; try { m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; - m_Scene.RegionInfo.RegionSettings.TelehubName = String.Empty; - m_Scene.RegionInfo.RegionSettings.TelehubPos = Vector3.Zero; m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); - m_Scene.RegionInfo.RegionSettings.HasTelehub = false; m_Scene.RegionInfo.RegionSettings.Save(); - - result = true; } catch (Exception ex) { - result = false; + return false; } - return result; + return true; } // Add a SpawnPoint to the Telehub public bool AddSpawnPoint(Vector3 point) { - bool result = false; + if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) + return false; - if (!m_Scene.RegionInfo.RegionSettings.HasTelehub) - return result; + SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject); + if (grp == null) + return false; try { - // Need to update the position in case the Telehubn has been moved - UUID TelehubID = m_Scene.RegionInfo.RegionSettings.TelehubObject; - SceneObjectPart part = m_Scene.GetSceneObjectPart(TelehubID); - - Vector3 TelehubPos = part.AbsolutePosition; - Quaternion TelehubRot = part.GetWorldRotation(); - - m_Scene.RegionInfo.RegionSettings.TelehubPos = TelehubPos; - m_Scene.RegionInfo.RegionSettings.TelehubRot = TelehubRot; - - float dist = (float) Util.GetDistanceTo(TelehubPos, point); - Vector3 nvec = Util.GetNormalizedVector(point - TelehubPos); - Vector3 spoint = nvec * dist; - - m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(spoint); + SpawnPoint sp = new SpawnPoint(); + sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point); + m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp); m_Scene.RegionInfo.RegionSettings.Save(); - result = true; } catch (Exception ex) { - result = false; + return false; } - return result; + return true; } // Remove a SpawnPoint from the Telehub public bool RemoveSpawnPoint(int spawnpoint) { - if (!m_Scene.RegionInfo.RegionSettings.HasTelehub) + if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) return false; m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); -- cgit v1.1 From c0e1784e86f3539656f4bc71aaddfc1df3d12d20 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 01:17:41 +0000 Subject: Correct a coordinate to make the viewer like it --- OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 2789d5f..1855aea 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -1309,7 +1309,7 @@ namespace OpenSim.Region.CoreModules.World.Estate foreach (SpawnPoint sp in settings.SpawnPoints()) { - spawnPoints.Add(sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation)); + spawnPoints.Add(sp.GetLocation(telehub.GroupRotation)); } client.SendTelehubInfo(settings.TelehubObject, -- cgit v1.1 From 0d2e02efb1da5cba09a8cf306b83e5789529601c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 01:29:50 +0000 Subject: Reverse the spawn point distance vector --- OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1855aea..20f3903 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -1309,7 +1309,7 @@ namespace OpenSim.Region.CoreModules.World.Estate foreach (SpawnPoint sp in settings.SpawnPoints()) { - spawnPoints.Add(sp.GetLocation(telehub.GroupRotation)); + spawnPoints.Add(sp.GetLocation(Vector3.Zero, telehub.GroupRotation)); } client.SendTelehubInfo(settings.TelehubObject, -- cgit v1.1 From a4977bbe190fb6c1eb5c45247b9222c719118fd4 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. --- .../World/Estate/EstateManagementModule.cs | 19 +++--- .../CoreModules/World/Estate/TelehubManager.cs | 69 +++++++--------------- 2 files changed, 30 insertions(+), 58 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 20f3903..2e1487f 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -608,8 +608,6 @@ namespace OpenSim.Region.CoreModules.World.Estate switch (cmd) { case "info ui": - // Send info: - SendTelehubInfo(client); break; case "connect": @@ -619,32 +617,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( @@ -1309,7 +1306,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 From 855d3a3ba5cdbd45997abac0f744488854583443 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 24 Jan 2012 04:06:37 +0000 Subject: Teleport routing, part 1 --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c66f30e..5c56150 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) -- cgit v1.1