aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMic Bowman2012-04-25 09:52:44 -0700
committerMic Bowman2012-04-25 09:52:44 -0700
commit1afae013111b7c817037371fca805a78c3ab67cc (patch)
treedc4f08217c64fd92f4fac250344f009f583fca4e /OpenSim/Region/Framework/Scenes
parentAdd try/catch around Json script method registration to avoild some issues (diff)
parentSlight rewording of output messages. (diff)
downloadopensim-SC_OLD-1afae013111b7c817037371fca805a78c3ab67cc.zip
opensim-SC_OLD-1afae013111b7c817037371fca805a78c3ab67cc.tar.gz
opensim-SC_OLD-1afae013111b7c817037371fca805a78c3ab67cc.tar.bz2
opensim-SC_OLD-1afae013111b7c817037371fca805a78c3ab67cc.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs130
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs36
8 files changed, 235 insertions, 33 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 87ffc74..2701d6e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -38,8 +38,9 @@ namespace OpenSim.Region.Framework.Scenes
38{ 38{
39 public partial class Scene 39 public partial class Scene
40 { 40 {
41
41 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, 42 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
42 UUID fromID, bool fromAgent, bool broadcast) 43 UUID fromID, UUID targetID, bool fromAgent, bool broadcast)
43 { 44 {
44 OSChatMessage args = new OSChatMessage(); 45 OSChatMessage args = new OSChatMessage();
45 46
@@ -63,14 +64,20 @@ namespace OpenSim.Region.Framework.Scenes
63 } 64 }
64 65
65 args.From = fromName; 66 args.From = fromName;
66 //args. 67 args.TargetUUID = targetID;
67 68
68 if (broadcast) 69 if (broadcast)
69 EventManager.TriggerOnChatBroadcast(this, args); 70 EventManager.TriggerOnChatBroadcast(this, args);
70 else 71 else
71 EventManager.TriggerOnChatFromWorld(this, args); 72 EventManager.TriggerOnChatFromWorld(this, args);
72 } 73 }
73 74
75 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
76 UUID fromID, bool fromAgent, bool broadcast)
77 {
78 SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast);
79 }
80
74 /// <summary> 81 /// <summary>
75 /// 82 ///
76 /// </summary> 83 /// </summary>
@@ -108,6 +115,19 @@ namespace OpenSim.Region.Framework.Scenes
108 { 115 {
109 SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true); 116 SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true);
110 } 117 }
118 /// <summary>
119 ///
120 /// </summary>
121 /// <param name="message"></param>
122 /// <param name="type"></param>
123 /// <param name="fromPos"></param>
124 /// <param name="fromName"></param>
125 /// <param name="fromAgentID"></param>
126 /// <param name="targetID"></param>
127 public void SimChatToAgent(UUID targetID, byte[] message, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent)
128 {
129 SimChat(message, ChatTypeEnum.Say, 0, fromPos, fromName, fromID, targetID, fromAgent, false);
130 }
111 131
112 /// <summary> 132 /// <summary>
113 /// Invoked when the client requests a prim. 133 /// Invoked when the client requests a prim.
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e488fe1..a87dfb7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -684,8 +684,8 @@ namespace OpenSim.Region.Framework.Scenes
684 //Animation states 684 //Animation states
685 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 685 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
686 686
687 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 687 PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
688 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 688 CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
689 689
690 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); 690 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
691 if (RegionInfo.NonphysPrimMax > 0) 691 if (RegionInfo.NonphysPrimMax > 0)
@@ -800,13 +800,11 @@ namespace OpenSim.Region.Framework.Scenes
800 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 800 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
801 } 801 }
802 802
803 /// <summary>
804 /// Mock constructor for scene group persistency unit tests.
805 /// SceneObjectGroup RegionId property is delegated to Scene.
806 /// </summary>
807 /// <param name="regInfo"></param>
808 public Scene(RegionInfo regInfo) 803 public Scene(RegionInfo regInfo)
809 { 804 {
805 PhysicalPrims = true;
806 CollidablePrims = true;
807
810 BordersLocked = true; 808 BordersLocked = true;
811 Border northBorder = new Border(); 809 Border northBorder = new Border();
812 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- 810 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
@@ -833,8 +831,6 @@ namespace OpenSim.Region.Framework.Scenes
833 m_eventManager = new EventManager(); 831 m_eventManager = new EventManager();
834 832
835 m_permissions = new ScenePermissions(this); 833 m_permissions = new ScenePermissions(this);
836
837// m_lastUpdate = Util.EnvironmentTickCount();
838 } 834 }
839 835
840 #endregion 836 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 0098add..67eb0fe 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -91,6 +91,9 @@ namespace OpenSim.Region.Framework.Scenes
91 /// </summary> 91 /// </summary>
92 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>(); 92 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
93 93
94 /// <summary>
95 /// Lock to prevent object group update, linking and delinking operations from running concurrently.
96 /// </summary>
94 private Object m_updateLock = new Object(); 97 private Object m_updateLock = new Object();
95 98
96 #endregion 99 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a49ed13..49a3485 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1962,6 +1962,10 @@ namespace OpenSim.Region.Framework.Scenes
1962 /// <summary> 1962 /// <summary>
1963 /// Link the prims in a given group to this group 1963 /// Link the prims in a given group to this group
1964 /// </summary> 1964 /// </summary>
1965 /// <remarks>
1966 /// Do not call this method directly - use Scene.LinkObjects() instead to avoid races between threads.
1967 /// FIXME: There are places where scripts call these methods directly without locking. This is a potential race condition.
1968 /// </remarks>
1965 /// <param name="objectGroup">The group of prims which should be linked to this group</param> 1969 /// <param name="objectGroup">The group of prims which should be linked to this group</param>
1966 public void LinkToGroup(SceneObjectGroup objectGroup) 1970 public void LinkToGroup(SceneObjectGroup objectGroup)
1967 { 1971 {
@@ -2006,6 +2010,7 @@ namespace OpenSim.Region.Framework.Scenes
2006 linkPart.CreateSelected = true; 2010 linkPart.CreateSelected = true;
2007 2011
2008 linkPart.LinkNum = linkNum++; 2012 linkPart.LinkNum = linkNum++;
2013 linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
2009 2014
2010 SceneObjectPart[] ogParts = objectGroup.Parts; 2015 SceneObjectPart[] ogParts = objectGroup.Parts;
2011 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) 2016 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
@@ -2045,6 +2050,11 @@ namespace OpenSim.Region.Framework.Scenes
2045 /// Delink the given prim from this group. The delinked prim is established as 2050 /// Delink the given prim from this group. The delinked prim is established as
2046 /// an independent SceneObjectGroup. 2051 /// an independent SceneObjectGroup.
2047 /// </summary> 2052 /// </summary>
2053 /// <remarks>
2054 /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
2055 /// condition. But currently there is no
2056 /// alternative method that does take a lonk to delink a single prim.
2057 /// </remarks>
2048 /// <param name="partID"></param> 2058 /// <param name="partID"></param>
2049 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> 2059 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
2050 public SceneObjectGroup DelinkFromGroup(uint partID) 2060 public SceneObjectGroup DelinkFromGroup(uint partID)
@@ -2056,6 +2066,11 @@ namespace OpenSim.Region.Framework.Scenes
2056 /// Delink the given prim from this group. The delinked prim is established as 2066 /// Delink the given prim from this group. The delinked prim is established as
2057 /// an independent SceneObjectGroup. 2067 /// an independent SceneObjectGroup.
2058 /// </summary> 2068 /// </summary>
2069 /// <remarks>
2070 /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
2071 /// condition. But currently there is no
2072 /// alternative method that does take a lonk to delink a single prim.
2073 /// </remarks>
2059 /// <param name="partID"></param> 2074 /// <param name="partID"></param>
2060 /// <param name="sendEvents"></param> 2075 /// <param name="sendEvents"></param>
2061 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> 2076 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
@@ -2081,6 +2096,11 @@ namespace OpenSim.Region.Framework.Scenes
2081 /// Delink the given prim from this group. The delinked prim is established as 2096 /// Delink the given prim from this group. The delinked prim is established as
2082 /// an independent SceneObjectGroup. 2097 /// an independent SceneObjectGroup.
2083 /// </summary> 2098 /// </summary>
2099 /// <remarks>
2100 /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
2101 /// condition. But currently there is no
2102 /// alternative method that does take a lonk to delink a single prim.
2103 /// </remarks>
2084 /// <param name="partID"></param> 2104 /// <param name="partID"></param>
2085 /// <param name="sendEvents"></param> 2105 /// <param name="sendEvents"></param>
2086 /// <returns>The object group of the newly delinked prim.</returns> 2106 /// <returns>The object group of the newly delinked prim.</returns>
@@ -2201,6 +2221,8 @@ namespace OpenSim.Region.Framework.Scenes
2201 oldRot = part.RotationOffset; 2221 oldRot = part.RotationOffset;
2202 Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot; 2222 Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
2203 part.RotationOffset = newRot; 2223 part.RotationOffset = newRot;
2224
2225 part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
2204 } 2226 }
2205 2227
2206 /// <summary> 2228 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 046553b..4bec2d4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1706,6 +1706,9 @@ namespace OpenSim.Region.Framework.Scenes
1706 /// <param name="isNew"></param> 1706 /// <param name="isNew"></param>
1707 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) 1707 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
1708 { 1708 {
1709 if (ParentGroup.Scene == null)
1710 return;
1711
1709 if (!ParentGroup.Scene.PhysicalPrims && UsePhysics) 1712 if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
1710 return; 1713 return;
1711 1714
@@ -4161,7 +4164,7 @@ namespace OpenSim.Region.Framework.Scenes
4161 // For now, we use the NINJA naming scheme for identifying joints. 4164 // For now, we use the NINJA naming scheme for identifying joints.
4162 // In the future, we can support other joint specification schemes such as a 4165 // In the future, we can support other joint specification schemes such as a
4163 // custom checkbox in the viewer GUI. 4166 // custom checkbox in the viewer GUI.
4164 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) 4167 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4165 { 4168 {
4166 string hingeString = "hingejoint"; 4169 string hingeString = "hingejoint";
4167 return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString); 4170 return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
@@ -4177,7 +4180,7 @@ namespace OpenSim.Region.Framework.Scenes
4177 // For now, we use the NINJA naming scheme for identifying joints. 4180 // For now, we use the NINJA naming scheme for identifying joints.
4178 // In the future, we can support other joint specification schemes such as a 4181 // In the future, we can support other joint specification schemes such as a
4179 // custom checkbox in the viewer GUI. 4182 // custom checkbox in the viewer GUI.
4180 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) 4183 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4181 { 4184 {
4182 string ballString = "balljoint"; 4185 string ballString = "balljoint";
4183 return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString); 4186 return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
@@ -4193,7 +4196,7 @@ namespace OpenSim.Region.Framework.Scenes
4193 // For now, we use the NINJA naming scheme for identifying joints. 4196 // For now, we use the NINJA naming scheme for identifying joints.
4194 // In the future, we can support other joint specification schemes such as a 4197 // In the future, we can support other joint specification schemes such as a
4195 // custom checkbox in the viewer GUI. 4198 // custom checkbox in the viewer GUI.
4196 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) 4199 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4197 { 4200 {
4198 return IsHingeJoint() || IsBallJoint(); 4201 return IsHingeJoint() || IsBallJoint();
4199 } 4202 }
@@ -4287,7 +4290,10 @@ namespace OpenSim.Region.Framework.Scenes
4287 AddFlag(PrimFlags.Phantom); 4290 AddFlag(PrimFlags.Phantom);
4288 4291
4289 if (PhysActor != null) 4292 if (PhysActor != null)
4293 {
4290 RemoveFromPhysics(); 4294 RemoveFromPhysics();
4295 pa = null;
4296 }
4291 } 4297 }
4292 else // Not phantom 4298 else // Not phantom
4293 { 4299 {
@@ -4353,7 +4359,7 @@ namespace OpenSim.Region.Framework.Scenes
4353 { 4359 {
4354 pa.SetVolumeDetect(1); 4360 pa.SetVolumeDetect(1);
4355 AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active 4361 AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
4356 this.VolumeDetectActive = true; 4362 VolumeDetectActive = true;
4357 } 4363 }
4358 } 4364 }
4359 else 4365 else
@@ -4361,9 +4367,9 @@ namespace OpenSim.Region.Framework.Scenes
4361 // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like 4367 // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
4362 // (mumbles, well, at least if you have infinte CPU powers :-)) 4368 // (mumbles, well, at least if you have infinte CPU powers :-))
4363 if (pa != null) 4369 if (pa != null)
4364 PhysActor.SetVolumeDetect(0); 4370 pa.SetVolumeDetect(0);
4365 4371
4366 this.VolumeDetectActive = false; 4372 VolumeDetectActive = false;
4367 } 4373 }
4368 4374
4369 if (SetTemporary) 4375 if (SetTemporary)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b5f789b..e8178ce 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -990,23 +990,24 @@ namespace OpenSim.Region.Framework.Scenes
990 /// <param name="pos"></param> 990 /// <param name="pos"></param>
991 public void Teleport(Vector3 pos) 991 public void Teleport(Vector3 pos)
992 { 992 {
993 bool isFlying = Flying; 993 TeleportWithMomentum(pos, null);
994 RemoveFromPhysicalScene();
995 Velocity = Vector3.Zero;
996 CheckLandingPoint(ref pos);
997 AbsolutePosition = pos;
998 AddToPhysicalScene(isFlying);
999
1000 SendTerseUpdateToAllClients();
1001 } 994 }
1002 995
1003 public void TeleportWithMomentum(Vector3 pos) 996 public void TeleportWithMomentum(Vector3 pos, Vector3? v)
1004 { 997 {
1005 bool isFlying = Flying; 998 bool isFlying = Flying;
999 Vector3 vel = Velocity;
1006 RemoveFromPhysicalScene(); 1000 RemoveFromPhysicalScene();
1007 CheckLandingPoint(ref pos); 1001 CheckLandingPoint(ref pos);
1008 AbsolutePosition = pos; 1002 AbsolutePosition = pos;
1009 AddToPhysicalScene(isFlying); 1003 AddToPhysicalScene(isFlying);
1004 if (PhysicsActor != null)
1005 {
1006 if (v.HasValue)
1007 PhysicsActor.SetMomentum((Vector3)v);
1008 else
1009 PhysicsActor.SetMomentum(vel);
1010 }
1010 1011
1011 SendTerseUpdateToAllClients(); 1012 SendTerseUpdateToAllClients();
1012 } 1013 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 2a342d5..360566d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using NUnit.Framework; 31using NUnit.Framework;
31using OpenMetaverse; 32using OpenMetaverse;
@@ -43,24 +44,141 @@ namespace OpenSim.Region.Framework.Scenes.Tests
43 [TestFixture] 44 [TestFixture]
44 public class SceneObjectStatusTests 45 public class SceneObjectStatusTests
45 { 46 {
47 private TestScene m_scene;
48 private UUID m_ownerId = TestHelpers.ParseTail(0x1);
49 private SceneObjectGroup m_so1;
50 private SceneObjectGroup m_so2;
51
52 [SetUp]
53 public void Init()
54 {
55 m_scene = SceneHelpers.SetupScene();
56 m_so1 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so1", 0x10);
57 m_so2 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so2", 0x20);
58 }
59
46 [Test] 60 [Test]
47 public void TestSetPhantom() 61 public void TestSetPhantomSinglePrim()
48 { 62 {
49 TestHelpers.InMethod(); 63 TestHelpers.InMethod();
50 64
51// Scene scene = SceneSetupHelpers.SetupScene(); 65 m_scene.AddSceneObject(m_so1);
52 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero); 66
53 SceneObjectPart rootPart = so.RootPart; 67 SceneObjectPart rootPart = m_so1.RootPart;
54 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); 68 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
55 69
56 so.ScriptSetPhantomStatus(true); 70 m_so1.ScriptSetPhantomStatus(true);
57 71
58// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); 72// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
59 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); 73 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
60 74
61 so.ScriptSetPhantomStatus(false); 75 m_so1.ScriptSetPhantomStatus(false);
62 76
63 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); 77 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
64 } 78 }
79
80 [Test]
81 public void TestSetPhysicsSinglePrim()
82 {
83 TestHelpers.InMethod();
84
85 m_scene.AddSceneObject(m_so1);
86
87 SceneObjectPart rootPart = m_so1.RootPart;
88 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
89
90 m_so1.ScriptSetPhysicsStatus(true);
91
92// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
93 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
94
95 m_so1.ScriptSetPhysicsStatus(false);
96
97 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
98 }
99
100 [Test]
101 public void TestSetPhysicsLinkset()
102 {
103 TestHelpers.InMethod();
104
105 m_scene.AddSceneObject(m_so1);
106 m_scene.AddSceneObject(m_so2);
107
108 m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
109
110 m_so1.ScriptSetPhysicsStatus(true);
111
112 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
113 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
114
115 m_so1.ScriptSetPhysicsStatus(false);
116
117 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
118 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
119
120 m_so1.ScriptSetPhysicsStatus(true);
121
122 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
123 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
124 }
125
126 /// <summary>
127 /// Test that linking results in the correct physical status for all linkees.
128 /// </summary>
129 [Test]
130 public void TestLinkPhysicsBothPhysical()
131 {
132 TestHelpers.InMethod();
133
134 m_scene.AddSceneObject(m_so1);
135 m_scene.AddSceneObject(m_so2);
136
137 m_so1.ScriptSetPhysicsStatus(true);
138 m_so2.ScriptSetPhysicsStatus(true);
139
140 m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
141
142 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
143 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
144 }
145
146 /// <summary>
147 /// Test that linking results in the correct physical status for all linkees.
148 /// </summary>
149 [Test]
150 public void TestLinkPhysicsRootPhysicalOnly()
151 {
152 TestHelpers.InMethod();
153
154 m_scene.AddSceneObject(m_so1);
155 m_scene.AddSceneObject(m_so2);
156
157 m_so1.ScriptSetPhysicsStatus(true);
158
159 m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
160
161 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
162 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
163 }
164
165 /// <summary>
166 /// Test that linking results in the correct physical status for all linkees.
167 /// </summary>
168 [Test]
169 public void TestLinkPhysicsChildPhysicalOnly()
170 {
171 TestHelpers.InMethod();
172
173 m_scene.AddSceneObject(m_so1);
174 m_scene.AddSceneObject(m_so2);
175
176 m_so2.ScriptSetPhysicsStatus(true);
177
178 m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
179
180 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
181 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
182 }
65 } 183 }
66} \ No newline at end of file 184} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index bebc10c..eb7bfbd 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -33,6 +33,7 @@ using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer;
36using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
38using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
@@ -47,6 +48,41 @@ namespace OpenSim.Region.Framework.Scenes.Tests
47 [TestFixture] 48 [TestFixture]
48 public class ScenePresenceTeleportTests 49 public class ScenePresenceTeleportTests
49 { 50 {
51 [Test]
52 public void TestSameRegionTeleport()
53 {
54 TestHelpers.InMethod();
55// log4net.Config.XmlConfigurator.Configure();
56
57 EntityTransferModule etm = new EntityTransferModule();
58
59 IConfigSource config = new IniConfigSource();
60 config.AddConfig("Modules");
61 // Not strictly necessary since FriendsModule assumes it is the default (!)
62 config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
63
64 TestScene scene = SceneHelpers.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
65 SceneHelpers.SetupSceneModules(scene, config, etm);
66
67 Vector3 teleportPosition = new Vector3(10, 11, 12);
68 Vector3 teleportLookAt = new Vector3(20, 21, 22);
69
70 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
71 sp.AbsolutePosition = new Vector3(30, 31, 32);
72 scene.RequestTeleportLocation(
73 sp.ControllingClient,
74 scene.RegionInfo.RegionHandle,
75 teleportPosition,
76 teleportLookAt,
77 (uint)TeleportFlags.ViaLocation);
78
79 Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition));
80
81 // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
82 // position instead).
83// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
84 }
85
50 /// <summary> 86 /// <summary>
51 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. 87 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
52 /// </summary> 88 /// </summary>