aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2013-03-18 23:31:27 +0000
committerMelanie2013-03-18 23:31:27 +0000
commit5e1f651e21ba81d8be9693d7e8a47d49daa9fce5 (patch)
tree4856d3aa25fcd942a26af39e1510f58fef3c934d /OpenSim/Region/Framework
parentMerge commit 'ccd6f443e1092cb410f565e921f7cf4dd8cd2dac' into newmultiattach (diff)
parentImprove rejection of any attempt to reattach an object that is already attached. (diff)
downloadopensim-SC_OLD-5e1f651e21ba81d8be9693d7e8a47d49daa9fce5.zip
opensim-SC_OLD-5e1f651e21ba81d8be9693d7e8a47d49daa9fce5.tar.gz
opensim-SC_OLD-5e1f651e21ba81d8be9693d7e8a47d49daa9fce5.tar.bz2
opensim-SC_OLD-5e1f651e21ba81d8be9693d7e8a47d49daa9fce5.tar.xz
Merge branch 'master' into newmultiattach
Conflicts: OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs77
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs103
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs157
6 files changed, 264 insertions, 129 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
index 345f01b..b67312e 100644
--- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
@@ -41,6 +41,16 @@ namespace OpenSim.Region.Framework.Interfaces
41 Value = 3 41 Value = 3
42 } 42 }
43 43
44 public enum JsonStoreValueType
45 {
46 Undefined = 0,
47 Boolean = 1,
48 Integer = 2,
49 Float = 3,
50 String = 4,
51 UUID = 5
52 }
53
44 public delegate void TakeValueCallback(string s); 54 public delegate void TakeValueCallback(string s);
45 55
46 public interface IJsonStoreModule 56 public interface IJsonStoreModule
@@ -49,7 +59,9 @@ namespace OpenSim.Region.Framework.Interfaces
49 bool CreateStore(string value, ref UUID result); 59 bool CreateStore(string value, ref UUID result);
50 bool DestroyStore(UUID storeID); 60 bool DestroyStore(UUID storeID);
51 61
52 JsonStoreNodeType GetPathType(UUID storeID, string path); 62 JsonStoreNodeType GetNodeType(UUID storeID, string path);
63 JsonStoreValueType GetValueType(UUID storeID, string path);
64
53 bool TestStore(UUID storeID); 65 bool TestStore(UUID storeID);
54 66
55 bool SetValue(UUID storeID, string path, string value, bool useJson); 67 bool SetValue(UUID storeID, string path, string value, bool useJson);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index cce8b21..a8b63fe 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -129,6 +129,27 @@ namespace OpenSim.Region.Framework.Scenes
129 /// Dynamic attributes can be created and deleted as required. 129 /// Dynamic attributes can be created and deleted as required.
130 /// </summary> 130 /// </summary>
131 public DAMap DynAttrs { get; set; } 131 public DAMap DynAttrs { get; set; }
132
133 private DOMap m_dynObjs;
134
135 /// <summary>
136 /// Dynamic objects that can be created and deleted as required.
137 /// </summary>
138 public DOMap DynObjs
139 {
140 get
141 {
142 if (m_dynObjs == null)
143 m_dynObjs = new DOMap();
144
145 return m_dynObjs;
146 }
147
148 set
149 {
150 m_dynObjs = value;
151 }
152 }
132 153
133 /// <value> 154 /// <value>
134 /// Is this a root part? 155 /// Is this a root part?
@@ -4503,8 +4524,25 @@ namespace OpenSim.Region.Framework.Scenes
4503 4524
4504 Changed changeFlags = 0; 4525 Changed changeFlags = 0;
4505 4526
4527 Primitive.TextureEntryFace fallbackNewFace = newTex.DefaultTexture;
4528 Primitive.TextureEntryFace fallbackOldFace = oldTex.DefaultTexture;
4529
4530 // On Incoming packets, sometimes newText.DefaultTexture is null. The assumption is that all
4531 // other prim-sides are set, but apparently that's not always the case. Lets assume packet/data corruption at this point.
4532 if (fallbackNewFace == null)
4533 {
4534 fallbackNewFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
4535 newTex.DefaultTexture = fallbackNewFace;
4536 }
4537 if (fallbackOldFace == null)
4538 {
4539 fallbackOldFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
4540 oldTex.DefaultTexture = fallbackOldFace;
4541 }
4542
4506 for (int i = 0 ; i < GetNumberOfSides(); i++) 4543 for (int i = 0 ; i < GetNumberOfSides(); i++)
4507 { 4544 {
4545
4508 Primitive.TextureEntryFace newFace = newTex.DefaultTexture; 4546 Primitive.TextureEntryFace newFace = newTex.DefaultTexture;
4509 Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture; 4547 Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture;
4510 4548
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 39a885c..82bb759 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -559,16 +559,28 @@ namespace OpenSim.Region.Framework.Scenes
559 559
560 private Quaternion m_bodyRot = Quaternion.Identity; 560 private Quaternion m_bodyRot = Quaternion.Identity;
561 561
562 /// <summary>
563 /// The rotation of the avatar.
564 /// </summary>
565 /// <remarks>
566 /// If the avatar is not sitting, this is with respect to the world
567 /// If the avatar is sitting, this is a with respect to the part that it's sitting upon (a local rotation).
568 /// If you always want the world rotation, use GetWorldRotation()
569 /// </remarks>
562 public Quaternion Rotation 570 public Quaternion Rotation
563 { 571 {
564 get { return m_bodyRot; } 572 get
573 {
574 return m_bodyRot;
575 }
576
565 set 577 set
566 { 578 {
567 m_bodyRot = value; 579 m_bodyRot = value;
580
568 if (PhysicsActor != null) 581 if (PhysicsActor != null)
569 {
570 PhysicsActor.Orientation = m_bodyRot; 582 PhysicsActor.Orientation = m_bodyRot;
571 } 583
572// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot); 584// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot);
573 } 585 }
574 } 586 }
@@ -608,6 +620,26 @@ namespace OpenSim.Region.Framework.Scenes
608 set { m_health = value; } 620 set { m_health = value; }
609 } 621 }
610 622
623 /// <summary>
624 /// Gets the world rotation of this presence.
625 /// </summary>
626 /// <remarks>
627 /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not.
628 /// </remarks>
629 /// <returns></returns>
630 public Quaternion GetWorldRotation()
631 {
632 if (IsSatOnObject)
633 {
634 SceneObjectPart sitPart = ParentPart;
635
636 if (sitPart != null)
637 return sitPart.GetWorldRotation() * Rotation;
638 }
639
640 return Rotation;
641 }
642
611 public void AdjustKnownSeeds() 643 public void AdjustKnownSeeds()
612 { 644 {
613 Dictionary<ulong, string> seeds; 645 Dictionary<ulong, string> seeds;
@@ -709,8 +741,6 @@ namespace OpenSim.Region.Framework.Scenes
709 741
710 #endregion 742 #endregion
711 743
712
713
714 #region Constructor(s) 744 #region Constructor(s)
715 745
716 public ScenePresence( 746 public ScenePresence(
@@ -1613,32 +1643,28 @@ namespace OpenSim.Region.Framework.Scenes
1613 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || 1643 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
1614 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 1644 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
1615 1645
1616
1617 //m_log.Debug("[CONTROL]: " +flags); 1646 //m_log.Debug("[CONTROL]: " +flags);
1618 // Applies a satisfying roll effect to the avatar when flying. 1647 // Applies a satisfying roll effect to the avatar when flying.
1619 if (((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0) && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)) 1648 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0 && (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
1620 { 1649 {
1621 1650 ApplyFlyingRoll(
1622 ApplyFlyingRoll(FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0)); 1651 FLY_ROLL_RADIANS_PER_UPDATE,
1623 1652 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
1624 1653 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
1625 } 1654 }
1626 else if (((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0) && 1655 else if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0 &&
1627 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)) 1656 (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
1628 { 1657 {
1629 ApplyFlyingRoll(-FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0)); 1658 ApplyFlyingRoll(
1630 1659 -FLY_ROLL_RADIANS_PER_UPDATE,
1631 1660 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
1661 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
1632 } 1662 }
1633 else 1663 else
1634 { 1664 {
1635 if (m_AngularVelocity.Z != 0) 1665 if (m_AngularVelocity.Z != 0)
1636 m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE); 1666 m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE);
1637 1667 }
1638 }
1639
1640
1641
1642 1668
1643 if (Flying && IsColliding && controlland) 1669 if (Flying && IsColliding && controlland)
1644 { 1670 {
@@ -2400,7 +2426,8 @@ namespace OpenSim.Region.Framework.Scenes
2400 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> 2426 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
2401 public void AddNewMovement(Vector3 vec) 2427 public void AddNewMovement(Vector3 vec)
2402 { 2428 {
2403// m_log.DebugFormat("[SCENE PRESENCE]: Adding new movement {0} for {1}", vec, Name); 2429// m_log.DebugFormat(
2430// "[SCENE PRESENCE]: Adding new movement {0} with rotation {1} for {2}", vec, Rotation, Name);
2404 2431
2405 Vector3 direc = vec * Rotation; 2432 Vector3 direc = vec * Rotation;
2406 direc.Normalize(); 2433 direc.Normalize();
@@ -2420,6 +2447,8 @@ namespace OpenSim.Region.Framework.Scenes
2420 2447
2421 direc *= 0.03f * 128f * SpeedModifier; 2448 direc *= 0.03f * 128f * SpeedModifier;
2422 2449
2450// m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name);
2451
2423 if (PhysicsActor != null) 2452 if (PhysicsActor != null)
2424 { 2453 {
2425 if (Flying) 2454 if (Flying)
@@ -2453,6 +2482,8 @@ namespace OpenSim.Region.Framework.Scenes
2453 } 2482 }
2454 } 2483 }
2455 2484
2485// m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name);
2486
2456 // TODO: Add the force instead of only setting it to support multiple forces per frame? 2487 // TODO: Add the force instead of only setting it to support multiple forces per frame?
2457 m_forceToApply = direc; 2488 m_forceToApply = direc;
2458 } 2489 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
index 96973de..4883ae7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
@@ -110,8 +110,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
110 110
111 Vector3 firstSize = new Vector3(2, 3, 4); 111 Vector3 firstSize = new Vector3(2, 3, 4);
112 Vector3 secondSize = new Vector3(5, 6, 7); 112 Vector3 secondSize = new Vector3(5, 6, 7);
113 Vector3 thirdSize = new Vector3(8, 9, 10); 113// Vector3 thirdSize = new Vector3(8, 9, 10);
114 Vector3 fourthSize = new Vector3(11, 12, 13); 114// Vector3 fourthSize = new Vector3(11, 12, 13);
115 115
116 Scene scene = new SceneHelpers().SetupScene(); 116 Scene scene = new SceneHelpers().SetupScene();
117 scene.MaxUndoCount = 20; 117 scene.MaxUndoCount = 20;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 5faf131..bbfbbfc 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -289,108 +289,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
289// 289//
290// Assert.That(presence, Is.Null, "presence is not null"); 290// Assert.That(presence, Is.Null, "presence is not null");
291// } 291// }
292
293 // I'm commenting this test because it does not represent
294 // crossings. The Thread.Sleep's in here are not meaningful mocks,
295 // and they sometimes fail in panda.
296 // We need to talk in order to develop a test
297 // that really tests region crossings. There are 3 async components,
298 // but things are synchronous among them. So there should be
299 // 3 threads in here.
300 //[Test]
301// public void T021_TestCrossToNewRegion()
302// {
303// TestHelpers.InMethod();
304//
305// scene.RegisterRegionWithGrid();
306// scene2.RegisterRegionWithGrid();
307//
308// // Adding child agent to region 1001
309// string reason;
310// scene2.NewUserConnection(acd1,0, out reason);
311// scene2.AddNewClient(testclient, PresenceType.User);
312//
313// ScenePresence presence = scene.GetScenePresence(agent1);
314// presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
315//
316// ScenePresence presence2 = scene2.GetScenePresence(agent1);
317//
318// // Adding neighbour region caps info to presence2
319//
320// string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
321// presence2.AddNeighbourRegion(region1, cap);
322//
323// Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
324// Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
325//
326// // Cross to x+1
327// presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
328// presence.Update();
329//
330// EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
331//
332// // Mimicking communication between client and server, by waiting OK from client
333// // sent by TestClient.CrossRegion call. Originally, this is network comm.
334// if (!wh.WaitOne(5000,false))
335// {
336// presence.Update();
337// if (!wh.WaitOne(8000,false))
338// throw new ArgumentException("1 - Timeout waiting for signal/variable.");
339// }
340//
341// // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
342// // would normally be fired after receiving the reply packet from comm. done on the last line.
343// testclient.CompleteMovement();
344//
345// // Crossings are asynchronous
346// int timer = 10;
347//
348// // Make sure cross hasn't already finished
349// if (!presence.IsInTransit && !presence.IsChildAgent)
350// {
351// // If not and not in transit yet, give it some more time
352// Thread.Sleep(5000);
353// }
354//
355// // Enough time, should at least be in transit by now.
356// while (presence.IsInTransit && timer > 0)
357// {
358// Thread.Sleep(1000);
359// timer-=1;
360// }
361//
362// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
363// Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
364// Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
365//
366// // Cross Back
367// presence2.AbsolutePosition = new Vector3(-10, 3, 100);
368// presence2.Update();
369//
370// if (!wh.WaitOne(5000,false))
371// {
372// presence2.Update();
373// if (!wh.WaitOne(8000,false))
374// throw new ArgumentException("2 - Timeout waiting for signal/variable.");
375// }
376// testclient.CompleteMovement();
377//
378// if (!presence2.IsInTransit && !presence2.IsChildAgent)
379// {
380// // If not and not in transit yet, give it some more time
381// Thread.Sleep(5000);
382// }
383//
384// // Enough time, should at least be in transit by now.
385// while (presence2.IsInTransit && timer > 0)
386// {
387// Thread.Sleep(1000);
388// timer-=1;
389// }
390//
391// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
392// Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
393// Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
394// }
395 } 292 }
396} \ No newline at end of file 293} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
new file mode 100644
index 0000000..81a2fcc
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -0,0 +1,157 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.CoreModules.Framework;
39using OpenSim.Region.CoreModules.Framework.EntityTransfer;
40using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43
44namespace OpenSim.Region.Framework.Scenes.Tests
45{
46 [TestFixture]
47 public class ScenePresenceCrossingTests : OpenSimTestCase
48 {
49 [TestFixtureSetUp]
50 public void FixtureInit()
51 {
52 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
53 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
54 }
55
56 [TestFixtureTearDown]
57 public void TearDown()
58 {
59 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
60 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
61 // tests really shouldn't).
62 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
63 }
64
65 [Test]
66 public void TestCrossOnSameSimulator()
67 {
68 TestHelpers.InMethod();
69// TestHelpers.EnableLogging();
70
71 UUID userId = TestHelpers.ParseTail(0x1);
72
73// TestEventQueueGetModule eqmA = new TestEventQueueGetModule();
74 EntityTransferModule etmA = new EntityTransferModule();
75 EntityTransferModule etmB = new EntityTransferModule();
76 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
77
78 IConfigSource config = new IniConfigSource();
79 IConfig modulesConfig = config.AddConfig("Modules");
80 modulesConfig.Set("EntityTransferModule", etmA.Name);
81 modulesConfig.Set("SimulationServices", lscm.Name);
82// IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
83
84 // In order to run a single threaded regression test we do not want the entity transfer module waiting
85 // for a callback from the destination scene before removing its avatar data.
86// entityTransferConfig.Set("wait_for_callback", false);
87
88 SceneHelpers sh = new SceneHelpers();
89 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
90 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);
91
92 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
93 SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
94// SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, eqmA);
95 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
96
97 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
98 originalSp.AbsolutePosition = new Vector3(128, 32, 10);
99
100// originalSp.Flying = true;
101
102// Console.WriteLine("First pos {0}", originalSp.AbsolutePosition);
103
104// eqmA.ClearEvents();
105
106 AgentUpdateArgs moveArgs = new AgentUpdateArgs();
107 //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero);
108 moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2)));
109 moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
110
111 originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs);
112
113 sceneA.Update(1);
114
115// Console.WriteLine("Second pos {0}", originalSp.AbsolutePosition);
116
117 // FIXME: This is a sufficient number of updates to for the presence to reach the northern border.
118 // But really we want to do this in a more robust way.
119 for (int i = 0; i < 100; i++)
120 {
121 sceneA.Update(1);
122// Console.WriteLine("Pos {0}", originalSp.AbsolutePosition);
123 }
124
125 // Need to sort processing of EnableSimulator message on adding scene presences before we can test eqm
126 // messages
127// Dictionary<UUID, List<TestEventQueueGetModule.Event>> eqmEvents = eqmA.Events;
128//
129// Assert.That(eqmEvents.Count, Is.EqualTo(1));
130// Assert.That(eqmEvents.ContainsKey(originalSp.UUID), Is.True);
131//
132// List<TestEventQueueGetModule.Event> spEqmEvents = eqmEvents[originalSp.UUID];
133//
134// Assert.That(spEqmEvents.Count, Is.EqualTo(1));
135// Assert.That(spEqmEvents[0].Name, Is.EqualTo("CrossRegion"));
136
137 // sceneA should now only have a child agent
138 ScenePresence spAfterCrossSceneA = sceneA.GetScenePresence(originalSp.UUID);
139 Assert.That(spAfterCrossSceneA.IsChildAgent, Is.True);
140
141 ScenePresence spAfterCrossSceneB = sceneB.GetScenePresence(originalSp.UUID);
142
143 // Agent remains a child until the client triggers complete movement
144 Assert.That(spAfterCrossSceneB.IsChildAgent, Is.True);
145
146 TestClient sceneBTc = ((TestClient)spAfterCrossSceneB.ControllingClient);
147
148 int agentMovementCompleteReceived = 0;
149 sceneBTc.OnReceivedMoveAgentIntoRegion += (ri, pos, look) => agentMovementCompleteReceived++;
150
151 sceneBTc.CompleteMovement();
152
153 Assert.That(agentMovementCompleteReceived, Is.EqualTo(1));
154 Assert.That(spAfterCrossSceneB.IsChildAgent, Is.False);
155 }
156 }
157} \ No newline at end of file