Simplify and streamline telehub editing code. Verify rotations and fix

spwan point positioning on rotated telehubs.
iar_mods
Melanie 2012-01-24 01:48:38 +01:00
parent 0d2e02efb1
commit a4977bbe19
3 changed files with 31 additions and 59 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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)
{
try
public void Connect(SceneObjectGroup grp)
{
m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID;
m_Scene.RegionInfo.RegionSettings.Save();
}
catch (Exception ex)
{
return false;
}
return true;
}
// 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;
}
// 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;
}
// 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;
}
}
}