diff options
9 files changed, 377 insertions, 126 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 07c3666..01b1668 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1206,6 +1206,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1206 | // region doesn't take it | 1206 | // region doesn't take it |
1207 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | 1207 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1208 | 1208 | ||
1209 | m_log.WarnFormat( | ||
1210 | "[ENTITY TRANSFER MODULE]: Region {0} would not accept update for agent {1} on cross attempt. Returning to original region.", | ||
1211 | neighbourRegion.RegionName, agent.Name); | ||
1212 | |||
1209 | ReInstantiateScripts(agent); | 1213 | ReInstantiateScripts(agent); |
1210 | agent.AddToPhysicalScene(isFlying); | 1214 | agent.AddToPhysicalScene(isFlying); |
1211 | 1215 | ||
@@ -1225,6 +1229,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1225 | neighbourRegion.RegionHandle); | 1229 | neighbourRegion.RegionHandle); |
1226 | return agent; | 1230 | return agent; |
1227 | } | 1231 | } |
1232 | |||
1228 | // No turning back | 1233 | // No turning back |
1229 | agent.IsChildAgent = true; | 1234 | agent.IsChildAgent = true; |
1230 | 1235 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 3c18074..a413546 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -219,12 +219,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
219 | { | 219 | { |
220 | // m_log.DebugFormat( | 220 | // m_log.DebugFormat( |
221 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | 221 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
222 | // s.RegionInfo.RegionName, destination.RegionHandle); | 222 | // destination.RegionName, destination.RegionID); |
223 | 223 | ||
224 | return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData); | 224 | return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData); |
225 | } | 225 | } |
226 | 226 | ||
227 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); | 227 | // m_log.DebugFormat( |
228 | // "[LOCAL COMMS]: Did not find region {0} {1} for ChildAgentUpdate", | ||
229 | // destination.RegionName, destination.RegionID); | ||
230 | |||
228 | return false; | 231 | return false; |
229 | } | 232 | } |
230 | 233 | ||
@@ -239,7 +242,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
239 | // note that we really don't need the GridRegion for this call | 242 | // note that we really don't need the GridRegion for this call |
240 | foreach (Scene s in m_scenes.Values) | 243 | foreach (Scene s in m_scenes.Values) |
241 | { | 244 | { |
242 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | 245 | // m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); |
243 | s.IncomingChildAgentDataUpdate(cAgentData); | 246 | s.IncomingChildAgentDataUpdate(cAgentData); |
244 | } | 247 | } |
245 | 248 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 39a885c..a7c7539 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1613,32 +1613,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1613 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || | 1613 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || |
1614 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 1614 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
1615 | 1615 | ||
1616 | |||
1617 | //m_log.Debug("[CONTROL]: " +flags); | 1616 | //m_log.Debug("[CONTROL]: " +flags); |
1618 | // Applies a satisfying roll effect to the avatar when flying. | 1617 | // 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)) | 1618 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0 && (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0) |
1620 | { | 1619 | { |
1621 | 1620 | ApplyFlyingRoll( | |
1622 | ApplyFlyingRoll(FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0)); | 1621 | FLY_ROLL_RADIANS_PER_UPDATE, |
1623 | 1622 | (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0, | |
1624 | 1623 | (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0); | |
1625 | } | 1624 | } |
1626 | else if (((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0) && | 1625 | else if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0 && |
1627 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)) | 1626 | (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) |
1628 | { | 1627 | { |
1629 | ApplyFlyingRoll(-FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0)); | 1628 | ApplyFlyingRoll( |
1630 | 1629 | -FLY_ROLL_RADIANS_PER_UPDATE, | |
1631 | 1630 | (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0, | |
1631 | (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0); | ||
1632 | } | 1632 | } |
1633 | else | 1633 | else |
1634 | { | 1634 | { |
1635 | if (m_AngularVelocity.Z != 0) | 1635 | if (m_AngularVelocity.Z != 0) |
1636 | m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE); | 1636 | m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE); |
1637 | 1637 | } | |
1638 | } | ||
1639 | |||
1640 | |||
1641 | |||
1642 | 1638 | ||
1643 | if (Flying && IsColliding && controlland) | 1639 | if (Flying && IsColliding && controlland) |
1644 | { | 1640 | { |
@@ -2400,7 +2396,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2400 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> | 2396 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> |
2401 | public void AddNewMovement(Vector3 vec) | 2397 | public void AddNewMovement(Vector3 vec) |
2402 | { | 2398 | { |
2403 | // m_log.DebugFormat("[SCENE PRESENCE]: Adding new movement {0} for {1}", vec, Name); | 2399 | // m_log.DebugFormat( |
2400 | // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1} for {2}", vec, Rotation, Name); | ||
2404 | 2401 | ||
2405 | Vector3 direc = vec * Rotation; | 2402 | Vector3 direc = vec * Rotation; |
2406 | direc.Normalize(); | 2403 | direc.Normalize(); |
@@ -2420,6 +2417,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2420 | 2417 | ||
2421 | direc *= 0.03f * 128f * SpeedModifier; | 2418 | direc *= 0.03f * 128f * SpeedModifier; |
2422 | 2419 | ||
2420 | // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); | ||
2421 | |||
2423 | if (PhysicsActor != null) | 2422 | if (PhysicsActor != null) |
2424 | { | 2423 | { |
2425 | if (Flying) | 2424 | if (Flying) |
@@ -2453,6 +2452,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2453 | } | 2452 | } |
2454 | } | 2453 | } |
2455 | 2454 | ||
2455 | // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name); | ||
2456 | |||
2456 | // TODO: Add the force instead of only setting it to support multiple forces per frame? | 2457 | // TODO: Add the force instead of only setting it to support multiple forces per frame? |
2457 | m_forceToApply = direc; | 2458 | m_forceToApply = direc; |
2458 | } | 2459 | } |
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using Nini.Config; | ||
32 | using NUnit.Framework; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Communications; | ||
36 | using OpenSim.Framework.Servers; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.CoreModules.Framework; | ||
39 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
40 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
41 | using OpenSim.Tests.Common; | ||
42 | using OpenSim.Tests.Common.Mock; | ||
43 | |||
44 | namespace 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 | ||
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index c4b9117..0816b7b 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | |||
@@ -102,6 +102,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
102 | 102 | ||
103 | public override float Simulate(float timeStep) | 103 | public override float Simulate(float timeStep) |
104 | { | 104 | { |
105 | // Console.WriteLine("Simulating"); | ||
106 | |||
105 | float fps = 0; | 107 | float fps = 0; |
106 | for (int i = 0; i < _actors.Count; ++i) | 108 | for (int i = 0; i < _actors.Count; ++i) |
107 | { | 109 | { |
@@ -109,8 +111,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
109 | Vector3 actorPosition = actor.Position; | 111 | Vector3 actorPosition = actor.Position; |
110 | Vector3 actorVelocity = actor.Velocity; | 112 | Vector3 actorVelocity = actor.Velocity; |
111 | 113 | ||
112 | actorPosition.X += actor.Velocity.X*timeStep; | 114 | // Console.WriteLine( |
113 | actorPosition.Y += actor.Velocity.Y*timeStep; | 115 | // "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity); |
116 | |||
117 | actorPosition.X += actor.Velocity.X * timeStep; | ||
118 | actorPosition.Y += actor.Velocity.Y * timeStep; | ||
114 | 119 | ||
115 | if (actor.Position.Y < 0) | 120 | if (actor.Position.Y < 0) |
116 | { | 121 | { |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 182f4d9..a448cc5 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -60,6 +60,8 @@ namespace OpenSim.Tests.Common.Mock | |||
60 | public List<ImagePacketPacket> SentImagePacketPackets { get; private set; } | 60 | public List<ImagePacketPacket> SentImagePacketPackets { get; private set; } |
61 | public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; } | 61 | public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; } |
62 | 62 | ||
63 | public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; | ||
64 | |||
63 | // disable warning: public events, part of the public API | 65 | // disable warning: public events, part of the public API |
64 | #pragma warning disable 67 | 66 | #pragma warning disable 67 |
65 | 67 | ||
@@ -566,6 +568,8 @@ namespace OpenSim.Tests.Common.Mock | |||
566 | 568 | ||
567 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) | 569 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) |
568 | { | 570 | { |
571 | if (OnReceivedMoveAgentIntoRegion != null) | ||
572 | OnReceivedMoveAgentIntoRegion(regInfo, pos, look); | ||
569 | } | 573 | } |
570 | 574 | ||
571 | public virtual AgentCircuitData RequestClientInfo() | 575 | public virtual AgentCircuitData RequestClientInfo() |
diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs new file mode 100644 index 0000000..6707019 --- /dev/null +++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs | |||
@@ -0,0 +1,178 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Threading; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using Mono.Addins; | ||
37 | using OpenMetaverse; | ||
38 | using OpenMetaverse.StructuredData; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Servers; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | |||
44 | namespace OpenSim.Tests.Common | ||
45 | { | ||
46 | public class TestEventQueueGetModule : IEventQueue, INonSharedRegionModule | ||
47 | { | ||
48 | public class Event | ||
49 | { | ||
50 | public string Name { get; set; } | ||
51 | public object[] Args { get; set; } | ||
52 | |||
53 | public Event(string name, object[] args) | ||
54 | { | ||
55 | name = Name; | ||
56 | args = Args; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | public Dictionary<UUID, List<Event>> Events { get; set; } | ||
61 | |||
62 | public void Initialise(IConfigSource source) {} | ||
63 | |||
64 | public void Close() {} | ||
65 | |||
66 | public void AddRegion(Scene scene) | ||
67 | { | ||
68 | Events = new Dictionary<UUID, List<Event>>(); | ||
69 | scene.RegisterModuleInterface<IEventQueue>(this); | ||
70 | } | ||
71 | |||
72 | public void RemoveRegion (Scene scene) {} | ||
73 | |||
74 | public void RegionLoaded (Scene scene) {} | ||
75 | |||
76 | public string Name { get { return "TestEventQueueGetModule"; } } | ||
77 | |||
78 | public Type ReplaceableInterface { get { return null; } } | ||
79 | |||
80 | private void AddEvent(UUID avatarID, string name, params object[] args) | ||
81 | { | ||
82 | Console.WriteLine("Adding event {0} for {1}", name, avatarID); | ||
83 | |||
84 | List<Event> avEvents; | ||
85 | |||
86 | if (!Events.ContainsKey(avatarID)) | ||
87 | { | ||
88 | avEvents = new List<Event>(); | ||
89 | Events[avatarID] = avEvents; | ||
90 | } | ||
91 | else | ||
92 | { | ||
93 | avEvents = Events[avatarID]; | ||
94 | } | ||
95 | |||
96 | avEvents.Add(new Event(name, args)); | ||
97 | } | ||
98 | |||
99 | public void ClearEvents() | ||
100 | { | ||
101 | if (Events != null) | ||
102 | Events.Clear(); | ||
103 | } | ||
104 | |||
105 | public bool Enqueue(OSD o, UUID avatarID) | ||
106 | { | ||
107 | AddEvent(avatarID, "Enqueue", o); | ||
108 | return true; | ||
109 | } | ||
110 | |||
111 | public void DisableSimulator(ulong handle, UUID avatarID) | ||
112 | { | ||
113 | AddEvent(avatarID, "DisableSimulator", handle); | ||
114 | } | ||
115 | |||
116 | public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID) | ||
117 | { | ||
118 | AddEvent(avatarID, "EnableSimulator", handle); | ||
119 | } | ||
120 | |||
121 | public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath) | ||
122 | { | ||
123 | AddEvent(avatarID, "EstablishAgentCommunication", endPoint, capsPath); | ||
124 | } | ||
125 | |||
126 | public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, UUID agentID) | ||
127 | { | ||
128 | AddEvent(agentID, "TeleportFinishEvent", regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL); | ||
129 | } | ||
130 | |||
131 | public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL, UUID avatarID, UUID sessionID) | ||
132 | { | ||
133 | AddEvent(avatarID, "CrossRegion", handle, pos, lookAt, newRegionExternalEndPoint, capsURL, sessionID); | ||
134 | } | ||
135 | |||
136 | public void ChatterboxInvitation( | ||
137 | UUID sessionID, string sessionName, UUID fromAgent, string message, UUID toAgent, string fromName, | ||
138 | byte dialog, uint timeStamp, bool offline, int parentEstateID, Vector3 position, uint ttl, | ||
139 | UUID transactionID, bool fromGroup, byte[] binaryBucket) | ||
140 | { | ||
141 | AddEvent( | ||
142 | toAgent, "ChatterboxInvitation", sessionID, sessionName, fromAgent, message, toAgent, fromName, dialog, | ||
143 | timeStamp, offline, parentEstateID, position, ttl, transactionID, fromGroup, binaryBucket); | ||
144 | } | ||
145 | |||
146 | public void ChatterBoxSessionAgentListUpdates (UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, bool isModerator, bool textMute) | ||
147 | { | ||
148 | AddEvent(toAgent, "ChatterBoxSessionAgentListUpdates", sessionID, fromAgent, canVoiceChat, isModerator, textMute); | ||
149 | } | ||
150 | |||
151 | public void ParcelProperties (OpenMetaverse.Messages.Linden.ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) | ||
152 | { | ||
153 | AddEvent(avatarID, "ParcelProperties", parcelPropertiesMessage); | ||
154 | } | ||
155 | |||
156 | public void GroupMembership (OpenMetaverse.Packets.AgentGroupDataUpdatePacket groupUpdate, UUID avatarID) | ||
157 | { | ||
158 | AddEvent(avatarID, "GroupMembership", groupUpdate); | ||
159 | } | ||
160 | |||
161 | public OSD ScriptRunningEvent (UUID objectID, UUID itemID, bool running, bool mono) | ||
162 | { | ||
163 | Console.WriteLine("ONE"); | ||
164 | throw new System.NotImplementedException (); | ||
165 | } | ||
166 | |||
167 | public OSD BuildEvent (string eventName, OSD eventBody) | ||
168 | { | ||
169 | Console.WriteLine("TWO"); | ||
170 | throw new System.NotImplementedException (); | ||
171 | } | ||
172 | |||
173 | public void partPhysicsProperties (uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID) | ||
174 | { | ||
175 | AddEvent(avatarID, "partPhysicsProperties", localID, physhapetype, density, friction, bounce, gravmod); | ||
176 | } | ||
177 | } | ||
178 | } \ No newline at end of file | ||
diff --git a/prebuild.xml b/prebuild.xml index 2b8e963..0045128 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -2833,6 +2833,7 @@ | |||
2833 | <Reference name="Nini" path="../../../bin/"/> | 2833 | <Reference name="Nini" path="../../../bin/"/> |
2834 | <Reference name="nunit.framework" path="../../../bin/"/> | 2834 | <Reference name="nunit.framework" path="../../../bin/"/> |
2835 | <Reference name="OpenMetaverse" path="../../../bin/"/> | 2835 | <Reference name="OpenMetaverse" path="../../../bin/"/> |
2836 | <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> | ||
2836 | <Reference name="OpenMetaverseTypes" path="../../../bin/"/> | 2837 | <Reference name="OpenMetaverseTypes" path="../../../bin/"/> |
2837 | <Reference name="OpenSim.Data"/> | 2838 | <Reference name="OpenSim.Data"/> |
2838 | <Reference name="OpenSim.Data.Null"/> | 2839 | <Reference name="OpenSim.Data.Null"/> |