Merge branch 'master' of /home/opensim/var/repo/opensim

integration
BlueWall 2012-05-17 08:00:16 -04:00
commit 5d860d09a3
3 changed files with 97 additions and 31 deletions

View File

@ -3939,35 +3939,6 @@ namespace OpenSim.Region.Framework.Scenes
switch (m_scene.SpawnPointRouting) switch (m_scene.SpawnPointRouting)
{ {
case "closest":
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);
return;
case "random": case "random":
do do
@ -4019,7 +3990,35 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
default: default:
case "closest":
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; return;
pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
return;
} }
} }
} }

View File

@ -234,6 +234,73 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// position instead). // position instead).
// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
// TestHelpers.DisableLogging();
}
/// <summary>
/// Test teleport procedures when the target simulator create agent step is refused.
/// </summary>
[Test]
public void TestSameSimulatorSeparatedRegionsCreateAgentFails()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
UUID userId = TestHelpers.ParseTail(0x1);
Vector3 preTeleportPosition = new Vector3(30, 31, 32);
EntityTransferModule etm = new EntityTransferModule();
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
config.Configs["Modules"].Set("SimulationServices", lscm.Name);
config.AddConfig("EntityTransfer");
// In order to run a single threaded regression test we do not want the entity transfer module waiting
// for a callback from the destination scene before removing its avatar data.
config.Configs["EntityTransfer"].Set("wait_for_callback", false);
SceneHelpers sh = new SceneHelpers();
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
// Shared scene modules
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
Vector3 teleportPosition = new Vector3(10, 11, 12);
Vector3 teleportLookAt = new Vector3(20, 21, 22);
ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
sp.AbsolutePosition = preTeleportPosition;
// Make sceneB refuse CreateAgent
sceneB.LoginsDisabled = true;
sceneA.RequestTeleportLocation(
sp.ControllingClient,
sceneB.RegionInfo.RegionHandle,
teleportPosition,
teleportLookAt,
(uint)TeleportFlags.ViaLocation);
// ((TestClient)sp.ControllingClient).CompleteTeleportClientSide();
Assert.That(sceneB.GetScenePresence(userId), Is.Null);
ScenePresence sceneASp = sceneA.GetScenePresence(userId);
Assert.That(sceneASp, Is.Not.Null);
Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName));
Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition));
// TODO: Add assertions to check correct circuit details in both scenes.
// Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
// position instead).
// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
// TestHelpers.DisableLogging(); // TestHelpers.DisableLogging();
} }

View File

@ -241,12 +241,12 @@
;; server to send mail through. ;; server to send mail through.
; emailmodule = DefaultEmailModule ; emailmodule = DefaultEmailModule
;# {SpawnPointRouting} {} {Set routing method for Telehub Spawnpoints} {closest random sequential} closest ;# {SpawnPointRouting} {} {Set routing method for Telehub Spawnpoints} {closest random sequence} closest
;; SpawnPointRouting adjusts the landing for incoming avatars. ;; SpawnPointRouting adjusts the landing for incoming avatars.
;; "closest" will place the avatar at the SpawnPoint located in the closest ;; "closest" will place the avatar at the SpawnPoint located in the closest
;; available spot to the destination (typically map click/landmark). ;; available spot to the destination (typically map click/landmark).
;; "random" will place the avatar on a randomly selected spawnpoint; ;; "random" will place the avatar on a randomly selected spawnpoint;
;; "sequential" will place the avatar on the next sequential SpawnPoint ;; "sequence" will place the avatar on the next sequential SpawnPoint
; SpawnPointRouting = closest ; SpawnPointRouting = closest
[Estates] [Estates]