Simplify and streamline telehub editing code. Verify rotations and fix
spwan point positioning on rotated telehubs.avinationmerge
parent
d51ae0ecac
commit
cc02f78d4e
|
@ -47,6 +47,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
// Next we need to rotate this vector into the spawn point's
|
// Next we need to rotate this vector into the spawn point's
|
||||||
// coordinate system
|
// coordinate system
|
||||||
|
rot.W = -rot.W;
|
||||||
offset = offset * rot;
|
offset = offset * rot;
|
||||||
|
|
||||||
Vector3 dir = Vector3.Normalize(offset);
|
Vector3 dir = Vector3.Normalize(offset);
|
||||||
|
@ -66,7 +67,6 @@ namespace OpenSim.Framework
|
||||||
Vector3 dir = new Vector3(1, 0, 0) * p * y;
|
Vector3 dir = new Vector3(1, 0, 0) * p * y;
|
||||||
Vector3 offset = dir * (float)Distance;
|
Vector3 offset = dir * (float)Distance;
|
||||||
|
|
||||||
rot.W = -rot.W;
|
|
||||||
offset *= rot;
|
offset *= rot;
|
||||||
|
|
||||||
return pos + offset;
|
return pos + offset;
|
||||||
|
|
|
@ -623,8 +623,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case "info ui":
|
case "info ui":
|
||||||
// Send info:
|
|
||||||
SendTelehubInfo(client);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "connect":
|
case "connect":
|
||||||
|
@ -634,32 +632,31 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
return;
|
return;
|
||||||
SceneObjectGroup grp = part.ParentGroup;
|
SceneObjectGroup grp = part.ParentGroup;
|
||||||
|
|
||||||
if (m_Telehub.Connect(grp))
|
m_Telehub.Connect(grp);
|
||||||
SendTelehubInfo(client);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "delete":
|
case "delete":
|
||||||
// Disconnect Telehub
|
// Disconnect Telehub
|
||||||
if (m_Telehub.Disconnect())
|
m_Telehub.Disconnect();
|
||||||
SendTelehubInfo(client);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "spawnpoint add":
|
case "spawnpoint add":
|
||||||
// Add SpawnPoint to the Telehub
|
// Add SpawnPoint to the Telehub
|
||||||
part = Scene.GetSceneObjectPart((uint)param1);
|
part = Scene.GetSceneObjectPart((uint)param1);
|
||||||
if( m_Telehub.AddSpawnPoint(part.AbsolutePosition))
|
if (part == null)
|
||||||
SendTelehubInfo(client);
|
return;
|
||||||
|
m_Telehub.AddSpawnPoint(part.AbsolutePosition);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "spawnpoint remove":
|
case "spawnpoint remove":
|
||||||
// Remove SpawnPoint from Telehub
|
// Remove SpawnPoint from Telehub
|
||||||
if (m_Telehub.RemoveSpawnPoint((int)param1))
|
m_Telehub.RemoveSpawnPoint((int)param1);
|
||||||
SendTelehubInfo(client);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
SendTelehubInfo(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendSimulatorBlueBoxMessage(
|
private void SendSimulatorBlueBoxMessage(
|
||||||
|
@ -1358,7 +1355,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
foreach (SpawnPoint sp in settings.SpawnPoints())
|
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,
|
client.SendTelehubInfo(settings.TelehubObject,
|
||||||
|
|
|
@ -26,15 +26,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Estate
|
namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
public class TelehubManager
|
public class TelehubManager
|
||||||
{
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
Scene m_Scene;
|
Scene m_Scene;
|
||||||
|
|
||||||
public TelehubManager(Scene scene)
|
public TelehubManager(Scene scene)
|
||||||
|
@ -43,78 +47,49 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect the Telehub
|
// Connect the Telehub
|
||||||
public bool Connect(SceneObjectGroup grp)
|
public void Connect(SceneObjectGroup grp)
|
||||||
{
|
{
|
||||||
try
|
m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
|
||||||
{
|
|
||||||
m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
|
|
||||||
|
|
||||||
m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID;
|
|
||||||
m_Scene.RegionInfo.RegionSettings.Save();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID;
|
||||||
|
m_Scene.RegionInfo.RegionSettings.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disconnect the Telehub:
|
// Disconnect the Telehub:
|
||||||
public bool Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
|
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.TelehubObject = UUID.Zero;
|
m_Scene.RegionInfo.RegionSettings.Save();
|
||||||
m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
|
|
||||||
m_Scene.RegionInfo.RegionSettings.Save();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a SpawnPoint to the Telehub
|
// Add a SpawnPoint to the Telehub
|
||||||
public bool AddSpawnPoint(Vector3 point)
|
public void AddSpawnPoint(Vector3 point)
|
||||||
{
|
{
|
||||||
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
|
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
|
SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
|
||||||
if (grp == null)
|
if (grp == null)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
try
|
SpawnPoint sp = new SpawnPoint();
|
||||||
{
|
sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point);
|
||||||
SpawnPoint sp = new SpawnPoint();
|
m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp);
|
||||||
sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point);
|
m_Scene.RegionInfo.RegionSettings.Save();
|
||||||
m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp);
|
|
||||||
m_Scene.RegionInfo.RegionSettings.Save();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a SpawnPoint from the Telehub
|
// Remove a SpawnPoint from the Telehub
|
||||||
public bool RemoveSpawnPoint(int spawnpoint)
|
public void RemoveSpawnPoint(int spawnpoint)
|
||||||
{
|
{
|
||||||
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
|
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint);
|
m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint);
|
||||||
m_Scene.RegionInfo.RegionSettings.Save();
|
m_Scene.RegionInfo.RegionSettings.Save();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue