HG: Moved User-level code down to the HGEntityTransferModule where it belongs.

0.7.3-extended
Diva Canto 2012-04-24 22:17:10 -07:00 committed by Justin Clark-Casey (justincc)
parent a5d0a29dd9
commit 2e397d1514
3 changed files with 17 additions and 21 deletions

View File

@ -236,7 +236,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.ControllingClient.SendTeleportFailed("Problem at destination"); sp.ControllingClient.SendTeleportFailed("Problem at destination");
return; return;
} }
destinationRegionName = finalDestination.RegionName;
uint curX = 0, curY = 0; uint curX = 0, curY = 0;
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
int curCellX = (int)(curX / Constants.RegionSize); int curCellX = (int)(curX / Constants.RegionSize);
@ -407,7 +409,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
bool logout = false; bool logout = false;
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
{ {
sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}",
reason)); reason));
return; return;
} }

View File

@ -49,6 +49,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Initialized = false; private bool m_Initialized = false;
private int m_levelHGTeleport = 0;
private GatekeeperServiceConnector m_GatekeeperConnector; private GatekeeperServiceConnector m_GatekeeperConnector;
@ -67,6 +68,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string name = moduleConfig.GetString("EntityTransferModule", ""); string name = moduleConfig.GetString("EntityTransferModule", "");
if (name == Name) if (name == Name)
{ {
IConfig transferConfig = source.Configs["EntityTransfer"];
if (transferConfig != null)
m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
InitialiseCommon(source); InitialiseCommon(source);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
@ -163,6 +168,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
{ {
// this user is going to another grid // this user is going to another grid
// check if HyperGrid teleport is allowed, based on user level
if (sp.UserLevel < m_levelHGTeleport)
{
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent.");
reason = "HyperGrid teleport not permitted";
return false;
}
if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) if (agentCircuit.ServiceURLs.ContainsKey("HomeURI"))
{ {
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();

View File

@ -123,25 +123,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
} }
/// <summary>
/// Test that linking results in the correct physical status for all linkees.
/// </summary>
// [Test]
public void TestLinkPhysicsChildPhysicalOnly()
{
TestHelpers.InMethod();
m_scene.AddSceneObject(m_so1);
m_scene.AddSceneObject(m_so2);
m_so2.ScriptSetPhysicsStatus(true);
m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
}
/// <summary> /// <summary>
/// Test that linking results in the correct physical status for all linkees. /// Test that linking results in the correct physical status for all linkees.
/// </summary> /// </summary>