aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorBlueWall2012-04-26 16:13:47 -0400
committerBlueWall2012-04-26 16:13:47 -0400
commitfba802bb03b7dee804059eae888b63c88280389c (patch)
treeca7312919830dd469dfd4e9b739d5291702007e4 /OpenSim/Region/Framework
parentAdd a version of osNpcSay that takes a channel number Mantis 5747 (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-fba802bb03b7dee804059eae888b63c88280389c.zip
opensim-SC_OLD-fba802bb03b7dee804059eae888b63c88280389c.tar.gz
opensim-SC_OLD-fba802bb03b7dee804059eae888b63c88280389c.tar.bz2
opensim-SC_OLD-fba802bb03b7dee804059eae888b63c88280389c.tar.xz
Merge branch 'master' of /home/opensim/var/repo/opensim
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs42
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs36
5 files changed, 89 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 10b25ed..816d3b6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1988,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes
1988 } 1988 }
1989 } 1989 }
1990 1990
1991 if (permissionToTake) 1991 if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete))
1992 { 1992 {
1993 m_asyncSceneObjectDeleter.DeleteToInventory( 1993 m_asyncSceneObjectDeleter.DeleteToInventory(
1994 action, destinationID, deleteGroups, remoteClient, 1994 action, destinationID, deleteGroups, remoteClient,
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a87dfb7..7a2b2ed 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -103,6 +103,7 @@ namespace OpenSim.Region.Framework.Scenes
103 public bool m_trustBinaries; 103 public bool m_trustBinaries;
104 public bool m_allowScriptCrossings; 104 public bool m_allowScriptCrossings;
105 public bool m_useFlySlow; 105 public bool m_useFlySlow;
106 public bool m_useTrashOnDelete = true;
106 107
107 /// <summary> 108 /// <summary>
108 /// Temporarily setting to trigger appearance resends at 60 second intervals. 109 /// Temporarily setting to trigger appearance resends at 60 second intervals.
@@ -709,6 +710,7 @@ namespace OpenSim.Region.Framework.Scenes
709 m_clampPrimSize = true; 710 m_clampPrimSize = true;
710 } 711 }
711 712
713 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
712 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); 714 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
713 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); 715 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
714 m_dontPersistBefore = 716 m_dontPersistBefore =
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 49a3485..2686004 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1969,6 +1969,11 @@ namespace OpenSim.Region.Framework.Scenes
1969 /// <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>
1970 public void LinkToGroup(SceneObjectGroup objectGroup) 1970 public void LinkToGroup(SceneObjectGroup objectGroup)
1971 { 1971 {
1972 LinkToGroup(objectGroup, false);
1973 }
1974
1975 public void LinkToGroup(SceneObjectGroup objectGroup, bool insert)
1976 {
1972// m_log.DebugFormat( 1977// m_log.DebugFormat(
1973// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", 1978// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
1974// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); 1979// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
@@ -1979,6 +1984,10 @@ namespace OpenSim.Region.Framework.Scenes
1979 1984
1980 SceneObjectPart linkPart = objectGroup.m_rootPart; 1985 SceneObjectPart linkPart = objectGroup.m_rootPart;
1981 1986
1987 // physics flags from group to be applied to linked parts
1988 bool grpusephys = UsesPhysics;
1989 bool grptemporary = IsTemporary;
1990
1982 Vector3 oldGroupPosition = linkPart.GroupPosition; 1991 Vector3 oldGroupPosition = linkPart.GroupPosition;
1983 Quaternion oldRootRotation = linkPart.RotationOffset; 1992 Quaternion oldRootRotation = linkPart.RotationOffset;
1984 1993
@@ -2002,15 +2011,35 @@ namespace OpenSim.Region.Framework.Scenes
2002 2011
2003 lock (m_parts.SyncRoot) 2012 lock (m_parts.SyncRoot)
2004 { 2013 {
2005 int linkNum = PrimCount + 1; 2014 int linkNum;
2015 if (insert)
2016 {
2017 linkNum = 2;
2018 foreach (SceneObjectPart part in Parts)
2019 {
2020 if (part.LinkNum > 1)
2021 part.LinkNum++;
2022 }
2023 }
2024 else
2025 {
2026 linkNum = PrimCount + 1;
2027 }
2006 2028
2007 m_parts.Add(linkPart.UUID, linkPart); 2029 m_parts.Add(linkPart.UUID, linkPart);
2008 2030
2009 linkPart.SetParent(this); 2031 linkPart.SetParent(this);
2010 linkPart.CreateSelected = true; 2032 linkPart.CreateSelected = true;
2011 2033
2034 // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now
2035 linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive);
2036 if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
2037 {
2038 linkPart.PhysActor.link(m_rootPart.PhysActor);
2039 this.Scene.PhysicsScene.AddPhysicsActorTaint(linkPart.PhysActor);
2040 }
2041
2012 linkPart.LinkNum = linkNum++; 2042 linkPart.LinkNum = linkNum++;
2013 linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
2014 2043
2015 SceneObjectPart[] ogParts = objectGroup.Parts; 2044 SceneObjectPart[] ogParts = objectGroup.Parts;
2016 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) 2045 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
@@ -2022,7 +2051,16 @@ namespace OpenSim.Region.Framework.Scenes
2022 { 2051 {
2023 SceneObjectPart part = ogParts[i]; 2052 SceneObjectPart part = ogParts[i];
2024 if (part.UUID != objectGroup.m_rootPart.UUID) 2053 if (part.UUID != objectGroup.m_rootPart.UUID)
2054 {
2025 LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++); 2055 LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
2056 // let physics know
2057 part.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (part.Flags & PrimFlags.Phantom) != 0), part.VolumeDetectActive);
2058 if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
2059 {
2060 part.PhysActor.link(m_rootPart.PhysActor);
2061 this.Scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
2062 }
2063 }
2026 part.ClearUndoState(); 2064 part.ClearUndoState();
2027 } 2065 }
2028 } 2066 }
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/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>