From 1a2518d19bb447f4d3821cb71e32e712cc99d9c0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Aug 2011 19:57:47 +0100 Subject: Instead of moving the file to its final place when FlotsamCache writes to disk, copy it instead. This is to eliminate IOException where two threads compete to cache the same file. --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index da39202..0c700e3 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -600,7 +600,13 @@ namespace Flotsam.RegionModules.AssetCache stream.Close(); // Now that it's written, rename it so that it can be found. - File.Move(tempname, filename); + // We're doing this as a file copy operation so that if two threads are competing to cache this asset, + // then both suceed instead of one failing when it tries to move the file to a final filename that + // already exists. + // This assumes that the file copy operation is atomic. Assuming this holds, then copying also works + // if another simulator is using the same cache directory. + File.Copy(tempname, filename, true); + File.Delete(tempname); if (m_LogLevel >= 2) m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID); @@ -635,7 +641,6 @@ namespace Flotsam.RegionModules.AssetCache } #endif } - } } -- cgit v1.1 From 7d35bf819374a323fa737f8342a4239e0759ce8f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Aug 2011 22:45:42 +0100 Subject: refactor: remove a sliver of unnecessary code --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 0c700e3..7ef759c 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -635,10 +635,7 @@ namespace Flotsam.RegionModules.AssetCache waitEvent.Set(); } #else - if (m_CurrentlyWriting.Contains(filename)) - { - m_CurrentlyWriting.Remove(filename); - } + m_CurrentlyWriting.Remove(filename); #endif } } -- cgit v1.1 From f18780d0e3a6e5130b1c1d86c71630801dc70c57 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Aug 2011 22:56:53 +0100 Subject: Get "show region" command in GridService to show grid co-ordinates rather than meters co-ord. This makes it consistent with "show regions" Addresses http://opensimulator.org/mantis/view.php?id=5619 --- OpenSim/Services/GridService/GridService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index f663dd6..0a4372a 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -510,8 +510,9 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], - r.Data["owner_uuid"].ToString(), flags.ToString())); + String.Format("{0},{1}", r.posX / Constants.RegionSize, r.posY / Constants.RegionSize), + r.Data["serverURI"], + r.Data["owner_uuid"], flags)); } return; } -- cgit v1.1 From ba89fc3aa1833c0fd6b5518d85ca966768597c6c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Aug 2011 23:42:05 +0100 Subject: Add regression test for setting phantom status on a scene object. This is not yet complete. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 22 ++++---- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++- .../Scenes/Tests/SceneObjectStatusTests.cs | 62 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 57baa99..3b6a458 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2253,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void DetachFromBackup() { - if (m_isBackedUp) + if (m_isBackedUp && Scene != null) m_scene.EventManager.OnBackup -= ProcessBackup; m_isBackedUp = false; @@ -2520,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart selectionPart = GetChildPart(localID); - if (SetTemporary) + if (SetTemporary && Scene != null) { DetachFromBackup(); // Remove from database and parcel prim count @@ -2532,15 +2532,19 @@ namespace OpenSim.Region.Framework.Scenes if (selectionPart != null) { SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) + + if (Scene != null) { - SceneObjectPart part = parts[i]; - if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || - part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || - part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) + for (int i = 0; i < parts.Length; i++) { - UsePhysics = false; // Reset physics - break; + SceneObjectPart part = parts[i]; + if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) + { + UsePhysics = false; // Reset physics + break; + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 90ad34e..e8a1070 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -261,12 +261,9 @@ namespace OpenSim.Region.Framework.Scenes } protected SceneObjectPartInventory m_inventory; - public bool Undoing; - public bool IgnoreUndoUpdate = false; - private PrimFlags LocalFlags; @@ -4645,6 +4642,8 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); + +// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); } public void UpdateRotation(Quaternion rot) @@ -4864,7 +4863,7 @@ namespace OpenSim.Region.Framework.Scenes // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; //} - LocalFlags=(PrimFlags)objectflagupdate; + LocalFlags = (PrimFlags)objectflagupdate; if (m_parentGroup != null && m_parentGroup.RootPart == this) { diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs new file mode 100644 index 0000000..a26fe33 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Basic scene object status tests + /// + [TestFixture] + public class SceneObjectStatusTests + { + [Test] + public void TestSetPhantom() + { + TestHelper.InMethod(); + +// Scene scene = SceneSetupHelpers.SetupScene(); + SceneObjectGroup so = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); + SceneObjectPart rootPart = so.RootPart; + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); + + so.RootPart.ScriptSetPhantomStatus(true); + + Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); + } + } +} \ No newline at end of file -- cgit v1.1 From c6c91e6599de6d4402ec0258da03cc975147da90 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 00:13:08 +0100 Subject: refactor: Fold most SOP.ScriptSet* methods back into script code. Simplify. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 25 -------------------- .../Scenes/Tests/SceneObjectStatusTests.cs | 4 ++-- .../Shared/Api/Implementation/LSL_Api.cs | 27 ++++++---------------- 3 files changed, 9 insertions(+), 47 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e8a1070..afc386e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2967,22 +2967,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void ScriptSetPhantomStatus(bool Phantom) - { - if (m_parentGroup != null) - { - m_parentGroup.ScriptSetPhantomStatus(Phantom); - } - } - - public void ScriptSetTemporaryStatus(bool Temporary) - { - if (m_parentGroup != null) - { - m_parentGroup.ScriptSetTemporaryStatus(Temporary); - } - } - public void ScriptSetPhysicsStatus(bool UsePhysics) { if (m_parentGroup == null) @@ -2991,15 +2975,6 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); } - public void ScriptSetVolumeDetect(bool SetVD) - { - - if (m_parentGroup != null) - { - m_parentGroup.ScriptSetVolumeDetect(SetVD); - } - } - /// /// Set sculpt and mesh data, and tell the physics engine to process the change. /// diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index a26fe33..641c34e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -53,9 +53,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectPart rootPart = so.RootPart; Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); - so.RootPart.ScriptSetPhantomStatus(true); + so.ScriptSetPhantomStatus(true); - Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); +// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 26969a5..7c21ba9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1204,10 +1204,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) { - if (value != 0) - m_host.ScriptSetPhantomStatus(true); - else - m_host.ScriptSetPhantomStatus(false); + if (m_host.ParentGroup != null) + m_host.ParentGroup.ScriptSetPhantomStatus(value != 0); } if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) @@ -6446,9 +6444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup != null) { if (!m_host.ParentGroup.IsDeleted) - { - m_host.ParentGroup.RootPart.ScriptSetVolumeDetect(detect!=0); - } + m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); } } @@ -6456,7 +6452,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// This is a depecated function so this just replicates the result of /// invoking it in SL /// - public void llRemoteLoadScript(string target, string name, int running, int start_param) { m_host.AddScriptLPS(1); @@ -7254,14 +7249,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; string ph = rules.Data[idx++].ToString(); - bool phantom; - if (ph.Equals("1")) - phantom = true; - else - phantom = false; + if (m_host.ParentGroup != null) + m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); - part.ScriptSetPhantomStatus(phantom); break; case (int)ScriptBaseClass.PRIM_PHYSICS: @@ -7282,14 +7273,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return; string temp = rules.Data[idx++].ToString(); - bool tempOnRez; - if (temp.Equals("1")) - tempOnRez = true; - else - tempOnRez = false; + if (m_host.ParentGroup != null) + m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); - part.ScriptSetTemporaryStatus(tempOnRez); break; case (int)ScriptBaseClass.PRIM_TEXGEN: -- cgit v1.1 From cba40de109a0ab54a58324f105cbba799da70e39 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 00:22:14 +0100 Subject: extend phantom flag regression test to toggle back off --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index afc386e..7778ebc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4514,6 +4514,9 @@ namespace OpenSim.Region.Framework.Scenes { RemFlag(PrimFlags.Phantom); + if (ParentGroup.Scene == null) + return; + PhysicsActor pa = PhysActor; if (pa == null) diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 641c34e..c0fca5d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -57,6 +57,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); + + so.ScriptSetPhantomStatus(false); + + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); } } } \ No newline at end of file -- cgit v1.1 From bda1a4be4567181df6c18ce6e059ca8982bc5fa1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 00:26:37 +0100 Subject: rename test SceneSetupHelpers -> SceneHelpers for consistency --- .../Asset/Tests/FlotsamAssetCacheTests.cs | 4 +- .../Tests/AvatarFactoryModuleTests.cs | 6 +- .../Archiver/Tests/InventoryArchiveTestCase.cs | 10 +- .../Archiver/Tests/InventoryArchiverTests.cs | 8 +- .../Avatar/Inventory/Archiver/Tests/PathTests.cs | 22 +- .../Tests/InventoryAccessModuleTests.cs | 10 +- .../World/Archiver/Tests/ArchiverTests.cs | 8 +- .../World/Land/Tests/PrimCountModuleTests.cs | 32 +- .../World/Media/Moap/Tests/MoapTests.cs | 8 +- .../World/Serialiser/Tests/SerialiserTests.cs | 4 +- .../Framework/Scenes/Tests/AttachmentTests.cs | 14 +- .../Framework/Scenes/Tests/EntityManagerTests.cs | 2 +- .../Framework/Scenes/Tests/SceneGraphTests.cs | 2 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 14 +- .../Scenes/Tests/SceneObjectDeRezTests.cs | 12 +- .../Scenes/Tests/SceneObjectLinkingTests.cs | 20 +- .../Scenes/Tests/SceneObjectResizeTests.cs | 8 +- .../Scenes/Tests/SceneObjectStatusTests.cs | 2 +- .../Scenes/Tests/SceneObjectUserGroupTests.cs | 6 +- .../Framework/Scenes/Tests/ScenePresenceTests.cs | 20 +- .../Region/Framework/Scenes/Tests/SceneTests.cs | 2 +- .../Scenes/Tests/StandaloneTeleportTests.cs | 10 +- .../Framework/Scenes/Tests/TaskInventoryTests.cs | 12 +- .../Framework/Scenes/Tests/UserInventoryTests.cs | 4 +- .../Framework/Scenes/Tests/UuidGathererTests.cs | 2 +- .../Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | 4 +- .../World/NPC/Tests/NPCModuleTests.cs | 12 +- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 4 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 483 +++++++++++++++++++++ OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs | 483 --------------------- .../Tests/Common/Helpers/TaskInventoryHelpers.cs | 2 +- 31 files changed, 615 insertions(+), 615 deletions(-) create mode 100644 OpenSim/Tests/Common/Helpers/SceneHelpers.cs delete mode 100644 OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index 63b0c31..1662f19 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs @@ -65,8 +65,8 @@ namespace OpenSim.Region.CoreModules.Asset.Tests config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true"); m_cache = new FlotsamAssetCache(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, config, m_cache); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, config, m_cache); } [Test] diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 07de908..c05f5ab 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -50,9 +50,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory UUID userId = TestHelper.ParseTail(0x1); AvatarFactoryModule afm = new AvatarFactoryModule(); - TestScene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, afm); - TestClient tc = SceneSetupHelpers.AddClient(scene, userId); + TestScene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, afm); + TestClient tc = SceneHelpers.AddClient(scene, userId); byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT]; for (byte i = 0; i < visualParams.Length; i++) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index aadeedb..19ef571 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -100,8 +100,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // log4net.Config.XmlConfigurator.Configure(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, archiverModule); UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); @@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Create scene object asset UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); @@ -127,10 +127,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests scene.AddInventoryItem(item1); // Create coalesced objects asset - SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); + SceneObjectGroup cobj1 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); cobj1.AbsolutePosition = new Vector3(15, 30, 45); - SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); + SceneObjectGroup cobj2 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); cobj2.AbsolutePosition = new Vector3(25, 50, 75); CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index ae3ab21..3616ae2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -61,8 +61,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); m_archiverModule = new InventoryArchiverModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); } [Test] @@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Create asset UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); @@ -236,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Create asset UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index 127d5f8..1d3e5d0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs @@ -62,8 +62,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, archiverModule); // Create user string userFirstName = "Jock"; @@ -179,9 +179,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); + SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); @@ -222,8 +222,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); @@ -247,8 +247,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, archiverModule); // Create user string userFirstName = "Jock"; @@ -326,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); Dictionary foldersCreated = new Dictionary(); @@ -393,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); string folder1ExistingName = "a"; @@ -444,7 +444,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); string folder1ExistingName = "a"; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 733ad25..90b6481 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -65,8 +65,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, config, m_iam); // Create user string userFirstName = "Jock"; @@ -86,10 +86,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests // log4net.Config.XmlConfigurator.Configure(); // Create asset - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20); object1.AbsolutePosition = new Vector3(15, 30, 45); - SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40); + SceneObjectGroup object2 = SceneHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40); object2.AbsolutePosition = new Vector3(25, 50, 75); CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); @@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests // log4net.Config.XmlConfigurator.Configure(); // Create asset - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 6ba3459..645113f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -68,8 +68,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); TerrainModule terrainModule = new TerrainModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); } private void LoadCompleted(Guid requestId, string errorMessage) @@ -524,8 +524,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); TerrainModule terrainModule = new TerrainModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index a3aa38d..fecbf67 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -64,8 +64,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests { m_pcm = new PrimCountModule(); LandManagementModule lmm = new LandManagementModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm); int xParcelDivider = (int)Constants.RegionSize - 1; @@ -111,7 +111,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); Assert.That(pc.Owner, Is.EqualTo(3)); @@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Simulator, Is.EqualTo(3)); // Add a second object and retest - SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); + SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sog2, false); Assert.That(pc.Owner, Is.EqualTo(5)); @@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); @@ -172,9 +172,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); - SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); + SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sog2, false); // Move the first scene object to the eastern strip parcel @@ -235,8 +235,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); + m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false); + SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); @@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); sog.GroupID = m_groupId; m_scene.AddNewSceneObject(sog, false); @@ -291,11 +291,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1); + SceneObjectGroup sogToKeep = SceneHelpers.CreateSceneObject(1, m_userId, "a", 0x1); sogToKeep.GroupID = m_groupId; m_scene.AddNewSceneObject(sogToKeep, false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); + SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); @@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); Assert.That(pc.Owner, Is.EqualTo(0)); @@ -339,8 +339,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10); + m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false); + SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); @@ -363,7 +363,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests TestHelper.InMethod(); IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); m_pcm.TaintPrimCount(); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index d5b7082..fe09739 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs @@ -53,8 +53,8 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests public void SetUp() { m_module = new MoapModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, m_module); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, m_module); } [Test] @@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); MediaEntry me = new MediaEntry(); m_module.SetMediaEntry(part, 1, me); @@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests string homeUrl = "opensimulator.org"; - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); MediaEntry me = new MediaEntry() { HomeURL = homeUrl }; m_module.SetMediaEntry(part, 1, me); diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 4f752ab..93e38f8 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -236,8 +236,8 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests public void Init() { m_serialiserModule = new SerialiserModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule); } [Test] diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs index 5586c65..85197db 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs @@ -64,14 +64,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); interregionComms.Initialise(new IniConfigSource()); interregionComms.PostInitialise(); - SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); - SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); agent1 = UUID.Random(); random = new Random(); @@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests region1 = scene.RegionInfo.RegionHandle; region2 = scene2.RegionInfo.RegionHandle; - SceneSetupHelpers.AddClient(scene, agent1); + SceneHelpers.AddClient(scene, agent1); } [Test] @@ -126,8 +126,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests presence2.AddAttachment(sog2); ISharedRegionModule serialiser = new SerialiserModule(); - SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); - SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); + SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); + SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index f69a4b4..ebf595a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { static public Random random; SceneObjectGroup found; - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); [Test] public void T010_AddObjects() diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 895f2bb..b7ff1b1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestDuplicateObject() { TestHelper.InMethod(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); string part1Name = "part1"; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 260d1c0..8b4771b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); string objName = "obj1"; UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -78,7 +78,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); string obj1Name = "Alfred"; string obj2Name = "Betty"; @@ -112,8 +112,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - TestScene scene = SceneSetupHelpers.SetupScene(); - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); + TestScene scene = SceneHelpers.SetupScene(); + SceneObjectPart part = SceneHelpers.AddSceneObject(scene); scene.DeleteSceneObject(part.ParentGroup, false); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); @@ -131,15 +131,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; sogd.Enabled = false; - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(scene); - IClientAPI client = SceneSetupHelpers.AddClient(scene, agentId); + IClientAPI client = SceneHelpers.AddClient(scene, agentId); scene.DeRezObjects(client, new System.Collections.Generic.List() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 1b8c100..d201510 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -61,12 +61,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); - SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneSetupHelpers.AddClient(scene, userId); + SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); + TestClient client = SceneHelpers.AddClient(scene, userId); // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; @@ -100,12 +100,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); - SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneSetupHelpers.AddClient(scene, userId); + SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); + TestClient client = SceneHelpers.AddClient(scene, userId); // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index cb1d531..b09144d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -54,10 +54,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests bool debugtest = false; - Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); + Scene scene = SceneHelpers.SetupScene(); + SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp1 = part1.ParentGroup; - SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp2 = part2.ParentGroup; grp1.AbsolutePosition = new Vector3(10, 10, 10); @@ -136,14 +136,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests bool debugtest = false; - Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); + Scene scene = SceneHelpers.SetupScene(); + SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp1 = part1.ParentGroup; - SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp2 = part2.ParentGroup; - SceneObjectPart part3 = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp3 = part3.ParentGroup; - SceneObjectPart part4 = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp4 = part4.ParentGroup; grp1.AbsolutePosition = new Vector3(10, 10, 10); @@ -269,7 +269,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -308,7 +308,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index c4047ee..8630476 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -52,8 +52,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup; + Scene scene = SceneHelpers.SetupScene(); + SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; g1.GroupResize(new Vector3(2, 3, 4)); @@ -75,9 +75,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); - SceneObjectGroup g1 = SceneSetupHelpers.CreateSceneObject(2, UUID.Zero); + SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero); g1.RootPart.Scale = new Vector3(2, 3, 4); g1.Parts[1].Scale = new Vector3(5, 6, 7); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index c0fca5d..c2adb2a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); // Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectGroup so = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero); SceneObjectPart rootPart = so.RootPart; Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index 8425d37..e0ab1c8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig startupConfig = configSource.AddConfig("Startup"); @@ -69,13 +69,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests groupsConfig.Set("Module", "GroupsModule"); groupsConfig.Set("DebugEnabled", true); - SceneSetupHelpers.SetupSceneModules( + SceneHelpers.SetupSceneModules( scene, configSource, new object[] { new PermissionsModule(), new GroupsModule(), new MockGroupsServicesConnector() }); - TestClient client = SceneSetupHelpers.AddClient(scene, userId); + TestClient client = SceneHelpers.AddClient(scene, userId); IGroupsModule groupsModule = scene.RequestModuleInterface(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index a37b338..8af1b38 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -66,16 +66,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); - scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); + scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); interregionComms.Initialise(new IniConfigSource()); interregionComms.PostInitialise(); - SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); - SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); - SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); agent1 = UUID.Random(); agent2 = UUID.Random(); @@ -203,16 +203,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); - TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); - TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); + TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); + TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); IConfigSource configSource = new IniConfigSource(); configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); EntityTransferModule etm = new EntityTransferModule(); - SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm); + SceneHelpers.SetupSceneModules(myScene1, configSource, etm); - SceneSetupHelpers.AddClient(myScene1, agent1Id); + SceneHelpers.AddClient(myScene1, agent1Id); ScenePresence childPresence = myScene2.GetScenePresence(agent1); // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 13d93f9..8ffb22e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); scene.Update(); Assert.That(scene.Frame, Is.EqualTo(1)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index 4074f5d..a3848a7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs @@ -116,16 +116,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); - Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); - SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); + Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); + SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); sceneB.RegisterRegionWithGrid(); - Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); - SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); + Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); + SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); sceneA.RegisterRegionWithGrid(); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); - TestClient client = SceneSetupHelpers.AddClient(sceneA, agentId); + TestClient client = SceneHelpers.AddClient(sceneA, agentId); ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index f4e14d4..a61832a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -58,9 +58,9 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); - SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); + SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; // Create an object embedded inside the first @@ -101,9 +101,9 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); - SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); + SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); @@ -128,9 +128,9 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); - SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); + SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index abca792..f6e2827 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); InventoryFolderBase folder1 diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 4da8df1..b0ea497 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void Init() { // FIXME: We don't need a full scene here - it would be enough to set up the asset service. - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); m_assetService = scene.AssetService; m_uuidGatherer = new UuidGatherer(m_assetService); } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index ee52a39..1e56a08 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -50,13 +50,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Groups"); config.Set("Enabled", true); config.Set("Module", "GroupsModule"); config.Set("DebugEnabled", true); - SceneSetupHelpers.SetupSceneModules( + SceneHelpers.SetupSceneModules( scene, configSource, new object[] { new MockGroupsServicesConnector() }); } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index c9dddba..c0053c9 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -57,9 +57,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests config.Configs["NPC"].Set("Enabled", "true"); AvatarFactoryModule afm = new AvatarFactoryModule(); - TestScene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); - TestClient originalClient = SceneSetupHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); + TestScene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); + TestClient originalClient = SceneHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance @@ -94,9 +94,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests config.AddConfig("NPC"); config.Configs["NPC"].Set("Enabled", "true"); - TestScene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, config, new NPCModule()); - TestClient originalClient = SceneSetupHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); + TestScene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, config, new NPCModule()); + TestClient originalClient = SceneHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 80b60a4..3f37ec7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -57,8 +57,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); + Scene scene = SceneHelpers.SetupScene(); + SceneObjectPart part = SceneHelpers.AddSceneObject(scene); XEngine.XEngine engine = new XEngine.XEngine(); engine.Initialise(initConfigSource); diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs new file mode 100644 index 0000000..55b638b --- /dev/null +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -0,0 +1,483 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Net; +using System.Collections.Generic; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Physics.Manager; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.CoreModules.Avatar.Gods; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; +using OpenSim.Services.Interfaces; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Tests.Common +{ + /// + /// Helpers for setting up scenes. + /// + public class SceneHelpers + { + /// + /// Set up a test scene + /// + /// + /// Automatically starts service threads, as would the normal runtime. + /// + /// + public static TestScene SetupScene() + { + return SetupScene("Unit test region", UUID.Random(), 1000, 1000); + } + + /// + /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions + /// or a different, to get a brand new scene with new shared region modules. + /// + /// Name of the region + /// ID of the region + /// X co-ordinate of the region + /// Y co-ordinate of the region + /// This should be the same if simulating two scenes within a standalone + /// + public static TestScene SetupScene(string name, UUID id, uint x, uint y) + { + Console.WriteLine("Setting up test scene {0}", name); + + // We must set up a console otherwise setup of some modules may fail + MainConsole.Instance = new MockConsole("TEST PROMPT"); + + RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); + regInfo.RegionName = name; + regInfo.RegionID = id; + + AgentCircuitManager acm = new AgentCircuitManager(); + SceneCommunicationService scs = new SceneCommunicationService(); + + ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null); + IEstateDataService estateDataService = null; + IConfigSource configSource = new IniConfigSource(); + + TestScene testScene = new TestScene( + regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); + + IRegionModule godsModule = new GodsModule(); + godsModule.Initialise(testScene, new IniConfigSource()); + testScene.AddModule(godsModule.Name, godsModule); + + LocalAssetServicesConnector assetService = StartAssetService(testScene); + StartAuthenticationService(testScene); + LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); + StartGridService(testScene); + LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); + LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); + + inventoryService.PostInitialise(); + assetService.PostInitialise(); + userAccountService.PostInitialise(); + presenceService.PostInitialise(); + + testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); + testScene.SetModuleInterfaces(); + + testScene.LandChannel = new TestLandChannel(testScene); + testScene.LoadWorldMap(); + + PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); + physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); + testScene.PhysicsScene + = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); + + testScene.RegionInfo.EstateSettings = new EstateSettings(); + testScene.LoginsDisabled = false; + + return testScene; + } + + private static LocalAssetServicesConnector StartAssetService(Scene testScene) + { + LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); + IConfigSource config = new IniConfigSource(); + + config.AddConfig("Modules"); + config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); + config.AddConfig("AssetService"); + config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); + config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); + + assetService.Initialise(config); + assetService.AddRegion(testScene); + assetService.RegionLoaded(testScene); + testScene.AddRegionModule(assetService.Name, assetService); + + return assetService; + } + + private static void StartAuthenticationService(Scene testScene) + { + ISharedRegionModule service = new LocalAuthenticationServicesConnector(); + IConfigSource config = new IniConfigSource(); + + config.AddConfig("Modules"); + config.AddConfig("AuthenticationService"); + config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); + config.Configs["AuthenticationService"].Set( + "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); + config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); + + service.Initialise(config); + service.AddRegion(testScene); + service.RegionLoaded(testScene); + testScene.AddRegionModule(service.Name, service); + //m_authenticationService = service; + } + + private static LocalInventoryServicesConnector StartInventoryService(Scene testScene) + { + LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); + + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + config.AddConfig("InventoryService"); + config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); + config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); + config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); + + inventoryService.Initialise(config); + inventoryService.AddRegion(testScene); + inventoryService.RegionLoaded(testScene); + testScene.AddRegionModule(inventoryService.Name, inventoryService); + + return inventoryService; + } + + private static LocalGridServicesConnector StartGridService(Scene testScene) + { + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + config.AddConfig("GridService"); + config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); + config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); + config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); + + LocalGridServicesConnector gridService = new LocalGridServicesConnector(); + gridService.Initialise(config); + gridService.AddRegion(testScene); + gridService.RegionLoaded(testScene); + + return gridService; + } + + /// + /// Start a user account service + /// + /// + /// + private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene) + { + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + config.AddConfig("UserAccountService"); + config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector"); + config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); + config.Configs["UserAccountService"].Set( + "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); + + LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector(); + userAccountService.Initialise(config); + + userAccountService.AddRegion(testScene); + userAccountService.RegionLoaded(testScene); + testScene.AddRegionModule(userAccountService.Name, userAccountService); + + return userAccountService; + } + + /// + /// Start a presence service + /// + /// + private static LocalPresenceServicesConnector StartPresenceService(Scene testScene) + { + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + config.AddConfig("PresenceService"); + config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector"); + config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); + config.Configs["PresenceService"].Set( + "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService"); + + LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector(); + presenceService.Initialise(config); + + presenceService.AddRegion(testScene); + presenceService.RegionLoaded(testScene); + testScene.AddRegionModule(presenceService.Name, presenceService); + + return presenceService; + } + + /// + /// Setup modules for a scene using their default settings. + /// + /// + /// + public static void SetupSceneModules(Scene scene, params object[] modules) + { + SetupSceneModules(scene, new IniConfigSource(), modules); + } + + /// + /// Setup modules for a scene. + /// + /// + /// + /// + public static void SetupSceneModules(Scene scene, IConfigSource config, params object[] modules) + { + List newModules = new List(); + foreach (object module in modules) + { + if (module is IRegionModule) + { + IRegionModule m = (IRegionModule)module; + m.Initialise(scene, config); + scene.AddModule(m.Name, m); + m.PostInitialise(); + } + else if (module is IRegionModuleBase) + { + // for the new system, everything has to be initialised first, + // shared modules have to be post-initialised, then all get an AddRegion with the scene + IRegionModuleBase m = (IRegionModuleBase)module; + m.Initialise(config); + newModules.Add(m); + } + } + + foreach (IRegionModuleBase module in newModules) + { + if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise(); + } + + foreach (IRegionModuleBase module in newModules) + { + module.AddRegion(scene); + scene.AddRegionModule(module.Name, module); + } + + // RegionLoaded is fired after all modules have been appropriately added to all scenes + foreach (IRegionModuleBase module in newModules) + module.RegionLoaded(scene); + + scene.SetModuleInterfaces(); + } + + /// + /// Generate some standard agent connection data. + /// + /// + /// + public static AgentCircuitData GenerateAgentData(UUID agentId) + { + string firstName = "testfirstname"; + + AgentCircuitData agentData = new AgentCircuitData(); + agentData.AgentID = agentId; + agentData.firstname = firstName; + agentData.lastname = "testlastname"; + agentData.SessionID = UUID.Zero; + agentData.SecureSessionID = UUID.Zero; + agentData.circuitcode = 123; + agentData.BaseFolder = UUID.Zero; + agentData.InventoryFolder = UUID.Zero; + agentData.startpos = Vector3.Zero; + agentData.CapsPath = "http://wibble.com"; + + return agentData; + } + + /// + /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test + /// + /// + /// + /// + public static TestClient AddClient(Scene scene, UUID agentId) + { + return AddClient(scene, GenerateAgentData(agentId)); + } + + /// + /// Add a root agent. + /// + /// + /// This function + /// + /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the + /// userserver if grid) would give initial login data back to the client and separately tell the scene that the + /// agent was coming. + /// + /// 2) Connects the agent with the scene + /// + /// This function performs actions equivalent with notifying the scene that an agent is + /// coming and then actually connecting the agent to the scene. The one step missed out is the very first + /// + /// + /// + /// + public static TestClient AddClient(Scene scene, AgentCircuitData agentData) + { + string reason; + + // We emulate the proper login sequence here by doing things in four stages + + // Stage 0: log the presence + scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); + + // Stage 1: simulate login by telling the scene to expect a new user connection + if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) + Console.WriteLine("NewUserConnection failed: " + reason); + + // Stage 2: add the new client as a child agent to the scene + TestClient client = new TestClient(agentData, scene); + scene.AddNewClient(client); + + // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. + ScenePresence scp = scene.GetScenePresence(agentData.AgentID); + scp.CompleteMovement(client); + //scp.MakeRootAgent(new Vector3(90, 90, 90), true); + + return client; + } + + /// + /// Add a test object + /// + /// + /// + public static SceneObjectPart AddSceneObject(Scene scene) + { + return AddSceneObject(scene, "Test Object"); + } + + /// + /// Add a test object + /// + /// + /// + /// + public static SceneObjectPart AddSceneObject(Scene scene, string name) + { + SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), UUID.Zero); + + //part.UpdatePrimFlags(false, false, true); + //part.ObjectFlags |= (uint)PrimFlags.Phantom; + + scene.AddNewSceneObject(new SceneObjectGroup(part), false); + + return part; + } + + /// + /// Create a scene object part. + /// + /// + /// + /// + /// + public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) + { + return new SceneObjectPart( + ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) }; + } + + /// + /// Create a scene object but do not add it to the scene. + /// + /// + /// UUID always starts at 00000000-0000-0000-0000-000000000001 + /// + /// The number of parts that should be in the scene object + /// + /// + public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) + { + return CreateSceneObject(parts, ownerId, "", 0x1); + } + + /// + /// Create a scene object but do not add it to the scene. + /// + /// + /// The number of parts that should be in the scene object + /// + /// + /// + /// The prefix to be given to part names. This will be suffixed with "Part" + /// (e.g. mynamePart0 for the root part) + /// + /// + /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" + /// will be given to the root part, and incremented for each part thereafter. + /// + /// + public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, string partNamePrefix, int uuidTail) + { + string rawSogId = string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail); + + SceneObjectGroup sog + = new SceneObjectGroup( + CreateSceneObjectPart(string.Format("{0}Part0", partNamePrefix), new UUID(rawSogId), ownerId)); + + if (parts > 1) + for (int i = 1; i < parts; i++) + sog.AddPart( + CreateSceneObjectPart( + string.Format("{0}Part{1}", partNamePrefix, i), + new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i)), + ownerId)); + + return sog; + } + } +} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs deleted file mode 100644 index 70621d5..0000000 --- a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Net; -using System.Collections.Generic; -using Nini.Config; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.CoreModules.Avatar.Gods; -using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; -using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; -using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; -using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; -using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; -using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; -using OpenSim.Services.Interfaces; -using OpenSim.Tests.Common.Mock; - -namespace OpenSim.Tests.Common -{ - /// - /// Helpers for setting up scenes. - /// - public class SceneSetupHelpers - { - /// - /// Set up a test scene - /// - /// - /// Automatically starts service threads, as would the normal runtime. - /// - /// - public static TestScene SetupScene() - { - return SetupScene("Unit test region", UUID.Random(), 1000, 1000); - } - - /// - /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions - /// or a different, to get a brand new scene with new shared region modules. - /// - /// Name of the region - /// ID of the region - /// X co-ordinate of the region - /// Y co-ordinate of the region - /// This should be the same if simulating two scenes within a standalone - /// - public static TestScene SetupScene(string name, UUID id, uint x, uint y) - { - Console.WriteLine("Setting up test scene {0}", name); - - // We must set up a console otherwise setup of some modules may fail - MainConsole.Instance = new MockConsole("TEST PROMPT"); - - RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); - regInfo.RegionName = name; - regInfo.RegionID = id; - - AgentCircuitManager acm = new AgentCircuitManager(); - SceneCommunicationService scs = new SceneCommunicationService(); - - ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null); - IEstateDataService estateDataService = null; - IConfigSource configSource = new IniConfigSource(); - - TestScene testScene = new TestScene( - regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); - - IRegionModule godsModule = new GodsModule(); - godsModule.Initialise(testScene, new IniConfigSource()); - testScene.AddModule(godsModule.Name, godsModule); - - LocalAssetServicesConnector assetService = StartAssetService(testScene); - StartAuthenticationService(testScene); - LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); - StartGridService(testScene); - LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); - LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); - - inventoryService.PostInitialise(); - assetService.PostInitialise(); - userAccountService.PostInitialise(); - presenceService.PostInitialise(); - - testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); - testScene.SetModuleInterfaces(); - - testScene.LandChannel = new TestLandChannel(testScene); - testScene.LoadWorldMap(); - - PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); - testScene.PhysicsScene - = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); - - testScene.RegionInfo.EstateSettings = new EstateSettings(); - testScene.LoginsDisabled = false; - - return testScene; - } - - private static LocalAssetServicesConnector StartAssetService(Scene testScene) - { - LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); - IConfigSource config = new IniConfigSource(); - - config.AddConfig("Modules"); - config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); - config.AddConfig("AssetService"); - config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); - config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); - - assetService.Initialise(config); - assetService.AddRegion(testScene); - assetService.RegionLoaded(testScene); - testScene.AddRegionModule(assetService.Name, assetService); - - return assetService; - } - - private static void StartAuthenticationService(Scene testScene) - { - ISharedRegionModule service = new LocalAuthenticationServicesConnector(); - IConfigSource config = new IniConfigSource(); - - config.AddConfig("Modules"); - config.AddConfig("AuthenticationService"); - config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); - config.Configs["AuthenticationService"].Set( - "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); - config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); - - service.Initialise(config); - service.AddRegion(testScene); - service.RegionLoaded(testScene); - testScene.AddRegionModule(service.Name, service); - //m_authenticationService = service; - } - - private static LocalInventoryServicesConnector StartInventoryService(Scene testScene) - { - LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); - - IConfigSource config = new IniConfigSource(); - config.AddConfig("Modules"); - config.AddConfig("InventoryService"); - config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); - config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); - config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); - - inventoryService.Initialise(config); - inventoryService.AddRegion(testScene); - inventoryService.RegionLoaded(testScene); - testScene.AddRegionModule(inventoryService.Name, inventoryService); - - return inventoryService; - } - - private static LocalGridServicesConnector StartGridService(Scene testScene) - { - IConfigSource config = new IniConfigSource(); - config.AddConfig("Modules"); - config.AddConfig("GridService"); - config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); - config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); - config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); - - LocalGridServicesConnector gridService = new LocalGridServicesConnector(); - gridService.Initialise(config); - gridService.AddRegion(testScene); - gridService.RegionLoaded(testScene); - - return gridService; - } - - /// - /// Start a user account service - /// - /// - /// - private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene) - { - IConfigSource config = new IniConfigSource(); - config.AddConfig("Modules"); - config.AddConfig("UserAccountService"); - config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector"); - config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); - config.Configs["UserAccountService"].Set( - "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); - - LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector(); - userAccountService.Initialise(config); - - userAccountService.AddRegion(testScene); - userAccountService.RegionLoaded(testScene); - testScene.AddRegionModule(userAccountService.Name, userAccountService); - - return userAccountService; - } - - /// - /// Start a presence service - /// - /// - private static LocalPresenceServicesConnector StartPresenceService(Scene testScene) - { - IConfigSource config = new IniConfigSource(); - config.AddConfig("Modules"); - config.AddConfig("PresenceService"); - config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector"); - config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); - config.Configs["PresenceService"].Set( - "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService"); - - LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector(); - presenceService.Initialise(config); - - presenceService.AddRegion(testScene); - presenceService.RegionLoaded(testScene); - testScene.AddRegionModule(presenceService.Name, presenceService); - - return presenceService; - } - - /// - /// Setup modules for a scene using their default settings. - /// - /// - /// - public static void SetupSceneModules(Scene scene, params object[] modules) - { - SetupSceneModules(scene, new IniConfigSource(), modules); - } - - /// - /// Setup modules for a scene. - /// - /// - /// - /// - public static void SetupSceneModules(Scene scene, IConfigSource config, params object[] modules) - { - List newModules = new List(); - foreach (object module in modules) - { - if (module is IRegionModule) - { - IRegionModule m = (IRegionModule)module; - m.Initialise(scene, config); - scene.AddModule(m.Name, m); - m.PostInitialise(); - } - else if (module is IRegionModuleBase) - { - // for the new system, everything has to be initialised first, - // shared modules have to be post-initialised, then all get an AddRegion with the scene - IRegionModuleBase m = (IRegionModuleBase)module; - m.Initialise(config); - newModules.Add(m); - } - } - - foreach (IRegionModuleBase module in newModules) - { - if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise(); - } - - foreach (IRegionModuleBase module in newModules) - { - module.AddRegion(scene); - scene.AddRegionModule(module.Name, module); - } - - // RegionLoaded is fired after all modules have been appropriately added to all scenes - foreach (IRegionModuleBase module in newModules) - module.RegionLoaded(scene); - - scene.SetModuleInterfaces(); - } - - /// - /// Generate some standard agent connection data. - /// - /// - /// - public static AgentCircuitData GenerateAgentData(UUID agentId) - { - string firstName = "testfirstname"; - - AgentCircuitData agentData = new AgentCircuitData(); - agentData.AgentID = agentId; - agentData.firstname = firstName; - agentData.lastname = "testlastname"; - agentData.SessionID = UUID.Zero; - agentData.SecureSessionID = UUID.Zero; - agentData.circuitcode = 123; - agentData.BaseFolder = UUID.Zero; - agentData.InventoryFolder = UUID.Zero; - agentData.startpos = Vector3.Zero; - agentData.CapsPath = "http://wibble.com"; - - return agentData; - } - - /// - /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test - /// - /// - /// - /// - public static TestClient AddClient(Scene scene, UUID agentId) - { - return AddClient(scene, GenerateAgentData(agentId)); - } - - /// - /// Add a root agent. - /// - /// - /// This function - /// - /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the - /// userserver if grid) would give initial login data back to the client and separately tell the scene that the - /// agent was coming. - /// - /// 2) Connects the agent with the scene - /// - /// This function performs actions equivalent with notifying the scene that an agent is - /// coming and then actually connecting the agent to the scene. The one step missed out is the very first - /// - /// - /// - /// - public static TestClient AddClient(Scene scene, AgentCircuitData agentData) - { - string reason; - - // We emulate the proper login sequence here by doing things in four stages - - // Stage 0: log the presence - scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); - - // Stage 1: simulate login by telling the scene to expect a new user connection - if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) - Console.WriteLine("NewUserConnection failed: " + reason); - - // Stage 2: add the new client as a child agent to the scene - TestClient client = new TestClient(agentData, scene); - scene.AddNewClient(client); - - // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. - ScenePresence scp = scene.GetScenePresence(agentData.AgentID); - scp.CompleteMovement(client); - //scp.MakeRootAgent(new Vector3(90, 90, 90), true); - - return client; - } - - /// - /// Add a test object - /// - /// - /// - public static SceneObjectPart AddSceneObject(Scene scene) - { - return AddSceneObject(scene, "Test Object"); - } - - /// - /// Add a test object - /// - /// - /// - /// - public static SceneObjectPart AddSceneObject(Scene scene, string name) - { - SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), UUID.Zero); - - //part.UpdatePrimFlags(false, false, true); - //part.ObjectFlags |= (uint)PrimFlags.Phantom; - - scene.AddNewSceneObject(new SceneObjectGroup(part), false); - - return part; - } - - /// - /// Create a scene object part. - /// - /// - /// - /// - /// - public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) - { - return new SceneObjectPart( - ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) }; - } - - /// - /// Create a scene object but do not add it to the scene. - /// - /// - /// UUID always starts at 00000000-0000-0000-0000-000000000001 - /// - /// The number of parts that should be in the scene object - /// - /// - public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) - { - return CreateSceneObject(parts, ownerId, "", 0x1); - } - - /// - /// Create a scene object but do not add it to the scene. - /// - /// - /// The number of parts that should be in the scene object - /// - /// - /// - /// The prefix to be given to part names. This will be suffixed with "Part" - /// (e.g. mynamePart0 for the root part) - /// - /// - /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" - /// will be given to the root part, and incremented for each part thereafter. - /// - /// - public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, string partNamePrefix, int uuidTail) - { - string rawSogId = string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail); - - SceneObjectGroup sog - = new SceneObjectGroup( - CreateSceneObjectPart(string.Format("{0}Part0", partNamePrefix), new UUID(rawSogId), ownerId)); - - if (parts > 1) - for (int i = 1; i < parts; i++) - sog.AddPart( - CreateSceneObjectPart( - string.Format("{0}Part{1}", partNamePrefix, i), - new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i)), - ownerId)); - - return sog; - } - } -} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index 5215c34..a8f0d59 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs @@ -74,7 +74,7 @@ namespace OpenSim.Tests.Common /// public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id) { - SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); + SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); scene.AssetService.Store(taskSceneObjectAsset); TaskInventoryItem taskSceneObjectItem -- cgit v1.1 From dad1d6df181151ae45fb998447b58d5589459627 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 00:31:03 +0100 Subject: rename TestHelper => TestHelpers for consistency --- OpenSim/Data/Tests/AssetTests.cs | 6 +- OpenSim/Data/Tests/EstateTests.cs | 16 ++--- OpenSim/Data/Tests/InventoryTests.cs | 26 ++++---- OpenSim/Data/Tests/RegionTests.cs | 40 ++++++------ OpenSim/Framework/Tests/UtilTest.cs | 8 +-- .../Asset/Tests/FlotsamAssetCacheTests.cs | 12 ++-- .../Tests/AvatarFactoryModuleTests.cs | 6 +- .../Archiver/Tests/InventoryArchiverTests.cs | 14 ++--- .../Avatar/Inventory/Archiver/Tests/PathTests.cs | 14 ++--- .../Tests/InventoryAccessModuleTests.cs | 4 +- .../World/Archiver/Tests/ArchiverTests.cs | 10 +-- .../World/Land/Tests/PrimCountModuleTests.cs | 18 +++--- .../World/Media/Moap/Tests/MoapTests.cs | 4 +- .../World/Serialiser/Tests/SerialiserTests.cs | 8 +-- .../Framework/Scenes/Tests/AttachmentTests.cs | 8 +-- .../Region/Framework/Scenes/Tests/BorderTests.cs | 8 +-- .../Framework/Scenes/Tests/EntityManagerTests.cs | 4 +- .../Framework/Scenes/Tests/SceneGraphTests.cs | 2 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 8 +-- .../Scenes/Tests/SceneObjectDeRezTests.cs | 4 +- .../Scenes/Tests/SceneObjectLinkingTests.cs | 8 +-- .../Scenes/Tests/SceneObjectResizeTests.cs | 4 +- .../Scenes/Tests/SceneObjectStatusTests.cs | 2 +- .../Scenes/Tests/SceneObjectUserGroupTests.cs | 2 +- .../Framework/Scenes/Tests/ScenePresenceTests.cs | 14 ++--- .../Region/Framework/Scenes/Tests/SceneTests.cs | 2 +- .../Scenes/Tests/StandaloneTeleportTests.cs | 2 +- .../Framework/Scenes/Tests/TaskInventoryTests.cs | 6 +- .../Framework/Scenes/Tests/UserInventoryTests.cs | 4 +- .../Framework/Scenes/Tests/UuidGathererTests.cs | 4 +- .../Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | 2 +- .../World/NPC/Tests/NPCModuleTests.cs | 10 +-- OpenSim/Tests/Common/TestHelper.cs | 71 ---------------------- OpenSim/Tests/Common/TestHelpers.cs | 71 ++++++++++++++++++++++ 34 files changed, 211 insertions(+), 211 deletions(-) delete mode 100644 OpenSim/Tests/Common/TestHelper.cs create mode 100644 OpenSim/Tests/Common/TestHelpers.cs diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs index b5ae244..1174e2f 100644 --- a/OpenSim/Data/Tests/AssetTests.cs +++ b/OpenSim/Data/Tests/AssetTests.cs @@ -106,7 +106,7 @@ namespace OpenSim.Data.Tests [Test] public void T001_LoadEmpty() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(m_db.ExistsAsset(uuid1), Is.False); Assert.That(m_db.ExistsAsset(uuid2), Is.False); @@ -116,7 +116,7 @@ namespace OpenSim.Data.Tests [Test] public void T010_StoreReadVerifyAssets() { - TestHelper.InMethod(); + TestHelpers.InMethod(); AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString()); AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString()); @@ -183,7 +183,7 @@ namespace OpenSim.Data.Tests [Test] public void T020_CheckForWeirdCreatorID() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // It is expected that eventually the CreatorID might be an arbitrary string (an URI) // rather than a valid UUID (?). This test is to make sure that the database layer does not diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs index 8d332da..3e47bcf 100644 --- a/OpenSim/Data/Tests/EstateTests.cs +++ b/OpenSim/Data/Tests/EstateTests.cs @@ -107,7 +107,7 @@ namespace OpenSim.Data.Tests [Test] public void T010_EstateSettingsSimpleStorage_MinimumParameterSet() { - TestHelper.InMethod(); + TestHelpers.InMethod(); EstateSettingsSimpleStorage( REGION_ID, @@ -140,7 +140,7 @@ namespace OpenSim.Data.Tests [Test] public void T011_EstateSettingsSimpleStorage_MaximumParameterSet() { - TestHelper.InMethod(); + TestHelpers.InMethod(); EstateSettingsSimpleStorage( REGION_ID, @@ -173,7 +173,7 @@ namespace OpenSim.Data.Tests [Test] public void T012_EstateSettingsSimpleStorage_AccurateParameterSet() { - TestHelper.InMethod(); + TestHelpers.InMethod(); EstateSettingsSimpleStorage( REGION_ID, @@ -206,7 +206,7 @@ namespace OpenSim.Data.Tests [Test] public void T012_EstateSettingsRandomStorage() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -227,7 +227,7 @@ namespace OpenSim.Data.Tests [Test] public void T020_EstateSettingsManagerList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -248,7 +248,7 @@ namespace OpenSim.Data.Tests [Test] public void T021_EstateSettingsUserList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -269,7 +269,7 @@ namespace OpenSim.Data.Tests [Test] public void T022_EstateSettingsGroupList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -290,7 +290,7 @@ namespace OpenSim.Data.Tests [Test] public void T022_EstateSettingsBanList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs index cf3bac1..5b6b61b 100644 --- a/OpenSim/Data/Tests/InventoryTests.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs @@ -114,7 +114,7 @@ namespace OpenSim.Data.Tests [Test] public void T001_LoadEmpty() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.getInventoryFolder(zero), Is.Null); Assert.That(db.getInventoryFolder(folder1), Is.Null); @@ -134,7 +134,7 @@ namespace OpenSim.Data.Tests [Test] public void T010_FolderNonParent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); // the folder will go in @@ -146,7 +146,7 @@ namespace OpenSim.Data.Tests [Test] public void T011_FolderCreate() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); // TODO: this is probably wrong behavior, but is what we have @@ -171,7 +171,7 @@ namespace OpenSim.Data.Tests [Test] public void T012_FolderList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); db.addInventoryFolder(f2); @@ -187,7 +187,7 @@ namespace OpenSim.Data.Tests [Test] public void T013_FolderHierarchy() { - TestHelper.InMethod(); + TestHelpers.InMethod(); int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); @@ -202,7 +202,7 @@ namespace OpenSim.Data.Tests [Test] public void T014_MoveFolder() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryFolderBase f2 = db.getInventoryFolder(folder2); f2.ParentID = folder3; @@ -218,7 +218,7 @@ namespace OpenSim.Data.Tests [Test] public void T015_FolderHierarchy() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); @@ -231,7 +231,7 @@ namespace OpenSim.Data.Tests [Test] public void T100_NoItems() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); @@ -245,7 +245,7 @@ namespace OpenSim.Data.Tests [Test] public void T101_CreatItems() { - TestHelper.InMethod(); + TestHelpers.InMethod(); db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); @@ -256,7 +256,7 @@ namespace OpenSim.Data.Tests [Test] public void T102_CompareItems() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryItemBase i1 = db.getInventoryItem(item1); InventoryItemBase i2 = db.getInventoryItem(item2); @@ -275,7 +275,7 @@ namespace OpenSim.Data.Tests [Test] public void T103_UpdateItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // TODO: probably shouldn't have the ability to have an // owner of an item in a folder not owned by the user @@ -295,7 +295,7 @@ namespace OpenSim.Data.Tests [Test] public void T104_RandomUpdateItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); PropertyScrambler folderScrambler = new PropertyScrambler() @@ -354,7 +354,7 @@ namespace OpenSim.Data.Tests [Test] public void T999_StillNull() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // After all tests are run, these should still return no results Assert.That(db.getInventoryFolder(zero), Is.Null); diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 44cf1ab..2b8fa59 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -151,7 +151,7 @@ namespace OpenSim.Data.Tests [Test] public void T001_LoadEmpty() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List objs = db.LoadObjects(region1); List objs3 = db.LoadObjects(region3); @@ -169,7 +169,7 @@ namespace OpenSim.Data.Tests [Test] public void T010_StoreSimpleObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); SceneObjectGroup sog = NewSOG("object1", prim1, region1); SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); @@ -204,7 +204,7 @@ namespace OpenSim.Data.Tests [Test] public void T011_ObjectNames() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List objs = db.LoadObjects(region1); foreach (SceneObjectGroup sog in objs) @@ -218,7 +218,7 @@ namespace OpenSim.Data.Tests [Test] public void T012_SceneParts() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID tmp0 = UUID.Random(); UUID tmp1 = UUID.Random(); @@ -253,7 +253,7 @@ namespace OpenSim.Data.Tests [Test] public void T013_DatabasePersistency() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored @@ -430,7 +430,7 @@ namespace OpenSim.Data.Tests [Test] public void T014_UpdateObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); string text1 = "object1 text"; SceneObjectGroup sog = FindSOG("object1", region1); @@ -540,7 +540,7 @@ namespace OpenSim.Data.Tests [Test] public void T015_LargeSceneObjects() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID id = UUID.Random(); Dictionary mydic = new Dictionary(); @@ -587,7 +587,7 @@ namespace OpenSim.Data.Tests //[Test] public void T016_RandomSogWithSceneParts() { - TestHelper.InMethod(); + TestHelpers.InMethod(); PropertyScrambler scrambler = new PropertyScrambler() @@ -663,7 +663,7 @@ namespace OpenSim.Data.Tests [Test] public void T020_PrimInventoryEmpty() { - TestHelper.InMethod(); + TestHelpers.InMethod(); SceneObjectGroup sog = GetMySOG("object1"); TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); @@ -687,7 +687,7 @@ namespace OpenSim.Data.Tests [Test] public void T021_PrimInventoryBasic() { - TestHelper.InMethod(); + TestHelpers.InMethod(); SceneObjectGroup sog = GetMySOG("object1"); InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); @@ -727,7 +727,7 @@ namespace OpenSim.Data.Tests [Test] public void T025_PrimInventoryPersistency() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryItemBase i = new InventoryItemBase(); UUID id = UUID.Random(); @@ -800,7 +800,7 @@ namespace OpenSim.Data.Tests [ExpectedException(typeof(ArgumentException))] public void T026_PrimInventoryMany() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID i1,i2,i3,i4; i1 = UUID.Random(); @@ -832,7 +832,7 @@ namespace OpenSim.Data.Tests [Test] public void T052_RemoveObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); db.RemoveObject(prim1, region1); SceneObjectGroup sog = FindSOG("object1", region1); @@ -842,7 +842,7 @@ namespace OpenSim.Data.Tests [Test] public void T100_DefaultRegionInfo() { - TestHelper.InMethod(); + TestHelpers.InMethod(); RegionSettings r1 = db.LoadRegionSettings(region1); Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); @@ -854,7 +854,7 @@ namespace OpenSim.Data.Tests [Test] public void T101_UpdateRegionInfo() { - TestHelper.InMethod(); + TestHelpers.InMethod(); int agentlimit = random.Next(); double objectbonus = random.Next(); @@ -960,7 +960,7 @@ namespace OpenSim.Data.Tests [Test] public void T300_NoTerrain() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.LoadTerrain(zero), Is.Null); Assert.That(db.LoadTerrain(region1), Is.Null); @@ -971,7 +971,7 @@ namespace OpenSim.Data.Tests [Test] public void T301_CreateTerrain() { - TestHelper.InMethod(); + TestHelpers.InMethod(); double[,] t1 = GenTerrain(height1); db.StoreTerrain(t1, region1); @@ -985,7 +985,7 @@ namespace OpenSim.Data.Tests [Test] public void T302_FetchTerrain() { - TestHelper.InMethod(); + TestHelpers.InMethod(); double[,] baseterrain1 = GenTerrain(height1); double[,] baseterrain2 = GenTerrain(height2); @@ -997,7 +997,7 @@ namespace OpenSim.Data.Tests [Test] public void T303_UpdateTerrain() { - TestHelper.InMethod(); + TestHelpers.InMethod(); double[,] baseterrain1 = GenTerrain(height1); double[,] baseterrain2 = GenTerrain(height2); @@ -1011,7 +1011,7 @@ namespace OpenSim.Data.Tests [Test] public void T400_EmptyLand() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs index 5eac411..c5a20e7 100644 --- a/OpenSim/Framework/Tests/UtilTest.cs +++ b/OpenSim/Framework/Tests/UtilTest.cs @@ -61,7 +61,7 @@ namespace OpenSim.Framework.Tests "Magnitude of vector was incorrect."); TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; - bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); + bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); Assert.That(causesArgumentException, Is.True, "Getting magnitude of null vector did not cause argument exception."); @@ -94,12 +94,12 @@ namespace OpenSim.Framework.Tests "Magnitude of vector was incorrect."); TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; - bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); + bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); Assert.That(causesArgumentException, Is.True, "Getting magnitude of null vector did not cause argument exception."); d = delegate() { Util.GetNormalizedVector(v2); }; - causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); + causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); Assert.That(causesArgumentException, Is.True, "Getting magnitude of null vector did not cause argument exception."); } @@ -122,7 +122,7 @@ namespace OpenSim.Framework.Tests "Magnitude of vector was incorrect."); TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; - bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); + bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); Assert.That(causesArgumentException, Is.True, "Getting magnitude of null vector did not cause argument exception."); diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index 1662f19..2ff1920 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs @@ -72,11 +72,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests [Test] public void TestCacheAsset() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); AssetBase asset = AssetHelpers.CreateAsset(); - asset.ID = TestHelper.ParseTail(0x1).ToString(); + asset.ID = TestHelpers.ParseTail(0x1).ToString(); // Check we don't get anything before the asset is put in the cache AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString()); @@ -93,11 +93,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests [Test] public void TestExpireAsset() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); AssetBase asset = AssetHelpers.CreateAsset(); - asset.ID = TestHelper.ParseTail(0x2).ToString(); + asset.ID = TestHelpers.ParseTail(0x2).ToString(); m_cache.Store(asset); @@ -110,11 +110,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests [Test] public void TestClearCache() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); AssetBase asset = AssetHelpers.CreateAsset(); - asset.ID = TestHelper.ParseTail(0x2).ToString(); + asset.ID = TestHelpers.ParseTail(0x2).ToString(); m_cache.Store(asset); diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index c05f5ab..4e83fa7 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -44,10 +44,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory [Test] public void TestSetAppearance() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - UUID userId = TestHelper.ParseTail(0x1); + UUID userId = TestHelpers.ParseTail(0x1); AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); @@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory for (byte i = 0; i < visualParams.Length; i++) visualParams[i] = i; - afm.SetAppearance(tc, new Primitive.TextureEntry(TestHelper.ParseTail(0x10)), visualParams); + afm.SetAppearance(tc, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); ScenePresence sp = scene.GetScenePresence(userId); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 3616ae2..e409c8e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadCoalesecedItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestOrder() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes); @@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestSaveItemToIar() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); // Create user @@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestSaveItemToIarNoAssets() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); // Create user @@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarCreatorAccountPresent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); @@ -357,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1SameNameCreator() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); @@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1AbsentCreator() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index 1d3e5d0..417c20c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestSavePathToIarV0_1() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); @@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarToInventoryPaths() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); @@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarPathStartsWithSlash() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); @@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarPathWithEscapedChars() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); string itemName = "You & you are a mean/man/"; @@ -323,7 +323,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestNewIarPath() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestPartExistingIarPath() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -441,7 +441,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestMergeIarPath() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 90b6481..e74310c 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests [Test] public void TestRezCoalescedObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); // Create asset @@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests [Test] public void TestRezObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); // Create asset diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 645113f..b185d9b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests [Test] public void TestSaveOar() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SceneObjectPart part1 = CreateSceneObjectPart1(); @@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests [Test] public void TestSaveOarNoAssets() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SceneObjectPart part1 = CreateSceneObjectPart1(); @@ -300,7 +300,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests [Test] public void TestLoadOar() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); @@ -409,7 +409,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests [Test] public void TestLoadOarRegionSettings() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); @@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests //[Test] public void TestMergeOar() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index fecbf67..e553ffa 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestAddOwnerObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestCopyOwnerObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestMoveOwnerObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); @@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestRemoveOwnerObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestAddGroupObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); m_lo.DeedToGroup(m_groupId); @@ -284,7 +284,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestRemoveGroupObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); m_lo.DeedToGroup(m_groupId); @@ -313,7 +313,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestAddOthersObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -334,7 +334,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestRemoveOthersObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -360,7 +360,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestTaint() { - TestHelper.InMethod(); + TestHelpers.InMethod(); IPrimCounts pc = m_lo.PrimCounts; SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index fe09739..4326606 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests [Test] public void TestClearMediaUrl() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); @@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests [Test] public void TestSetMediaUrl() { - TestHelper.InMethod(); + TestHelpers.InMethod(); string homeUrl = "opensimulator.org"; diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 93e38f8..d5b585a 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests [Test] public void TestDeserializeXml() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(xml); @@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests [Test] public void TestSerializeXml() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); string rpName = "My Little Donkey"; @@ -334,7 +334,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests [Test] public void TestDeserializeXml2() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(xml2); @@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests [Test] public void TestSerializeXml2() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); string rpName = "My Little Pony"; diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs index 85197db..fb28397 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs @@ -62,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [TestFixtureSetUp] public void Init() { - TestHelper.InMethod(); + TestHelpers.InMethod(); scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); @@ -89,7 +89,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T030_TestAddAttachments() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); @@ -104,7 +104,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T031_RemoveAttachments() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); presence.RemoveAttachment(sog1); @@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests //[Test] public void T032_CrossAttachments() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); ScenePresence presence2 = scene2.GetScenePresence(agent1); diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index 3a0dd00..ab6311b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCross() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List testborders = new List(); @@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCrossSquare512() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List testborders = new List(); @@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCrossRectangle512x256() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List testborders = new List(); @@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCrossOdd512x512w256hole() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List testborders = new List(); // 512____ diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index ebf595a..a5d2b23 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T010_AddObjects() { - TestHelper.InMethod(); + TestHelpers.InMethod(); random = new Random(); SceneObjectGroup found; @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T011_ThreadAddRemoveTest() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // This test adds and removes with mutiple threads, attempting to break the // uuid and localid dictionary coherence. diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index b7ff1b1..9a60e50 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDuplicateObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 8b4771b..ff55680 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestAddSceneObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); @@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests /// public void TestAddExistingSceneObjectUuid() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); @@ -110,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDeleteSceneObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); TestScene scene = SceneHelpers.SetupScene(); SceneObjectPart part = SceneHelpers.AddSceneObject(scene); @@ -126,7 +126,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDeleteSceneObjectAsync() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index d201510..c8a9ca3 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDeRezSceneObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); @@ -94,7 +94,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDeRezSceneObjectNotOwner() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index b09144d..2912a46 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestLinkDelink2SceneObjects() { - TestHelper.InMethod(); + TestHelpers.InMethod(); bool debugtest = false; @@ -132,7 +132,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestLinkDelink2groups4SceneObjects() { - TestHelper.InMethod(); + TestHelpers.InMethod(); bool debugtest = false; @@ -266,7 +266,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestNewSceneObjectLinkPersistence() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); TestScene scene = SceneHelpers.SetupScene(); @@ -305,7 +305,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDelinkPersistence() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); TestScene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 8630476..b49c6e7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestResizeSceneObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -72,7 +72,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestResizeSceneObjectPart() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index c2adb2a..2a342d5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestSetPhantom() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Scene scene = SceneSetupHelpers.SetupScene(); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index e0ab1c8..e604885 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestShareWithGroup() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 8af1b38..9b5f52f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [TestFixtureSetUp] public void Init() { - TestHelper.InMethod(); + TestHelpers.InMethod(); scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); @@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T010_TestAddRootAgent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); string firstName = "testfirstname"; @@ -135,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T011_TestRemoveRootAgent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); scene.RemoveClient(agent1); @@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T012_TestAddNeighbourRegion() { - TestHelper.InMethod(); + TestHelpers.InMethod(); string reason; @@ -175,7 +175,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T013_TestRemoveNeighbourRegion() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); presence.RemoveNeighbourRegion(region3); @@ -198,7 +198,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestChildAgentEstablished() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); @@ -230,7 +230,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests //[Test] public void T021_TestCrossToNewRegion() { - TestHelper.InMethod(); + TestHelpers.InMethod(); scene.RegisterRegionWithGrid(); scene2.RegisterRegionWithGrid(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 8ffb22e..8b8aea5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestUpdateScene() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); scene.Update(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index a3848a7..fb5a19f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests //[Test, LongRunning] public void TestSimpleNotNeighboursTeleport() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ThreadRunResults results = new ThreadRunResults(); results.Result = false; results.Message = "Test did not run"; diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index a61832a..1abef8d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestRezObjectFromInventoryItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -98,7 +98,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestMoveTaskInventoryItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestMoveTaskInventoryItemNoParent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index f6e2827..50b1a48 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestGiveInventoryItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -82,7 +82,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestGiveInventoryFolder() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index b0ea497..24de56e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCorruptAsset() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); AssetBase corruptAsset @@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestMissingAsset() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); IDictionary foundAssetUuids = new Dictionary(); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index 1e56a08..d2f6327 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests [Test] public void TestBasic() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); TestScene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index c0053c9..28fa8a2 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests [Test] public void TestCreate() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IConfigSource config = new IniConfigSource(); @@ -59,11 +59,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); - TestClient originalClient = SceneHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); + TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance - UUID originalFace8TextureId = TestHelper.ParseTail(0x10); + UUID originalFace8TextureId = TestHelpers.ParseTail(0x10); Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero); Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8); originalTef.TextureID = originalFace8TextureId; @@ -86,7 +86,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests [Test] public void TestMove() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IConfigSource config = new IniConfigSource(); @@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, new NPCModule()); - TestClient originalClient = SceneHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); + TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); diff --git a/OpenSim/Tests/Common/TestHelper.cs b/OpenSim/Tests/Common/TestHelper.cs deleted file mode 100644 index 86bd107..0000000 --- a/OpenSim/Tests/Common/TestHelper.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Diagnostics; -using NUnit.Framework; -using OpenMetaverse; - -namespace OpenSim.Tests.Common -{ - public class TestHelper - { - public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) - { - try - { - d(); - } - catch(ArgumentException) - { - return true; - } - - return false; - } - - /// - /// A debugging method that can be used to print out which test method you are in - /// - public static void InMethod() - { - StackTrace stackTrace = new StackTrace(); - Console.WriteLine(); - Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name); - } - - /// - /// Parse tail section into full UUID. - /// - /// - /// - public static UUID ParseTail(int tail) - { - return new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", tail)); - } - } -} diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs new file mode 100644 index 0000000..ced06de --- /dev/null +++ b/OpenSim/Tests/Common/TestHelpers.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Diagnostics; +using NUnit.Framework; +using OpenMetaverse; + +namespace OpenSim.Tests.Common +{ + public class TestHelpers + { + public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) + { + try + { + d(); + } + catch(ArgumentException) + { + return true; + } + + return false; + } + + /// + /// A debugging method that can be used to print out which test method you are in + /// + public static void InMethod() + { + StackTrace stackTrace = new StackTrace(); + Console.WriteLine(); + Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name); + } + + /// + /// Parse tail section into full UUID. + /// + /// + /// + public static UUID ParseTail(int tail) + { + return new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", tail)); + } + } +} -- cgit v1.1 From 76f46b25454c0c9376130a59cc1b766c0d105dd0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 01:15:49 +0100 Subject: Do proper locking of m_localScenes list in SceneManager --- OpenSim/Region/Framework/Scenes/SceneManager.cs | 233 +++++++++++++-------- .../HypergridService/HGInstantMessageService.cs | 7 +- 2 files changed, 143 insertions(+), 97 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 86ba2aa..069367d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -47,12 +47,12 @@ namespace OpenSim.Region.Framework.Scenes public event RestartSim OnRestartSim; - private readonly List m_localScenes; + private readonly List m_localScenes = new List(); private Scene m_currentScene = null; public List Scenes { - get { return m_localScenes; } + get { return new List(m_localScenes); } } public Scene CurrentScene @@ -66,13 +66,12 @@ namespace OpenSim.Region.Framework.Scenes { if (m_currentScene == null) { - if (m_localScenes.Count > 0) + lock (m_localScenes) { - return m_localScenes[0]; - } - else - { - return null; + if (m_localScenes.Count > 0) + return m_localScenes[0]; + else + return null; } } else @@ -82,26 +81,25 @@ namespace OpenSim.Region.Framework.Scenes } } - public SceneManager() - { - m_localScenes = new List(); - } - public void Close() { // collect known shared modules in sharedModules Dictionary sharedModules = new Dictionary(); - for (int i = 0; i < m_localScenes.Count; i++) + + lock (m_localScenes) { - // extract known shared modules from scene - foreach (string k in m_localScenes[i].Modules.Keys) + for (int i = 0; i < m_localScenes.Count; i++) { - if (m_localScenes[i].Modules[k].IsSharedModule && - !sharedModules.ContainsKey(k)) - sharedModules[k] = m_localScenes[i].Modules[k]; + // extract known shared modules from scene + foreach (string k in m_localScenes[i].Modules.Keys) + { + if (m_localScenes[i].Modules[k].IsSharedModule && + !sharedModules.ContainsKey(k)) + sharedModules[k] = m_localScenes[i].Modules[k]; + } + // close scene/region + m_localScenes[i].Close(); } - // close scene/region - m_localScenes[i].Close(); } // all regions/scenes are now closed, we can now safely @@ -114,13 +112,16 @@ namespace OpenSim.Region.Framework.Scenes public void Close(Scene cscene) { - if (m_localScenes.Contains(cscene)) + lock (m_localScenes) { - for (int i = 0; i < m_localScenes.Count; i++) + if (m_localScenes.Contains(cscene)) { - if (m_localScenes[i].Equals(cscene)) + for (int i = 0; i < m_localScenes.Count; i++) { - m_localScenes[i].Close(); + if (m_localScenes[i].Equals(cscene)) + { + m_localScenes[i].Close(); + } } } } @@ -129,27 +130,33 @@ namespace OpenSim.Region.Framework.Scenes public void Add(Scene scene) { scene.OnRestart += HandleRestart; - m_localScenes.Add(scene); + + lock (m_localScenes) + m_localScenes.Add(scene); } public void HandleRestart(RegionInfo rdata) { m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); int RegionSceneElement = -1; - for (int i = 0; i < m_localScenes.Count; i++) + + lock (m_localScenes) { - if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) + for (int i = 0; i < m_localScenes.Count; i++) { - RegionSceneElement = i; + if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) + { + RegionSceneElement = i; + } } - } - // Now we make sure the region is no longer known about by the SceneManager - // Prevents duplicates. + // Now we make sure the region is no longer known about by the SceneManager + // Prevents duplicates. - if (RegionSceneElement >= 0) - { - m_localScenes.RemoveAt(RegionSceneElement); + if (RegionSceneElement >= 0) + { + m_localScenes.RemoveAt(RegionSceneElement); + } } // Send signal to main that we're restarting this sim. @@ -160,28 +167,32 @@ namespace OpenSim.Region.Framework.Scenes { RegionInfo Result = null; - for (int i = 0; i < m_localScenes.Count; i++) - { - if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle) - { - // Inform other regions to tell their avatar about me - Result = m_localScenes[i].RegionInfo; - } - } - if (Result != null) + lock (m_localScenes) { for (int i = 0; i < m_localScenes.Count; i++) { - if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) + if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle) { // Inform other regions to tell their avatar about me - //m_localScenes[i].OtherRegionUp(Result); + Result = m_localScenes[i].RegionInfo; } } - } - else - { - m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up"); + + if (Result != null) + { + for (int i = 0; i < m_localScenes.Count; i++) + { + if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) + { + // Inform other regions to tell their avatar about me + //m_localScenes[i].OtherRegionUp(Result); + } + } + } + else + { + m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up"); + } } } @@ -285,7 +296,8 @@ namespace OpenSim.Region.Framework.Scenes { if (m_currentScene == null) { - m_localScenes.ForEach(func); + lock (m_localScenes) + m_localScenes.ForEach(func); } else { @@ -314,12 +326,15 @@ namespace OpenSim.Region.Framework.Scenes } else { - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) + foreach (Scene scene in m_localScenes) { - m_currentScene = scene; - return true; + if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) + { + m_currentScene = scene; + return true; + } } } @@ -331,12 +346,15 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Debug("Searching for Region: '" + regionID + "'"); - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (scene.RegionInfo.RegionID == regionID) + foreach (Scene scene in m_localScenes) { - m_currentScene = scene; - return true; + if (scene.RegionInfo.RegionID == regionID) + { + m_currentScene = scene; + return true; + } } } @@ -345,26 +363,33 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetScene(string regionName, out Scene scene) { - foreach (Scene mscene in m_localScenes) + lock (m_localScenes) { - if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) + foreach (Scene mscene in m_localScenes) { - scene = mscene; - return true; + if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) + { + scene = mscene; + return true; + } } } + scene = null; return false; } public bool TryGetScene(UUID regionID, out Scene scene) { - foreach (Scene mscene in m_localScenes) + lock (m_localScenes) { - if (mscene.RegionInfo.RegionID == regionID) + foreach (Scene mscene in m_localScenes) { - scene = mscene; - return true; + if (mscene.RegionInfo.RegionID == regionID) + { + scene = mscene; + return true; + } } } @@ -374,13 +399,16 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetScene(uint locX, uint locY, out Scene scene) { - foreach (Scene mscene in m_localScenes) + lock (m_localScenes) { - if (mscene.RegionInfo.RegionLocX == locX && - mscene.RegionInfo.RegionLocY == locY) + foreach (Scene mscene in m_localScenes) { - scene = mscene; - return true; + if (mscene.RegionInfo.RegionLocX == locX && + mscene.RegionInfo.RegionLocY == locY) + { + scene = mscene; + return true; + } } } @@ -390,13 +418,16 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene) { - foreach (Scene mscene in m_localScenes) + lock (m_localScenes) { - if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) && - (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port)) + foreach (Scene mscene in m_localScenes) { - scene = mscene; - return true; + if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) && + (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port)) + { + scene = mscene; + return true; + } } } @@ -465,11 +496,14 @@ namespace OpenSim.Region.Framework.Scenes public RegionInfo GetRegionInfo(UUID regionID) { - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (scene.RegionInfo.RegionID == regionID) + foreach (Scene scene in m_localScenes) { - return scene.RegionInfo; + if (scene.RegionInfo.RegionID == regionID) + { + return scene.RegionInfo; + } } } @@ -488,11 +522,14 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) { - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (scene.TryGetScenePresence(avatarId, out avatar)) + foreach (Scene scene in m_localScenes) { - return true; + if (scene.TryGetScenePresence(avatarId, out avatar)) + { + return true; + } } } @@ -503,12 +540,16 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetAvatarsScene(UUID avatarId, out Scene scene) { ScenePresence avatar = null; - foreach (Scene mScene in m_localScenes) + + lock (m_localScenes) { - if (mScene.TryGetScenePresence(avatarId, out avatar)) + foreach (Scene mScene in m_localScenes) { - scene = mScene; - return true; + if (mScene.TryGetScenePresence(avatarId, out avatar)) + { + scene = mScene; + return true; + } } } @@ -518,17 +559,22 @@ namespace OpenSim.Region.Framework.Scenes public void CloseScene(Scene scene) { - m_localScenes.Remove(scene); + lock (m_localScenes) + m_localScenes.Remove(scene); + scene.Close(); } public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) { - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (scene.TryGetAvatarByName(avatarName, out avatar)) + foreach (Scene scene in m_localScenes) { - return true; + if (scene.TryGetAvatarByName(avatarName, out avatar)) + { + return true; + } } } @@ -538,7 +584,8 @@ namespace OpenSim.Region.Framework.Scenes public void ForEachScene(Action action) { - m_localScenes.ForEach(action); + lock (m_localScenes) + m_localScenes.ForEach(action); } } -} +} \ No newline at end of file diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index bb31fc9..0d59636 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs @@ -95,7 +95,6 @@ namespace OpenSim.Services.HypergridService m_InGatekeeper = serverConfig.GetBoolean("InGatekeeper", false); m_log.DebugFormat("[HG IM SERVICE]: Starting... InRobust? {0}", m_InGatekeeper); - if (gridService == string.Empty || presenceService == string.Empty) throw new Exception(String.Format("Incomplete specifications, InstantMessage Service cannot function.")); @@ -120,7 +119,7 @@ namespace OpenSim.Services.HypergridService public bool IncomingInstantMessage(GridInstantMessage im) { - m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID); +// m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID); UUID toAgentID = new UUID(im.toAgentID); bool success = false; @@ -142,7 +141,7 @@ namespace OpenSim.Services.HypergridService public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner) { - m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url); +// m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url); if (url != string.Empty) return TrySendInstantMessage(im, url, true, foreigner); else @@ -333,7 +332,7 @@ namespace OpenSim.Services.HypergridService if (m_RestURL != string.Empty && (im.offline != 0) && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) { - m_log.DebugFormat("[HG IM SERVICE]: Message saved"); +// m_log.DebugFormat("[HG IM SERVICE]: Message saved"); return SynchronousRestObjectRequester.MakeRequest( "POST", m_RestURL + "/SaveMessage/", im); -- cgit v1.1 From 2b26d2f1a54686ed6a03efc26bf75002f80d42ee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 01:35:01 +0100 Subject: prevent "create region" console command from being able to create a region with the same id as one that already exists. Addresses http://opensimulator.org/mantis/view.php?id=5617 --- OpenSim/Region/Application/OpenSim.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 259d753..fe1525b 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -549,6 +549,7 @@ namespace OpenSim { string regionName = string.Empty; string regionFile = string.Empty; + if (cmd.Length == 3) { regionFile = cmd[2]; @@ -558,14 +559,17 @@ namespace OpenSim regionName = cmd[2]; regionFile = cmd[3]; } + string extension = Path.GetExtension(regionFile).ToLower(); bool isXml = extension.Equals(".xml"); bool isIni = extension.Equals(".ini"); + if (!isXml && !isIni) { MainConsole.Instance.Output("Usage: create region [\"region name\"] "); return; } + if (!Path.IsPathRooted(regionFile)) { string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); @@ -582,8 +586,18 @@ namespace OpenSim regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); } - IScene scene; + Scene existingScene; + if (SceneManager.TryGetScene(regInfo.RegionID, out existingScene)) + { + MainConsole.Instance.OutputFormat( + "ERROR: Cannot create region {0} with ID {1}, this ID is already assigned to region {2}", + regInfo.RegionName, regInfo.RegionID, existingScene.RegionInfo.RegionName); + + return; + } + PopulateRegionEstateInfo(regInfo); + IScene scene; CreateRegion(regInfo, true, out scene); regInfo.EstateSettings.Save(); } -- cgit v1.1 From 83ba35a26bbbc844f4fd0f4964f3bc6155561e31 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 02:01:25 +0100 Subject: rip out sog generation methods in ScenePresenceAgentTests and use SceneHelpers instead Not that it matters, since these tests are pretty bogus anyway. Also, renames some test classes for consistency. --- .../Scenes/Tests/ScenePresenceAgentTests.cs | 355 +++++++++++++++++++ .../Scenes/Tests/ScenePresenceTeleportTests.cs | 196 +++++++++++ .../Framework/Scenes/Tests/ScenePresenceTests.cs | 385 --------------------- .../Scenes/Tests/StandaloneTeleportTests.cs | 196 ----------- 4 files changed, 551 insertions(+), 581 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs create mode 100644 OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs new file mode 100644 index 0000000..04f5817 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -0,0 +1,355 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Timers; +using Timer=System.Timers.Timer; +using Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.CoreModules.Framework.EntityTransfer; +using OpenSim.Region.CoreModules.World.Serialiser; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Scene presence tests + /// + [TestFixture] + public class ScenePresenceAgentTests + { + public Scene scene, scene2, scene3; + public UUID agent1, agent2, agent3; + public static Random random; + public ulong region1,region2,region3; + public AgentCircuitData acd1; + public SceneObjectGroup sog1, sog2, sog3; + public TestClient testclient; + + [TestFixtureSetUp] + public void Init() + { + TestHelpers.InMethod(); + + scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); + + ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); + interregionComms.Initialise(new IniConfigSource()); + interregionComms.PostInitialise(); + SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); + + agent1 = UUID.Random(); + agent2 = UUID.Random(); + agent3 = UUID.Random(); + random = new Random(); + sog1 = SceneHelpers.CreateSceneObject(1, agent1); + scene.AddSceneObject(sog1); + sog2 = SceneHelpers.CreateSceneObject(1, agent1); + scene.AddSceneObject(sog2); + sog3 = SceneHelpers.CreateSceneObject(1, agent1); + scene.AddSceneObject(sog3); + + region1 = scene.RegionInfo.RegionHandle; + region2 = scene2.RegionInfo.RegionHandle; + region3 = scene3.RegionInfo.RegionHandle; + } + + /// + /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. + /// + [Test] + public void T010_TestAddRootAgent() + { + TestHelpers.InMethod(); + + string firstName = "testfirstname"; + + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = agent1; + agent.firstname = firstName; + agent.lastname = "testlastname"; + agent.SessionID = UUID.Random(); + agent.SecureSessionID = UUID.Random(); + agent.circuitcode = 123; + agent.BaseFolder = UUID.Zero; + agent.InventoryFolder = UUID.Zero; + agent.startpos = Vector3.Zero; + agent.CapsPath = GetRandomCapsObjectPath(); + agent.ChildrenCapSeeds = new Dictionary(); + agent.child = true; + + scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); + + string reason; + scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); + testclient = new TestClient(agent, scene); + scene.AddNewClient(testclient); + + ScenePresence presence = scene.GetScenePresence(agent1); + + Assert.That(presence, Is.Not.Null, "presence is null"); + Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); + acd1 = agent; + } + + /// + /// Test removing an uncrossed root agent from a scene. + /// + [Test] + public void T011_TestRemoveRootAgent() + { + TestHelpers.InMethod(); + + scene.RemoveClient(agent1); + + ScenePresence presence = scene.GetScenePresence(agent1); + + Assert.That(presence, Is.Null, "presence is not null"); + } + + [Test] + public void T012_TestAddNeighbourRegion() + { + TestHelpers.InMethod(); + + string reason; + + if (acd1 == null) + fixNullPresence(); + + scene.NewUserConnection(acd1, 0, out reason); + if (testclient == null) + testclient = new TestClient(acd1, scene); + scene.AddNewClient(testclient); + + ScenePresence presence = scene.GetScenePresence(agent1); + presence.MakeRootAgent(new Vector3(90,90,90),false); + + string cap = presence.ControllingClient.RequestClientInfo().CapsPath; + + presence.AddNeighbourRegion(region2, cap); + presence.AddNeighbourRegion(region3, cap); + + List neighbours = presence.GetKnownRegionList(); + + Assert.That(neighbours.Count, Is.EqualTo(2)); + } + + [Test] + public void T013_TestRemoveNeighbourRegion() + { + TestHelpers.InMethod(); + + ScenePresence presence = scene.GetScenePresence(agent1); + presence.RemoveNeighbourRegion(region3); + + List neighbours = presence.GetKnownRegionList(); + Assert.That(neighbours.Count,Is.EqualTo(1)); + /* + presence.MakeChildAgent; + presence.MakeRootAgent; + CompleteAvatarMovement + */ + } + + /// + /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region + /// + /// + /// Please note that unlike the other tests here, this doesn't rely on structures + /// + [Test] + public void TestChildAgentEstablished() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); + + TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); + TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); + + IConfigSource configSource = new IniConfigSource(); + configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); + EntityTransferModule etm = new EntityTransferModule(); + + SceneHelpers.SetupSceneModules(myScene1, configSource, etm); + + SceneHelpers.AddClient(myScene1, agent1Id); + ScenePresence childPresence = myScene2.GetScenePresence(agent1); + + // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents +// Assert.That(childPresence, Is.Not.Null); +// Assert.That(childPresence.IsChildAgent, Is.True); + } + + // I'm commenting this test because it does not represent + // crossings. The Thread.Sleep's in here are not meaningful mocks, + // and they sometimes fail in panda. + // We need to talk in order to develop a test + // that really tests region crossings. There are 3 async components, + // but things are synchronous among them. So there should be + // 3 threads in here. + //[Test] + public void T021_TestCrossToNewRegion() + { + TestHelpers.InMethod(); + + scene.RegisterRegionWithGrid(); + scene2.RegisterRegionWithGrid(); + + // Adding child agent to region 1001 + string reason; + scene2.NewUserConnection(acd1,0, out reason); + scene2.AddNewClient(testclient); + + ScenePresence presence = scene.GetScenePresence(agent1); + presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); + + ScenePresence presence2 = scene2.GetScenePresence(agent1); + + // Adding neighbour region caps info to presence2 + + string cap = presence.ControllingClient.RequestClientInfo().CapsPath; + presence2.AddNeighbourRegion(region1, cap); + + Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region."); + Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region."); + + // Cross to x+1 + presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100); + presence.Update(); + + EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); + + // Mimicking communication between client and server, by waiting OK from client + // sent by TestClient.CrossRegion call. Originally, this is network comm. + if (!wh.WaitOne(5000,false)) + { + presence.Update(); + if (!wh.WaitOne(8000,false)) + throw new ArgumentException("1 - Timeout waiting for signal/variable."); + } + + // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which + // would normally be fired after receiving the reply packet from comm. done on the last line. + testclient.CompleteMovement(); + + // Crossings are asynchronous + int timer = 10; + + // Make sure cross hasn't already finished + if (!presence.IsInTransit && !presence.IsChildAgent) + { + // If not and not in transit yet, give it some more time + Thread.Sleep(5000); + } + + // Enough time, should at least be in transit by now. + while (presence.IsInTransit && timer > 0) + { + Thread.Sleep(1000); + timer-=1; + } + + Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1."); + Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected."); + Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent."); + + // Cross Back + presence2.AbsolutePosition = new Vector3(-10, 3, 100); + presence2.Update(); + + if (!wh.WaitOne(5000,false)) + { + presence2.Update(); + if (!wh.WaitOne(8000,false)) + throw new ArgumentException("2 - Timeout waiting for signal/variable."); + } + testclient.CompleteMovement(); + + if (!presence2.IsInTransit && !presence2.IsChildAgent) + { + // If not and not in transit yet, give it some more time + Thread.Sleep(5000); + } + + // Enough time, should at least be in transit by now. + while (presence2.IsInTransit && timer > 0) + { + Thread.Sleep(1000); + timer-=1; + } + + Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2."); + Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); + Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); + } + + public void fixNullPresence() + { + string firstName = "testfirstname"; + + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = agent1; + agent.firstname = firstName; + agent.lastname = "testlastname"; + agent.SessionID = UUID.Zero; + agent.SecureSessionID = UUID.Zero; + agent.circuitcode = 123; + agent.BaseFolder = UUID.Zero; + agent.InventoryFolder = UUID.Zero; + agent.startpos = Vector3.Zero; + agent.CapsPath = GetRandomCapsObjectPath(); + + acd1 = agent; + } + + public static string GetRandomCapsObjectPath() + { + UUID caps = UUID.Random(); + string capsPath = caps.ToString(); + capsPath = capsPath.Remove(capsPath.Length - 4, 4); + return capsPath; + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs new file mode 100644 index 0000000..4765a86 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -0,0 +1,196 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using System.Threading; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Teleport tests in a standalone OpenSim + /// + [TestFixture] + public class ScenePresenceTeleportTests + { + /// + /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. + /// + /// Does not yet do what is says on the tin. + /// Commenting for now + //[Test, LongRunning] + public void TestSimpleNotNeighboursTeleport() + { + TestHelpers.InMethod(); + ThreadRunResults results = new ThreadRunResults(); + results.Result = false; + results.Message = "Test did not run"; + TestRunning testClass = new TestRunning(results); + + Thread testThread = new Thread(testClass.run); + + try + { + // Seems kind of redundant to start a thread and then join it, however.. We need to protect against + // A thread abort exception in the simulator code. + testThread.Start(); + testThread.Join(); + } + catch (ThreadAbortException) + { + + } + Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message); + // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); + } + + [TearDown] + public void TearDown() + { + try + { + if (MainServer.Instance != null) MainServer.Instance.Stop(); + } + catch (NullReferenceException) + { } + } + + } + + public class ThreadRunResults + { + public bool Result = false; + public string Message = string.Empty; + } + + public class TestRunning + { + public ThreadRunResults results; + public TestRunning(ThreadRunResults t) + { + results = t; + } + public void run(object o) + { + + //results.Result = true; + log4net.Config.XmlConfigurator.Configure(); + + UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); + UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); + + // shared module + ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); + + + Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); + SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); + sceneB.RegisterRegionWithGrid(); + + Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); + SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); + sceneA.RegisterRegionWithGrid(); + + UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); + TestClient client = SceneHelpers.AddClient(sceneA, agentId); + + ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface(); + + results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl); + + if (!results.Result) + { + results.Message = "Incorrect caps object path set up in sceneA"; + return; + } + + /* + Assert.That( + sceneACapsModule.GetCapsPath(agentId), + Is.EqualTo(client.CapsSeedUrl), + "Incorrect caps object path set up in sceneA"); + */ + // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. + + + client.TeleportTargetScene = sceneB; + client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); + + results.Result = (sceneB.GetScenePresence(agentId) != null); + if (!results.Result) + { + results.Message = "Client does not have an agent in sceneB"; + return; + } + + //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); + + //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); + + results.Result = (sceneA.GetScenePresence(agentId) == null); + if (!results.Result) + { + results.Message = "Client still had an agent in sceneA"; + return; + } + + ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface(); + + + results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl); + if (!results.Result) + { + results.Message = "Incorrect caps object path set up in sceneB"; + return; + } + + // Temporary assertion - caps url construction should at least be doable through a method. + /* + Assert.That( + "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", + Is.EqualTo(client.CapsSeedUrl), + "Incorrect caps object path set up in sceneB"); + */ + // This assertion will currently fail since we don't remove the caps paths when no longer needed + //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); + + // TODO: Check that more of everything is as it should be + + // TODO: test what happens if we try to teleport to a region that doesn't exist + } + } +} diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs deleted file mode 100644 index 9b5f52f..0000000 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using System.Threading; -using System.Timers; -using Timer=System.Timers.Timer; -using Nini.Config; -using NUnit.Framework; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.CoreModules.Framework.EntityTransfer; -using OpenSim.Region.CoreModules.World.Serialiser; -using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; -using OpenSim.Tests.Common; -using OpenSim.Tests.Common.Mock; - -namespace OpenSim.Region.Framework.Scenes.Tests -{ - /// - /// Scene presence tests - /// - [TestFixture] - public class ScenePresenceTests - { - public Scene scene, scene2, scene3; - public UUID agent1, agent2, agent3; - public static Random random; - public ulong region1,region2,region3; - public AgentCircuitData acd1; - public SceneObjectGroup sog1, sog2, sog3; - public TestClient testclient; - - [TestFixtureSetUp] - public void Init() - { - TestHelpers.InMethod(); - - scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); - scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); - - ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); - interregionComms.Initialise(new IniConfigSource()); - interregionComms.PostInitialise(); - SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); - SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); - SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); - - agent1 = UUID.Random(); - agent2 = UUID.Random(); - agent3 = UUID.Random(); - random = new Random(); - sog1 = NewSOG(UUID.Random(), scene, agent1); - sog2 = NewSOG(UUID.Random(), scene, agent1); - sog3 = NewSOG(UUID.Random(), scene, agent1); - - //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); - region1 = scene.RegionInfo.RegionHandle; - region2 = scene2.RegionInfo.RegionHandle; - region3 = scene3.RegionInfo.RegionHandle; - } - - /// - /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. - /// - [Test] - public void T010_TestAddRootAgent() - { - TestHelpers.InMethod(); - - string firstName = "testfirstname"; - - AgentCircuitData agent = new AgentCircuitData(); - agent.AgentID = agent1; - agent.firstname = firstName; - agent.lastname = "testlastname"; - agent.SessionID = UUID.Random(); - agent.SecureSessionID = UUID.Random(); - agent.circuitcode = 123; - agent.BaseFolder = UUID.Zero; - agent.InventoryFolder = UUID.Zero; - agent.startpos = Vector3.Zero; - agent.CapsPath = GetRandomCapsObjectPath(); - agent.ChildrenCapSeeds = new Dictionary(); - agent.child = true; - - scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); - - string reason; - scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); - testclient = new TestClient(agent, scene); - scene.AddNewClient(testclient); - - ScenePresence presence = scene.GetScenePresence(agent1); - - Assert.That(presence, Is.Not.Null, "presence is null"); - Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); - acd1 = agent; - } - - /// - /// Test removing an uncrossed root agent from a scene. - /// - [Test] - public void T011_TestRemoveRootAgent() - { - TestHelpers.InMethod(); - - scene.RemoveClient(agent1); - - ScenePresence presence = scene.GetScenePresence(agent1); - - Assert.That(presence, Is.Null, "presence is not null"); - } - - [Test] - public void T012_TestAddNeighbourRegion() - { - TestHelpers.InMethod(); - - string reason; - - if (acd1 == null) - fixNullPresence(); - - scene.NewUserConnection(acd1, 0, out reason); - if (testclient == null) - testclient = new TestClient(acd1, scene); - scene.AddNewClient(testclient); - - ScenePresence presence = scene.GetScenePresence(agent1); - presence.MakeRootAgent(new Vector3(90,90,90),false); - - string cap = presence.ControllingClient.RequestClientInfo().CapsPath; - - presence.AddNeighbourRegion(region2, cap); - presence.AddNeighbourRegion(region3, cap); - - List neighbours = presence.GetKnownRegionList(); - - Assert.That(neighbours.Count, Is.EqualTo(2)); - } - - [Test] - public void T013_TestRemoveNeighbourRegion() - { - TestHelpers.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - presence.RemoveNeighbourRegion(region3); - - List neighbours = presence.GetKnownRegionList(); - Assert.That(neighbours.Count,Is.EqualTo(1)); - /* - presence.MakeChildAgent; - presence.MakeRootAgent; - CompleteAvatarMovement - */ - } - - /// - /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region - /// - /// - /// Please note that unlike the other tests here, this doesn't rely on structures - /// - [Test] - public void TestChildAgentEstablished() - { - TestHelpers.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); - - UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); - - TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); - TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); - - IConfigSource configSource = new IniConfigSource(); - configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); - EntityTransferModule etm = new EntityTransferModule(); - - SceneHelpers.SetupSceneModules(myScene1, configSource, etm); - - SceneHelpers.AddClient(myScene1, agent1Id); - ScenePresence childPresence = myScene2.GetScenePresence(agent1); - - // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents -// Assert.That(childPresence, Is.Not.Null); -// Assert.That(childPresence.IsChildAgent, Is.True); - } - - // I'm commenting this test because it does not represent - // crossings. The Thread.Sleep's in here are not meaningful mocks, - // and they sometimes fail in panda. - // We need to talk in order to develop a test - // that really tests region crossings. There are 3 async components, - // but things are synchronous among them. So there should be - // 3 threads in here. - //[Test] - public void T021_TestCrossToNewRegion() - { - TestHelpers.InMethod(); - - scene.RegisterRegionWithGrid(); - scene2.RegisterRegionWithGrid(); - - // Adding child agent to region 1001 - string reason; - scene2.NewUserConnection(acd1,0, out reason); - scene2.AddNewClient(testclient); - - ScenePresence presence = scene.GetScenePresence(agent1); - presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); - - ScenePresence presence2 = scene2.GetScenePresence(agent1); - - // Adding neighbour region caps info to presence2 - - string cap = presence.ControllingClient.RequestClientInfo().CapsPath; - presence2.AddNeighbourRegion(region1, cap); - - Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region."); - Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region."); - - // Cross to x+1 - presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100); - presence.Update(); - - EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); - - // Mimicking communication between client and server, by waiting OK from client - // sent by TestClient.CrossRegion call. Originally, this is network comm. - if (!wh.WaitOne(5000,false)) - { - presence.Update(); - if (!wh.WaitOne(8000,false)) - throw new ArgumentException("1 - Timeout waiting for signal/variable."); - } - - // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which - // would normally be fired after receiving the reply packet from comm. done on the last line. - testclient.CompleteMovement(); - - // Crossings are asynchronous - int timer = 10; - - // Make sure cross hasn't already finished - if (!presence.IsInTransit && !presence.IsChildAgent) - { - // If not and not in transit yet, give it some more time - Thread.Sleep(5000); - } - - // Enough time, should at least be in transit by now. - while (presence.IsInTransit && timer > 0) - { - Thread.Sleep(1000); - timer-=1; - } - - Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1."); - Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected."); - Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent."); - - // Cross Back - presence2.AbsolutePosition = new Vector3(-10, 3, 100); - presence2.Update(); - - if (!wh.WaitOne(5000,false)) - { - presence2.Update(); - if (!wh.WaitOne(8000,false)) - throw new ArgumentException("2 - Timeout waiting for signal/variable."); - } - testclient.CompleteMovement(); - - if (!presence2.IsInTransit && !presence2.IsChildAgent) - { - // If not and not in transit yet, give it some more time - Thread.Sleep(5000); - } - - // Enough time, should at least be in transit by now. - while (presence2.IsInTransit && timer > 0) - { - Thread.Sleep(1000); - timer-=1; - } - - Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2."); - Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); - Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); - } - - public void fixNullPresence() - { - string firstName = "testfirstname"; - - AgentCircuitData agent = new AgentCircuitData(); - agent.AgentID = agent1; - agent.firstname = firstName; - agent.lastname = "testlastname"; - agent.SessionID = UUID.Zero; - agent.SecureSessionID = UUID.Zero; - agent.circuitcode = 123; - agent.BaseFolder = UUID.Zero; - agent.InventoryFolder = UUID.Zero; - agent.startpos = Vector3.Zero; - agent.CapsPath = GetRandomCapsObjectPath(); - - acd1 = agent; - } - - public static string GetRandomCapsObjectPath() - { - UUID caps = UUID.Random(); - string capsPath = caps.ToString(); - capsPath = capsPath.Remove(capsPath.Length - 4, 4); - return capsPath; - } - - private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) - { - SceneObjectPart sop = new SceneObjectPart(); - sop.Name = RandomName(); - sop.Description = RandomName(); - sop.Text = RandomName(); - sop.SitName = RandomName(); - sop.TouchName = RandomName(); - sop.UUID = uuid; - sop.Shape = PrimitiveBaseShape.Default; - sop.Shape.State = 1; - sop.OwnerID = agent; - - SceneObjectGroup sog = new SceneObjectGroup(sop); - sog.SetScene(scene); - - return sog; - } - - private static string RandomName() - { - StringBuilder name = new StringBuilder(); - int size = random.Next(5,12); - char ch ; - for (int i=0; i - /// Teleport tests in a standalone OpenSim - /// - [TestFixture] - public class StandaloneTeleportTests - { - /// - /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. - /// - /// Does not yet do what is says on the tin. - /// Commenting for now - //[Test, LongRunning] - public void TestSimpleNotNeighboursTeleport() - { - TestHelpers.InMethod(); - ThreadRunResults results = new ThreadRunResults(); - results.Result = false; - results.Message = "Test did not run"; - TestRunning testClass = new TestRunning(results); - - Thread testThread = new Thread(testClass.run); - - try - { - // Seems kind of redundant to start a thread and then join it, however.. We need to protect against - // A thread abort exception in the simulator code. - testThread.Start(); - testThread.Join(); - } - catch (ThreadAbortException) - { - - } - Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message); - // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); - } - - [TearDown] - public void TearDown() - { - try - { - if (MainServer.Instance != null) MainServer.Instance.Stop(); - } - catch (NullReferenceException) - { } - } - - } - - public class ThreadRunResults - { - public bool Result = false; - public string Message = string.Empty; - } - - public class TestRunning - { - public ThreadRunResults results; - public TestRunning(ThreadRunResults t) - { - results = t; - } - public void run(object o) - { - - //results.Result = true; - log4net.Config.XmlConfigurator.Configure(); - - UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); - UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); - - // shared module - ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); - - - Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); - SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); - sceneB.RegisterRegionWithGrid(); - - Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); - SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); - sceneA.RegisterRegionWithGrid(); - - UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); - TestClient client = SceneHelpers.AddClient(sceneA, agentId); - - ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface(); - - results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl); - - if (!results.Result) - { - results.Message = "Incorrect caps object path set up in sceneA"; - return; - } - - /* - Assert.That( - sceneACapsModule.GetCapsPath(agentId), - Is.EqualTo(client.CapsSeedUrl), - "Incorrect caps object path set up in sceneA"); - */ - // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. - - - client.TeleportTargetScene = sceneB; - client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); - - results.Result = (sceneB.GetScenePresence(agentId) != null); - if (!results.Result) - { - results.Message = "Client does not have an agent in sceneB"; - return; - } - - //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); - - //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); - - results.Result = (sceneA.GetScenePresence(agentId) == null); - if (!results.Result) - { - results.Message = "Client still had an agent in sceneA"; - return; - } - - ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface(); - - - results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + - "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl); - if (!results.Result) - { - results.Message = "Incorrect caps object path set up in sceneB"; - return; - } - - // Temporary assertion - caps url construction should at least be doable through a method. - /* - Assert.That( - "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", - Is.EqualTo(client.CapsSeedUrl), - "Incorrect caps object path set up in sceneB"); - */ - // This assertion will currently fail since we don't remove the caps paths when no longer needed - //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); - - // TODO: Check that more of everything is as it should be - - // TODO: test what happens if we try to teleport to a region that doesn't exist - } - } -} -- cgit v1.1 From 85e07c78fbed9e85c142c0f565c27015ad95769d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 02:17:41 +0100 Subject: refactor: Change SceneHelpers.AddClient() to AddScenePresence(). This seems to make more sense as we can get SP.ControllingClient --- .../Tests/AvatarFactoryModuleTests.cs | 2 +- .../Framework/Scenes/Tests/AttachmentTests.cs | 2 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 2 +- .../Scenes/Tests/SceneObjectDeRezTests.cs | 4 +- .../Scenes/Tests/SceneObjectUserGroupTests.cs | 2 +- .../Scenes/Tests/ScenePresenceAgentTests.cs | 72 ++++++++++++---------- .../Scenes/Tests/ScenePresenceTeleportTests.cs | 2 +- .../World/NPC/Tests/NPCModuleTests.cs | 4 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 8 +-- 9 files changed, 54 insertions(+), 44 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 4e83fa7..1bd3b6e 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, afm); - TestClient tc = SceneHelpers.AddClient(scene, userId); + IClientAPI tc = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT]; for (byte i = 0; i < visualParams.Length; i++) diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs index fb28397..07b30f4 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests region1 = scene.RegionInfo.RegionHandle; region2 = scene2.RegionInfo.RegionHandle; - SceneHelpers.AddClient(scene, agent1); + SceneHelpers.AddScenePresence(scene, agent1); } [Test] diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index ff55680..1ea2329 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectPart part = SceneHelpers.AddSceneObject(scene); - IClientAPI client = SceneHelpers.AddClient(scene, agentId); + IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; scene.DeRezObjects(client, new System.Collections.Generic.List() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index c8a9ca3..654b1a2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneHelpers.AddClient(scene, userId); + IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; @@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneHelpers.AddClient(scene, userId); + IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index e604885..c13d82e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests new GroupsModule(), new MockGroupsServicesConnector() }); - TestClient client = SceneHelpers.AddClient(scene, userId); + IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; IGroupsModule groupsModule = scene.RequestModuleInterface(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 04f5817..73acf28 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -93,6 +93,47 @@ namespace OpenSim.Region.Framework.Scenes.Tests region3 = scene3.RegionInfo.RegionHandle; } +// [Test] +// public void TestLogout() +// { +// TestHelpers.InMethod(); +//// log4net.Config.XmlConfigurator.Configure(); +// +// TestScene scene = SceneHelpers.SetupScene(); +// SceneHelpers. +// } + + /// + /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region + /// + /// + /// Please note that unlike the other tests here, this doesn't rely on structures + /// + [Test] + public void TestChildAgentEstablished() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); + + TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); +// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); + + IConfigSource configSource = new IniConfigSource(); + configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); + EntityTransferModule etm = new EntityTransferModule(); + + SceneHelpers.SetupSceneModules(myScene1, configSource, etm); + + SceneHelpers.AddScenePresence(myScene1, agent1Id); +// ScenePresence childPresence = myScene2.GetScenePresence(agent1); + + // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents +// Assert.That(childPresence, Is.Not.Null); +// Assert.That(childPresence.IsChildAgent, Is.True); + } + /// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. /// @@ -190,37 +231,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests CompleteAvatarMovement */ } - - /// - /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region - /// - /// - /// Please note that unlike the other tests here, this doesn't rely on structures - /// - [Test] - public void TestChildAgentEstablished() - { - TestHelpers.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); - - UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); - - TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); - TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); - - IConfigSource configSource = new IniConfigSource(); - configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); - EntityTransferModule etm = new EntityTransferModule(); - - SceneHelpers.SetupSceneModules(myScene1, configSource, etm); - - SceneHelpers.AddClient(myScene1, agent1Id); - ScenePresence childPresence = myScene2.GetScenePresence(agent1); - - // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents -// Assert.That(childPresence, Is.Not.Null); -// Assert.That(childPresence.IsChildAgent, Is.True); - } // I'm commenting this test because it does not represent // crossings. The Thread.Sleep's in here are not meaningful mocks, diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 4765a86..39bb43a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests sceneA.RegisterRegionWithGrid(); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); - TestClient client = SceneHelpers.AddClient(sceneA, agentId); + TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient; ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface(); diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 28fa8a2..a0260a5 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); - TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1)); + IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient; // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance @@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, new NPCModule()); - TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1)); + IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient; // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 55b638b..070e390 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -341,9 +341,9 @@ namespace OpenSim.Tests.Common /// /// /// - public static TestClient AddClient(Scene scene, UUID agentId) + public static ScenePresence AddScenePresence(Scene scene, UUID agentId) { - return AddClient(scene, GenerateAgentData(agentId)); + return AddScenePresence(scene, GenerateAgentData(agentId)); } /// @@ -364,7 +364,7 @@ namespace OpenSim.Tests.Common /// /// /// - public static TestClient AddClient(Scene scene, AgentCircuitData agentData) + public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) { string reason; @@ -386,7 +386,7 @@ namespace OpenSim.Tests.Common scp.CompleteMovement(client); //scp.MakeRootAgent(new Vector3(90, 90, 90), true); - return client; + return scp; } /// -- cgit v1.1 From e37f8cf90270ba6e1605bdb528ca205a35cfe049 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 02:27:25 +0100 Subject: Add a test to check that ScenePresence and circuit go away when a root agent is closed down --- .../Scenes/Tests/ScenePresenceAgentTests.cs | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 73acf28..6cf905a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -93,15 +93,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests region3 = scene3.RegionInfo.RegionHandle; } -// [Test] -// public void TestLogout() -// { -// TestHelpers.InMethod(); -//// log4net.Config.XmlConfigurator.Configure(); -// -// TestScene scene = SceneHelpers.SetupScene(); -// SceneHelpers. -// } + [Test] + public void TestCloseAgent() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + TestScene scene = SceneHelpers.SetupScene(); + ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + + Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); + + scene.IncomingCloseAgent(sp.UUID); + + Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); + Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); + } /// /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region @@ -118,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); -// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); +// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); IConfigSource configSource = new IniConfigSource(); configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); -- cgit v1.1 From eec54adac5b6745c147ac7f7db947dba16e39d06 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 02:38:38 +0100 Subject: remove some obsolete tests that are now done elsewhere --- .../Scenes/Tests/ScenePresenceAgentTests.cs | 106 ++++++++++----------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 6cf905a..dd2c717 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -135,64 +135,64 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneHelpers.AddScenePresence(myScene1, agent1Id); // ScenePresence childPresence = myScene2.GetScenePresence(agent1); - + // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents // Assert.That(childPresence, Is.Not.Null); // Assert.That(childPresence.IsChildAgent, Is.True); } - /// - /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. - /// - [Test] - public void T010_TestAddRootAgent() - { - TestHelpers.InMethod(); - - string firstName = "testfirstname"; - - AgentCircuitData agent = new AgentCircuitData(); - agent.AgentID = agent1; - agent.firstname = firstName; - agent.lastname = "testlastname"; - agent.SessionID = UUID.Random(); - agent.SecureSessionID = UUID.Random(); - agent.circuitcode = 123; - agent.BaseFolder = UUID.Zero; - agent.InventoryFolder = UUID.Zero; - agent.startpos = Vector3.Zero; - agent.CapsPath = GetRandomCapsObjectPath(); - agent.ChildrenCapSeeds = new Dictionary(); - agent.child = true; - - scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); - - string reason; - scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); - testclient = new TestClient(agent, scene); - scene.AddNewClient(testclient); - - ScenePresence presence = scene.GetScenePresence(agent1); - - Assert.That(presence, Is.Not.Null, "presence is null"); - Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); - acd1 = agent; - } - - /// - /// Test removing an uncrossed root agent from a scene. - /// - [Test] - public void T011_TestRemoveRootAgent() - { - TestHelpers.InMethod(); - - scene.RemoveClient(agent1); - - ScenePresence presence = scene.GetScenePresence(agent1); - - Assert.That(presence, Is.Null, "presence is not null"); - } +// /// +// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. +// /// +// [Test] +// public void T010_TestAddRootAgent() +// { +// TestHelpers.InMethod(); +// +// string firstName = "testfirstname"; +// +// AgentCircuitData agent = new AgentCircuitData(); +// agent.AgentID = agent1; +// agent.firstname = firstName; +// agent.lastname = "testlastname"; +// agent.SessionID = UUID.Random(); +// agent.SecureSessionID = UUID.Random(); +// agent.circuitcode = 123; +// agent.BaseFolder = UUID.Zero; +// agent.InventoryFolder = UUID.Zero; +// agent.startpos = Vector3.Zero; +// agent.CapsPath = GetRandomCapsObjectPath(); +// agent.ChildrenCapSeeds = new Dictionary(); +// agent.child = true; +// +// scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); +// +// string reason; +// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); +// testclient = new TestClient(agent, scene); +// scene.AddNewClient(testclient); +// +// ScenePresence presence = scene.GetScenePresence(agent1); +// +// Assert.That(presence, Is.Not.Null, "presence is null"); +// Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); +// acd1 = agent; +// } +// +// /// +// /// Test removing an uncrossed root agent from a scene. +// /// +// [Test] +// public void T011_TestRemoveRootAgent() +// { +// TestHelpers.InMethod(); +// +// scene.RemoveClient(agent1); +// +// ScenePresence presence = scene.GetScenePresence(agent1); +// +// Assert.That(presence, Is.Null, "presence is not null"); +// } [Test] public void T012_TestAddNeighbourRegion() -- cgit v1.1 From 6878049952ba25f853720d8f7fe0644569454c00 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 6 Aug 2011 03:06:05 +0100 Subject: get rid of bogus log message --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d354c0a..cd5228d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2298,13 +2298,6 @@ namespace OpenSim.Region.Framework.Scenes /// The direction in which this avatar should now face. public void AddNewMovement(Vector3 vec, Quaternion rotation) { - if (m_isChildAgent) - { - // WHAT??? - m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); - return; - } - m_perfMonMS = Util.EnvironmentTickCount(); Rotation = rotation; -- cgit v1.1 From 78d8ce3816cde8702cfd4f5d198e2c69aff0a7be Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 8 Aug 2011 23:22:47 +0100 Subject: refactor: split out generic parts of osMakeNotecard() into a separate. Add method doc. Other minor tidies. --- .../Shared/Api/Implementation/OSSL_Api.cs | 157 +++++++++++++-------- 1 file changed, 99 insertions(+), 58 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8093502..32ad21f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -348,20 +348,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api System.Threading.Thread.Sleep(delay); } - // - // OpenSim functions - // public LSL_Integer osSetTerrainHeight(int x, int y, double val) { CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); return SetTerrainHeight(x, y, val); } + public LSL_Integer osTerrainSetHeight(int x, int y, double val) { CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight"); return SetTerrainHeight(x, y, val); } + private LSL_Integer SetTerrainHeight(int x, int y, double val) { m_host.AddScriptLPS(1); @@ -384,12 +383,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight"); return GetTerrainHeight(x, y); } + public LSL_Float osTerrainGetHeight(int x, int y) { CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight"); return GetTerrainHeight(x, y); } + private LSL_Float GetTerrainHeight(int x, int y) { m_host.AddScriptLPS(1); @@ -1021,6 +1022,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api drawList += "PenColor " + color + "; "; return drawList; } + // Deprecated public string osSetPenColour(string drawList, string colour) { @@ -1182,11 +1184,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api OSSLDeprecated("osSunGetParam", "osGetSunParam"); return GetSunParam(param); } + public double osGetSunParam(string param) { CheckThreatLevel(ThreatLevel.None, "osGetSunParam"); return GetSunParam(param); } + private double GetSunParam(string param) { m_host.AddScriptLPS(1); @@ -1208,11 +1212,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api OSSLDeprecated("osSunSetParam", "osSetSunParam"); SetSunParam(param, value); } + public void osSetSunParam(string param, double value) { CheckThreatLevel(ThreatLevel.None, "osSetSunParam"); SetSunParam(param, value); } + private void SetSunParam(string param, double value) { m_host.AddScriptLPS(1); @@ -1222,10 +1228,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { module.SetSunParameter(param, value); } - } - public string osWindActiveModelPluginName() { CheckThreatLevel(ThreatLevel.None, "osWindActiveModelPluginName"); @@ -1304,12 +1308,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api OSSLDeprecated(functionName, "osSetParcelDetails"); SetParcelDetails(pos, rules, functionName); } + public void osSetParcelDetails(LSL_Vector pos, LSL_List rules) { const string functionName = "osSetParcelDetails"; CheckThreatLevel(ThreatLevel.High, functionName); SetParcelDetails(pos, rules, functionName); } + private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName) { m_host.AddScriptLPS(1); @@ -1429,8 +1435,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api voiceModule.setLandSIPAddress(SIPAddress,land.LandData.GlobalID); else OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); - - } public string osGetScriptEngineName() @@ -1683,8 +1687,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return jsondata; } - // send a message to to object identified by the given UUID, a script in the object must implement the dataserver function - // the dataserver function is passed the ID of the calling function and a string message + /// + /// Send a message to to object identified by the given UUID + /// + /// + /// A script in the object must implement the dataserver function + /// the dataserver function is passed the ID of the calling function and a string message + /// + /// + /// public void osMessageObject(LSL_Key objectUUID, string message) { CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); @@ -1699,24 +1710,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api "dataserver", resobj, new DetectParams[0])); } - - // This needs ThreatLevel high. It is an excellent griefer tool, - // In a loop, it can cause asset bloat and DOS levels of asset - // writes. - // + /// + /// Write a notecard directly to the prim's inventory. + /// + /// + /// This needs ThreatLevel high. It is an excellent griefer tool, + /// In a loop, it can cause asset bloat and DOS levels of asset + /// writes. + /// + /// The name of the notecard to write. + /// The contents of the notecard. public void osMakeNotecard(string notecardName, LSL_Types.list contents) { CheckThreatLevel(ThreatLevel.High, "osMakeNotecard"); m_host.AddScriptLPS(1); + StringBuilder notecardData = new StringBuilder(); + + for (int i = 0; i < contents.Length; i++) + notecardData.Append((string)(contents.GetLSLStringItem(i) + "\n")); + + SaveNotecard(notecardName, notecardData.ToString()); + } + + protected void SaveNotecard(string notecardName, string notecardData) + { // Create new asset AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); asset.Description = "Script Generated Notecard"; - string notecardData = String.Empty; - - for (int i = 0; i < contents.Length; i++) { - notecardData += contents.GetLSLStringItem(i) + "\n"; - } int textLength = notecardData.Length; notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " @@ -1726,7 +1747,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.AssetService.Store(asset); // Create Task Entry - TaskInventoryItem taskItem=new TaskInventoryItem(); + TaskInventoryItem taskItem = new TaskInventoryItem(); taskItem.ResetIDs(m_host.UUID); taskItem.ParentID = m_host.UUID; @@ -1751,13 +1772,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.Inventory.AddInventoryItem(taskItem, false); } - - /*Instead of using the LSL Dataserver event to pull notecard data, - this will simply read the requested line and return its data as a string. - - Warning - due to the synchronous method this function uses to fetch assets, its use - may be dangerous and unreliable while running in grid mode. - */ + /// + /// Directly get an entire notecard at once. + /// + /// + /// Instead of using the LSL Dataserver event to pull notecard data + /// this will simply read the entire notecard and return its data as a string. + /// + /// Warning - due to the synchronous method this function uses to fetch assets, its use + /// may be dangerous and unreliable while running in grid mode. + /// + /// Name of the notecard or its asset id + /// The line number to read. The first line is line 0 + /// Notecard line public string osGetNotecardLine(string name, int line) { CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine"); @@ -1799,17 +1826,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api }; return NotecardCache.GetLine(assetID, line, 255); - - } - /*Instead of using the LSL Dataserver event to pull notecard data line by line, - this will simply read the entire notecard and return its data as a string. - - Warning - due to the synchronous method this function uses to fetch assets, its use - may be dangerous and unreliable while running in grid mode. - */ - + /// + /// Get an entire notecard at once. + /// + /// + /// Instead of using the LSL Dataserver event to pull notecard data line by line, + /// this will simply read the entire notecard and return its data as a string. + /// + /// Warning - due to the synchronous method this function uses to fetch assets, its use + /// may be dangerous and unreliable while running in grid mode. + /// + /// Name of the notecard or its asset id + /// Notecard text public string osGetNotecard(string name) { CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard"); @@ -1857,17 +1887,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } return NotecardData; - - } - /*Instead of using the LSL Dataserver event to pull notecard data, - this will simply read the number of note card lines and return this data as an integer. - - Warning - due to the synchronous method this function uses to fetch assets, its use - may be dangerous and unreliable while running in grid mode. - */ - + /// + /// Get the number of lines in the given notecard. + /// + /// + /// Instead of using the LSL Dataserver event to pull notecard data, + /// this will simply read the number of note card lines and return this data as an integer. + /// + /// Warning - due to the synchronous method this function uses to fetch assets, its use + /// may be dangerous and unreliable while running in grid mode. + /// + /// Name of the notecard or its asset id + /// public int osGetNumberOfNotecardLines(string name) { CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines"); @@ -1947,15 +1980,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return ""; } - } + /// + /// Get the nickname of this grid, as set in the [GridInfo] config section. + /// + /// /// Threat level is Moderate because intentional abuse, for instance /// scripts that are written to be malicious only on one grid, /// for instance in a HG scenario, are a distinct possibility. - /// - /// Use value from the config file and return it. - /// + /// + /// public string osGetGridNick() { CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); @@ -2063,12 +2098,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return World.RegionInfo.RegionSettings.LoadedCreationID; } - // Threat level is 'Low' because certain users could possibly be tricked into - // dropping an unverified script into one of their own objects, which could - // then gather the physical construction details of the object and transmit it - // to an unscrupulous third party, thus permitting unauthorized duplication of - // the object's form. - // + /// + /// Get the primitive parameters of a linked prim. + /// + /// + /// Threat level is 'Low' because certain users could possibly be tricked into + /// dropping an unverified script into one of their own objects, which could + /// then gather the physical construction details of the object and transmit it + /// to an unscrupulous third party, thus permitting unauthorized duplication of + /// the object's form. + /// + /// + /// + /// public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules) { CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); @@ -2344,10 +2386,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api obj.Shape.ProjectionFocus = (float)focus; obj.Shape.ProjectionAmbiance = (float)amb; - obj.ParentGroup.HasGroupChanged = true; obj.ScheduleFullUpdate(); - } /// @@ -2372,6 +2412,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } }); + return result; } @@ -2391,4 +2432,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } } -} +} \ No newline at end of file -- cgit v1.1 From 16775875328d9601a33e0fa9d229ce7864ec7c5b Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Tue, 9 Aug 2011 01:11:39 +0200 Subject: Let's see if I am really a core developer, now. ;) --- CONTRIBUTORS.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 5c1bdf1..b73a87d 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -14,6 +14,7 @@ people that make the day to day of OpenSim happen. * Marck * Mic Bowman (Intel) * BlueWall (James Hughes) +* Snoopy Pfeffer = Core Developers Following the White Rabbit = Core developers who have temporarily (we hope) gone chasing the white rabbit. @@ -128,7 +129,6 @@ what it is today. * Salahzar Stenvaag * sempuki * SignpostMarv -* Snoopy * Strawberry Fride * tglion * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) -- cgit v1.1 From 3e16a0fbdd9477f24a93e0e70311bfca7995e339 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Aug 2011 00:12:41 +0100 Subject: factor out common notecard caching code from 3 methods. --- .../Shared/Api/Implementation/OSSL_Api.cs | 167 +++++++++------------ 1 file changed, 74 insertions(+), 93 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 32ad21f..154179c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1733,7 +1733,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SaveNotecard(notecardName, notecardData.ToString()); } - protected void SaveNotecard(string notecardName, string notecardData) + /// + /// Save a notecard to prim inventory. + /// + /// + /// + /// Prim inventory item created. + protected TaskInventoryItem SaveNotecard(string notecardName, string notecardData) { // Create new asset AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); @@ -1770,6 +1776,66 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taskItem.AssetID = asset.FullID; m_host.Inventory.AddInventoryItem(taskItem, false); + + return taskItem; + } + + /// + /// Load the notecard data found at the given prim inventory item name or asset uuid. + /// + /// + /// The text loaded. Null if no notecard was found. + protected string LoadNotecard(string notecardNameOrUuid) + { + UUID assetID = CacheNotecard(notecardNameOrUuid); + StringBuilder notecardData = new StringBuilder(); + + for (int count = 0; count < NotecardCache.GetLines(assetID); count++) + notecardData.Append(NotecardCache.GetLine(assetID, count, 255) + "\n"); + + return notecardData.ToString(); + } + + /// + /// Cache a notecard's contents. + /// + /// + /// + /// The asset id of the notecard, which is used for retrieving the cached data. + /// UUID.Zero if no asset could be found. + /// + protected UUID CacheNotecard(string notecardNameOrUuid) + { + UUID assetID = UUID.Zero; + StringBuilder notecardData = new StringBuilder(); + + if (!UUID.TryParse(notecardNameOrUuid, out assetID)) + { + foreach (TaskInventoryItem item in m_host.TaskInventory.Values) + { + if (item.Type == 7 && item.Name == notecardNameOrUuid) + { + assetID = item.AssetID; + } + } + } + + if (assetID == UUID.Zero) + return UUID.Zero; + + if (!NotecardCache.IsCached(assetID)) + { + AssetBase a = World.AssetService.Get(assetID.ToString()); + + if (a == null) + return UUID.Zero; + + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); + string data = enc.GetString(a.Data); + NotecardCache.Cache(assetID, data); + }; + + return assetID; } /// @@ -1790,18 +1856,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine"); m_host.AddScriptLPS(1); - UUID assetID = UUID.Zero; - - if (!UUID.TryParse(name, out assetID)) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - } - } - } + UUID assetID = CacheNotecard(name); if (assetID == UUID.Zero) { @@ -1809,22 +1864,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return "ERROR!"; } - if (!NotecardCache.IsCached(assetID)) - { - AssetBase a = World.AssetService.Get(assetID.ToString()); - if (a != null) - { - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); - NotecardCache.Cache(assetID, data); - } - else - { - OSSLShoutError("Notecard '" + name + "' could not be found."); - return "ERROR!"; - } - }; - return NotecardCache.GetLine(assetID, line, 255); } @@ -1845,48 +1884,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard"); m_host.AddScriptLPS(1); - UUID assetID = UUID.Zero; - string NotecardData = ""; - - if (!UUID.TryParse(name, out assetID)) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - } - } - } + string text = LoadNotecard(name); - if (assetID == UUID.Zero) + if (text == null) { OSSLShoutError("Notecard '" + name + "' could not be found."); return "ERROR!"; } - - if (!NotecardCache.IsCached(assetID)) - { - AssetBase a = World.AssetService.Get(assetID.ToString()); - if (a != null) - { - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); - NotecardCache.Cache(assetID, data); - } - else - { - OSSLShoutError("Notecard '" + name + "' could not be found."); - return "ERROR!"; - } - }; - - for (int count = 0; count < NotecardCache.GetLines(assetID); count++) + else { - NotecardData += NotecardCache.GetLine(assetID, count, 255) + "\n"; + return text; } - - return NotecardData; } /// @@ -1906,18 +1914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines"); m_host.AddScriptLPS(1); - UUID assetID = UUID.Zero; - - if (!UUID.TryParse(name, out assetID)) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - } - } - } + UUID assetID = CacheNotecard(name); if (assetID == UUID.Zero) { @@ -1925,22 +1922,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return -1; } - if (!NotecardCache.IsCached(assetID)) - { - AssetBase a = World.AssetService.Get(assetID.ToString()); - if (a != null) - { - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); - NotecardCache.Cache(assetID, data); - } - else - { - OSSLShoutError("Notecard '" + name + "' could not be found."); - return -1; - } - }; - return NotecardCache.GetLines(assetID); } @@ -2412,7 +2393,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } }); - + return result; } -- cgit v1.1 From e869eeb0bfc48c769f680970f99e4c67dd5a1a70 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Aug 2011 03:51:34 +0100 Subject: Implement first draft functions for saving and loading NPC appearance from storage. This works by serializing and deserializing NPC AvatarAppearance to a notecard in the prim inventory and making the required baked textures permanent. By using notecards, we avoid lots of awkward, technical and user-unfriendly issues concerning retaining asset references and creating a new asset type. Notecards also allow different appearances to be swapped and manipulated easily. This also allows stored NPC appearances to work transparently with OARs/IARs since the UUID scan will pick up and store the necessary references from the notecard text. This works in my basic test but is not at all ready for user use or bug reporting yet. --- OpenSim/Framework/AvatarAppearance.cs | 2 +- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 87 ++++++++++++----- .../Tests/AvatarFactoryModuleTests.cs | 2 +- .../Region/Framework/Interfaces/IAvatarFactory.cs | 8 ++ OpenSim/Region/Framework/Interfaces/INPCModule.cs | 19 +++- .../Region/OptionalModules/World/NPC/NPCModule.cs | 29 ++++++ .../World/NPC/Tests/NPCModuleTests.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 33 +++++-- .../Shared/Api/Implementation/OSSL_Api.cs | 104 ++++++++++++++++++--- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++ prebuild.xml | 1 + 12 files changed, 253 insertions(+), 46 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 73b068d..02af5d9 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -539,7 +539,7 @@ namespace OpenSim.Framework /// public void Unpack(OSDMap data) { - if ((data != null) && (data["serial"] != null)) + if ((data != null) && (data["serial"] != null)) m_serial = data["serial"].AsInteger(); if ((data != null) && (data["height"] != null)) m_avatarHeight = (float)data["height"].AsReal(); diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index e3e3452..75d8143 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public void NewClient(IClientAPI client) { client.OnRequestWearables += SendWearables; - client.OnSetAppearance += SetAppearance; + client.OnSetAppearance += SetAppearanceFromClient; client.OnAvatarNowWearing += AvatarIsWearing; } @@ -189,7 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// /// /// - public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) + public void SetAppearanceFromClient(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) { ScenePresence sp = m_scene.GetScenePresence(client.AgentId); if (sp == null) @@ -257,6 +257,47 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return true; } + public bool SaveBakedTextures(UUID agentId) + { + ScenePresence sp = m_scene.GetScenePresence(agentId); + + if (sp == null || sp.IsChildAgent) + return false; + + AvatarAppearance appearance = sp.Appearance; + Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures; + + m_log.DebugFormat( + "[AV FACTORY]: Permanently saving baked textures for {0} in {1}", + sp.Name, m_scene.RegionInfo.RegionName); + + for (int i = 0; i < faceTextures.Length; i++) + { +// m_log.DebugFormat( +// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", +// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); + + if (faceTextures[i] == null) + continue; + + AssetBase asset = m_scene.AssetService.Get(faceTextures[i].TextureID.ToString()); + + if (asset != null) + { + asset.Temporary = false; + m_scene.AssetService.Store(asset); + } + else + { + m_log.WarnFormat( + "[AV FACTORY]: Baked texture {0} for {1} in {2} unexpectedly not found when trying to save permanently", + faceTextures[i].TextureID, sp.Name, m_scene.RegionInfo.RegionName); + } + } + + return true; + } + #region UpdateAppearanceTimer /// @@ -289,25 +330,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } - private void HandleAppearanceSend(UUID agentid) - { - ScenePresence sp = m_scene.GetScenePresence(agentid); - if (sp == null) - { - m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); - return; - } - - // m_log.WarnFormat("[AVFACTORY]: Handle appearance send for {0}", agentid); - - // Send the appearance to everyone in the scene - sp.SendAppearanceToAllOtherAgents(); - - // Send animations back to the avatar as well - sp.Animator.SendAnimPack(); - } - - private void HandleAppearanceSave(UUID agentid) + private void SaveAppearance(UUID agentid) { // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved // in a culture where decimal points are commas and then reloaded in a culture which just treats them as @@ -337,7 +360,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { if (kvp.Value < now) { - Util.FireAndForget(delegate(object o) { HandleAppearanceSend(kvp.Key); }); + Util.FireAndForget(delegate(object o) { SendAppearance(kvp.Key); }); m_sendqueue.Remove(kvp.Key); } } @@ -350,7 +373,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { if (kvp.Value < now) { - Util.FireAndForget(delegate(object o) { HandleAppearanceSave(kvp.Key); }); + Util.FireAndForget(delegate(object o) { SaveAppearance(kvp.Key); }); m_savequeue.Remove(kvp.Key); } } @@ -427,6 +450,24 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } + public bool SendAppearance(UUID agentId) + { + ScenePresence sp = m_scene.GetScenePresence(agentId); + if (sp == null) + { + m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); + return false; + } + + // Send the appearance to everyone in the scene + sp.SendAppearanceToAllOtherAgents(); + + // Send animations back to the avatar as well + sp.Animator.SendAnimPack(); + + return true; + } + private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) { IInventoryService invService = m_scene.InventoryService; diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 1bd3b6e..b831b31 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory for (byte i = 0; i < visualParams.Length; i++) visualParams[i] = i; - afm.SetAppearance(tc, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); + afm.SetAppearanceFromClient(tc, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); ScenePresence sp = scene.GetScenePresence(userId); diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs index d0e5609..6817725 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs @@ -32,6 +32,14 @@ namespace OpenSim.Region.Framework.Interfaces { public interface IAvatarFactory { + /// + /// Send the appearance of an avatar to others in the scene. + /// + /// + /// + bool SendAppearance(UUID agentId); + + bool SaveBakedTextures(UUID agentId); bool ValidateBakedTextureCache(IClientAPI client); void QueueAppearanceSend(UUID agentid); void QueueAppearanceSave(UUID agentid); diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index fa8d6b6..54575ca 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -26,6 +26,7 @@ */ using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Interfaces @@ -44,6 +45,23 @@ namespace OpenSim.Region.Framework.Interfaces UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom); /// + /// Check if the agent is an NPC. + /// + /// + /// + /// True if the agent is an NPC in the given scene. False otherwise. + bool IsNPC(UUID agentID, Scene scene); + + /// + /// Set the appearance for an NPC. + /// + /// + /// + /// + /// + bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene); + + /// /// Move an NPC to a target over time. /// /// The UUID of the NPC @@ -59,7 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces /// void Say(UUID agentID, Scene scene, string text); - /// /// Delete an NPC. /// diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 4f21d9d..d966345 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -137,6 +137,35 @@ namespace OpenSim.Region.OptionalModules.World.NPC } } + public bool IsNPC(UUID agentId, Scene scene) + { + ScenePresence sp = scene.GetScenePresence(agentId); + if (sp == null || sp.IsChildAgent) + return false; + + lock (m_avatars) + return m_avatars.ContainsKey(agentId); + } + + public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) + { + ScenePresence sp = scene.GetScenePresence(agentId); + if (sp == null || sp.IsChildAgent) + return false; + + lock (m_avatars) + if (!m_avatars.ContainsKey(agentId)) + return false; + + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); + sp.Appearance = npcAppearance; + + IAvatarFactory module = scene.RequestModuleInterface(); + module.SendAppearance(sp.UUID); + + return true; + } + public UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom) { NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index a0260a5..2ec354f 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -72,7 +72,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // ScenePresence.SendInitialData() to reset our entire appearance. scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId)); - afm.SetAppearance(originalClient, originalTe, null); + afm.SetAppearanceFromClient(originalClient, originalTe, null); INPCModule npcModule = scene.RequestModuleInterface(); UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, originalClient.AgentId); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7c21ba9..86ee28a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10565,9 +10565,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public static string GetLine(UUID assetID, int line, int maxLength) + /// + /// Get a notecard line. + /// + /// + /// Lines start at index 0 + /// + public static string GetLine(UUID assetID, int lineNumber) { - if (line < 0) + if (lineNumber < 0) return ""; string data; @@ -10579,17 +10585,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_Notecards[assetID].lastRef = DateTime.Now; - if (line >= m_Notecards[assetID].text.Length) + if (lineNumber >= m_Notecards[assetID].text.Length) return "\n\n\n"; - data = m_Notecards[assetID].text[line]; - if (data.Length > maxLength) - data = data.Substring(0, maxLength); + data = m_Notecards[assetID].text[lineNumber]; return data; } } + /// + /// Get a notecard line. + /// + /// + /// Lines start at index 0 + /// Maximum length of the returned line. Longer lines will be truncated + /// + public static string GetLine(UUID assetID, int lineNumber, int maxLength) + { + string line = GetLine(assetID, lineNumber); + + if (line.Length > maxLength) + line = line.Substring(0, maxLength); + + return line; + } + public static void CacheCheck() { foreach (UUID key in new List(m_Notecards.Keys)) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 154179c..07b36de 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -28,11 +28,16 @@ using System; using System.Collections; using System.Collections.Generic; +using System.IO; +using System.Reflection; using System.Runtime.Remoting.Lifetime; using System.Text; using System.Net; using System.Threading; +using System.Xml; +using log4net; using OpenMetaverse; +using OpenMetaverse.StructuredData; using Nini.Config; using OpenSim; using OpenSim.Framework; @@ -119,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api [Serializable] public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + internal IScriptEngine m_ScriptEngine; internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there internal SceneObjectPart m_host; @@ -1730,26 +1737,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api for (int i = 0; i < contents.Length; i++) notecardData.Append((string)(contents.GetLSLStringItem(i) + "\n")); - SaveNotecard(notecardName, notecardData.ToString()); + SaveNotecard(notecardName, "Script generated notecard", notecardData.ToString(), false); } /// /// Save a notecard to prim inventory. /// - /// + /// + /// Description of notecard /// + /// + /// If true, then if an item exists with the same name, it is replaced. + /// If false, then a new item is created witha slightly different name (e.g. name 1) + /// /// Prim inventory item created. - protected TaskInventoryItem SaveNotecard(string notecardName, string notecardData) + protected TaskInventoryItem SaveNotecard(string name, string description, string data, bool forceSameName) { // Create new asset - AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); - asset.Description = "Script Generated Notecard"; + AssetBase asset = new AssetBase(UUID.Random(), name, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); + asset.Description = description; - int textLength = notecardData.Length; - notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " - + textLength.ToString() + "\n" + notecardData + "}\n"; + int textLength = data.Length; + data + = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " + + textLength.ToString() + "\n" + data + "}\n"; - asset.Data = Util.UTF8.GetBytes(notecardData); + asset.Data = Util.UTF8.GetBytes(data); World.AssetService.Store(asset); // Create Task Entry @@ -1775,7 +1788,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taskItem.PermsMask = 0; taskItem.AssetID = asset.FullID; - m_host.Inventory.AddInventoryItem(taskItem, false); + if (forceSameName) + m_host.Inventory.AddInventoryItemExclusive(taskItem, false); + else + m_host.Inventory.AddInventoryItem(taskItem, false); return taskItem; } @@ -1791,7 +1807,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api StringBuilder notecardData = new StringBuilder(); for (int count = 0; count < NotecardCache.GetLines(assetID); count++) - notecardData.Append(NotecardCache.GetLine(assetID, count, 255) + "\n"); + { + string line = NotecardCache.GetLine(assetID, count) + "\n"; + +// m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line); + + notecardData.Append(line); + } return notecardData.ToString(); } @@ -1807,7 +1829,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected UUID CacheNotecard(string notecardNameOrUuid) { UUID assetID = UUID.Zero; - StringBuilder notecardData = new StringBuilder(); if (!UUID.TryParse(notecardNameOrUuid, out assetID)) { @@ -1864,7 +1885,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return "ERROR!"; } - return NotecardCache.GetLine(assetID, line, 255); + return NotecardCache.GetLine(assetID, line); } /// @@ -2122,9 +2143,66 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(x.ToString()); } + return new LSL_Key(UUID.Zero.ToString()); } + public LSL_Key osNpcSaveAppearance(string avatar, string notecardName) + { + CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); + + INPCModule npcModule = World.RequestModuleInterface(); + IAvatarFactory appearanceModule = World.RequestModuleInterface(); + + if (npcModule != null && appearanceModule != null) + { + UUID avatarId = UUID.Zero; + if (!UUID.TryParse(avatar, out avatarId)) + return new LSL_Key(UUID.Zero.ToString()); + + if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) + return new LSL_Key(UUID.Zero.ToString()); + + appearanceModule.SaveBakedTextures(avatarId); + ScenePresence sp = m_host.ParentGroup.Scene.GetScenePresence(avatarId); + OSDMap appearancePacked = sp.Appearance.Pack(); + + TaskInventoryItem item + = SaveNotecard(notecardName, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); + + return new LSL_Key(item.AssetID.ToString()); + } + + return new LSL_Key(UUID.Zero.ToString()); + } + + public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + { + CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); + + INPCModule npcModule = World.RequestModuleInterface(); + + if (npcModule != null) + { + UUID avatarId = UUID.Zero; + if (!UUID.TryParse(avatar, out avatarId)) + return; + + if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) + return; + + string appearanceSerialized = LoadNotecard(notecardNameOrUuid); + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); +// OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); +// Console.WriteLine("appearanceSerialized {0}", appearanceSerialized); +// Console.WriteLine("a.Type {0}, a.ToString() {1}", a.Type, a); + AvatarAppearance appearance = new AvatarAppearance(); + appearance.Unpack(appearanceOsd); + + npcModule.SetNPCAppearance(avatarId, appearance, m_host.ParentGroup.Scene); + } + } + public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 19352f0..868af27 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -170,6 +170,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces key osNpcCreate(string user, string name, vector position, key cloneFrom); + LSL_Key osNpcSaveAppearance(string avatar, string notecardName); + void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 7c59098..959b5d5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -483,6 +483,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); } + public key osNpcSaveAppearance(string avatar, string notecardName) + { + return m_OSSL_Functions.osNpcSaveAppearance(avatar, notecardName); + } + + public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + { + m_OSSL_Functions.osNpcLoadAppearance(avatar, notecardNameOrUuid); + } + public void osNpcMoveTo(key npc, vector position) { m_OSSL_Functions.osNpcMoveTo(npc, position); diff --git a/prebuild.xml b/prebuild.xml index 92368ef..9d1be3a 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2308,6 +2308,7 @@ + -- cgit v1.1 From 795c8e6c22d4174d942ad56e70a0acbe507e2ec7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Aug 2011 22:05:47 +0100 Subject: Add osOwnerSaveAppearance() to help with setting up NPC appearances. Not yet ready for user use. Adds regression test. --- .../Shared/Api/Implementation/OSSL_Api.cs | 51 ++++++++-- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 + .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 105 +++++++++++++++++++++ prebuild.xml | 4 + 5 files changed, 157 insertions(+), 10 deletions(-) create mode 100644 OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 07b36de..a05c623 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2147,14 +2147,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(UUID.Zero.ToString()); } + /// + /// Save the current appearance of the NPC permanently to the named notecard. + /// + /// + /// The name of the notecard to which to save the appearance. + /// The asset ID of the notecard saved. public LSL_Key osNpcSaveAppearance(string avatar, string notecardName) { CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); INPCModule npcModule = World.RequestModuleInterface(); - IAvatarFactory appearanceModule = World.RequestModuleInterface(); - if (npcModule != null && appearanceModule != null) + if (npcModule != null) { UUID avatarId = UUID.Zero; if (!UUID.TryParse(avatar, out avatarId)) @@ -2163,14 +2168,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); - appearanceModule.SaveBakedTextures(avatarId); - ScenePresence sp = m_host.ParentGroup.Scene.GetScenePresence(avatarId); - OSDMap appearancePacked = sp.Appearance.Pack(); - - TaskInventoryItem item - = SaveNotecard(notecardName, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); - - return new LSL_Key(item.AssetID.ToString()); + return SaveAppearanceToNotecard(avatarId, notecardName); } return new LSL_Key(UUID.Zero.ToString()); @@ -2236,6 +2234,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api module.DeleteNPC(new UUID(npc.m_string), World); } } + + /// + /// Save the current appearance of the script owner permanently to the named notecard. + /// + /// The name of the notecard to which to save the appearance. + /// The asset ID of the notecard saved. + public LSL_Key osOwnerSaveAppearance(string notecardName) + { + CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); + + return SaveAppearanceToNotecard(m_host.OwnerID, notecardName); + } + + protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) + { + IAvatarFactory appearanceModule = World.RequestModuleInterface(); + + if (appearanceModule != null) + { + appearanceModule.SaveBakedTextures(m_host.OwnerID); + ScenePresence sp = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID); + OSDMap appearancePacked = sp.Appearance.Pack(); + + TaskInventoryItem item + = SaveNotecard(notecardName, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); + + return new LSL_Key(item.AssetID.ToString()); + } + else + { + return new LSL_Key(UUID.Zero.ToString()); + } + } /// /// Get current region's map texture UUID diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 868af27..92473ae 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -176,6 +176,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcSay(key npc, string message); void osNpcRemove(key npc); + LSL_Key osOwnerSaveAppearance(string notecardName); + key osGetMapTexture(); key osGetRegionMapTexture(string regionName); LSL_List osGetRegionStats(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 959b5d5..4b21c88 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -508,6 +508,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcRemove(npc); } + public LSL_Key osOwnerSaveAppearance(string notecardName) + { + return m_OSSL_Functions.osOwnerSaveAppearance(notecardName); + } + public OSSLPrim Prim; [Serializable] diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs new file mode 100644 index 0000000..fc8b551 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -0,0 +1,105 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenMetaverse.Assets; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Region.CoreModules.Avatar.AvatarFactory; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.ScriptEngine.Shared; +using OpenSim.Region.ScriptEngine.Shared.Api; +using OpenSim.Services.Interfaces; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.ScriptEngine.Shared.Tests +{ + /// + /// Tests for OSSL_Api + /// + [TestFixture] + public class OSSL_ApiAppearanceTest + { + [Test] + public void TestOsOwnerSaveAppearance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + IConfigSource initConfigSource = new IniConfigSource(); + IConfig config = initConfigSource.AddConfig("XEngine"); + config.Set("Enabled", "true"); + config.Set("AllowOSFunctions", "true"); + config.Set("OSFunctionThreatLevel", "Severe"); + + UUID userId = TestHelpers.ParseTail(0x1); + float newHeight = 1.9f; + + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, new AvatarFactoryModule()); + ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + sp.Appearance.AvatarHeight = newHeight; + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); + SceneObjectPart part = so.RootPart; + scene.AddSceneObject(so); + + XEngine.XEngine engine = new XEngine.XEngine(); + engine.Initialise(initConfigSource); + engine.AddRegion(scene); + + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(engine, part, part.LocalId, part.UUID); + + string notecardName = "appearanceNc"; + + osslApi.osOwnerSaveAppearance(notecardName); + + IList items = part.Inventory.GetInventoryItems(notecardName); + Assert.That(items.Count, Is.EqualTo(1)); + + TaskInventoryItem ncItem = items[0]; + Assert.That(ncItem.Name, Is.EqualTo(notecardName)); + + AssetBase ncAsset = scene.AssetService.Get(ncItem.AssetID.ToString()); + Assert.That(ncAsset, Is.Not.Null); + + AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data); + anc.Decode(); + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(anc.BodyText); + AvatarAppearance savedAppearance = new AvatarAppearance(); + savedAppearance.Unpack(appearanceOsd); + + Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight)); + } + } +} \ No newline at end of file diff --git a/prebuild.xml b/prebuild.xml index 9d1be3a..0884696 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3137,13 +3137,17 @@ + + + + -- cgit v1.1 From 92e96d394a1712ed16b0a7835dd2ccfde01f3fee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Aug 2011 23:11:07 +0100 Subject: When an NPC is created, stop telling neighbouring regions to expect a child agent --- OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++--- .../Framework/EntityTransfer/EntityTransferModule.cs | 6 +++++- OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 4 ++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 ++++++++---- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 4 ++-- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 8 ++------ OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 8 +------- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 7 ++++--- prebuild.xml | 3 +++ 11 files changed, 32 insertions(+), 30 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 481e1bb..15fc700 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -786,7 +786,7 @@ namespace OpenSim.Framework event DeRezObject OnDeRezObject; event Action OnRegionHandShakeReply; event GenericCall1 OnRequestWearables; - event GenericCall1 OnCompleteMovementToRegion; + event Action OnCompleteMovementToRegion; event UpdateAgent OnPreAgentUpdate; event UpdateAgent OnAgentUpdate; event AgentRequestSit OnAgentRequestSit; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4a36b5d..46d7f78 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -90,7 +90,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ObjectAttach OnObjectAttach; public event ObjectDeselect OnObjectDetach; public event ObjectDrop OnObjectDrop; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -6195,10 +6195,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) { - GenericCall1 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; + Action handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) { - handlerCompleteMovementToRegion(sender); + handlerCompleteMovementToRegion(sender, true); } handlerCompleteMovementToRegion = null; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 457ee33..f5d49c5 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1065,10 +1065,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #endregion #region Enable Child Agent + /// /// This informs a single neighbouring region about agent "avatar". /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// + /// + /// public void EnableChildAgent(ScenePresence sp, GridRegion region) { m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); @@ -1126,6 +1129,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// This informs all neighbouring regions about agent "avatar". /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// + /// public void EnableChildAgents(ScenePresence sp) { List neighbours = new List(); @@ -1312,7 +1316,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Utils.LongToUInts(reg.RegionHandle, out x, out y); x = x / Constants.RegionSize; y = y / Constants.RegionSize; - m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); + m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint + ")"); string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 4f58ab0..08023b8 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event DeRezObject OnDeRezObject; public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -663,7 +663,7 @@ namespace OpenSim.Region.Examples.SimpleModule if (OnCompleteMovementToRegion != null) { - OnCompleteMovementToRegion(this); + OnCompleteMovementToRegion(this, true); } } public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd5228d..af28dd9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1144,10 +1144,14 @@ namespace OpenSim.Region.Framework.Scenes /// /// Complete Avatar's movement into the region. - /// This is called upon a very important packet sent from the client, - /// so it's client-controlled. Never call this method directly. /// - public void CompleteMovement(IClientAPI client) + /// + /// + /// If true, send notification to neighbour regions to expect + /// a child agent from the client. These neighbours can be some distance away, depending right now on the + /// configuration of DefaultDrawDistance in the [Startup] section of config + /// + public void CompleteMovement(IClientAPI client, bool enableNeighbourChildAgents) { // DateTime startTime = DateTime.Now; @@ -1188,7 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes SendInitialData(); // Create child agents in neighbouring regions - if (!m_isChildAgent) + if (enableNeighbourChildAgents && !m_isChildAgent) { IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index a0c1ab1..8ebf9cb 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -677,7 +677,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event DeRezObject OnDeRezObject; public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -913,7 +913,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server if (OnCompleteMovementToRegion != null) { - OnCompleteMovementToRegion(this); + OnCompleteMovementToRegion(this, true); } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index dfc624d..b3e2495 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -190,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event DeRezObject OnDeRezObject; public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -745,12 +745,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC { OnRegionHandShakeReply(this); } - - if (OnCompleteMovementToRegion != null) - { - OnCompleteMovementToRegion(this); - } } + public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index d966345..88867f2 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -201,13 +201,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC m_log.DebugFormat( "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); - // Shouldn't call this - temporary. - sp.CompleteMovement(npcAvatar); - -// sp.SendAppearanceToAllOtherAgents(); -// -// // Send animations back to the avatar as well -// sp.Animator.SendAnimPack(); + sp.CompleteMovement(npcAvatar, false); } else { diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 070e390..8d2108c 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -383,7 +383,7 @@ namespace OpenSim.Tests.Common // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. ScenePresence scp = scene.GetScenePresence(agentData.AgentID); - scp.CompleteMovement(client); + scp.CompleteMovement(client, true); //scp.MakeRootAgent(new Vector3(90, 90, 90), true); return scp; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 88043f3..7ec6e10 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -95,7 +95,7 @@ namespace OpenSim.Tests.Common.Mock public event DeRezObject OnDeRezObject; public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -455,7 +455,7 @@ namespace OpenSim.Tests.Common.Mock public void CompleteMovement() { - OnCompleteMovementToRegion(this); + OnCompleteMovementToRegion(this, true); } public virtual void ActivateGesture(UUID assetId, UUID gestureId) @@ -759,9 +759,10 @@ namespace OpenSim.Tests.Common.Mock if (OnCompleteMovementToRegion != null) { - OnCompleteMovementToRegion(this); + OnCompleteMovementToRegion(this, true); } } + public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) { } diff --git a/prebuild.xml b/prebuild.xml index 0884696..220c008 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1680,6 +1680,7 @@ ../../../bin/ + @@ -2063,6 +2064,7 @@ + @@ -2717,6 +2719,7 @@ ../../../bin/ + -- cgit v1.1 From cba54090c759d1b21701179493f8399eb1b7a60f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Aug 2011 23:25:52 +0100 Subject: When an NPC appearance is loaded, rez the attachments too --- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 88867f2..068eec8 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -159,6 +159,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); sp.Appearance = npcAppearance; + sp.RezAttachments(); IAvatarFactory module = scene.RequestModuleInterface(); module.SendAppearance(sp.UUID); -- cgit v1.1 From 195c1dc9b8b8511980d9a607a242b24a5a91da17 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Aug 2011 00:26:38 +0100 Subject: implement osNpcStopMoveTo() to cancel any current move target --- .../Avatar/Attachments/AttachmentsModule.cs | 4 +-- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 19 ++++++++--- .../Region/OptionalModules/World/NPC/NPCModule.cs | 37 ++++++++++++++++++++-- .../Shared/Api/Implementation/OSSL_Api.cs | 9 ++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++ 6 files changed, 66 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1e09610..ebb5bd2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -566,8 +566,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) { - m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name, - attachmentpoint, attachOffset, so.RootPart.AttachedPos); + m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", + so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); so.DetachFromBackup(); diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 54575ca..763d2dc 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene); /// @@ -67,7 +67,16 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the NPC /// /// - void MoveToTarget(UUID agentID, Scene scene, Vector3 pos); + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos); + + /// + /// Stop the NPC's current movement. + /// + /// The UUID of the NPC + /// + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + bool StopMoveToTarget(UUID agentID, Scene scene); /// /// Get the NPC to say something. @@ -75,13 +84,15 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the NPC /// /// - void Say(UUID agentID, Scene scene, string text); + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + bool Say(UUID agentID, Scene scene, string text); /// /// Delete an NPC. /// /// The UUID of the NPC /// - void DeleteNPC(UUID agentID, Scene scene); + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + bool DeleteNPC(UUID agentID, Scene scene); } } \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 068eec8..87cb322 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -217,7 +217,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC return npcAvatar.AgentId; } - public void MoveToTarget(UUID agentID, Scene scene, Vector3 pos) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos) { lock (m_avatars) { @@ -230,22 +230,49 @@ namespace OpenSim.Region.OptionalModules.World.NPC "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); sp.MoveToTarget(pos); + + return true; + } + } + + return false; + } + + public bool StopMoveToTarget(UUID agentID, Scene scene) + { + lock (m_avatars) + { + if (m_avatars.ContainsKey(agentID)) + { + ScenePresence sp; + scene.TryGetScenePresence(agentID, out sp); + + sp.Velocity = Vector3.Zero; + sp.ResetMoveToTarget(); + + return true; } } + + return false; } - public void Say(UUID agentID, Scene scene, string text) + public bool Say(UUID agentID, Scene scene, string text) { lock (m_avatars) { if (m_avatars.ContainsKey(agentID)) { m_avatars[agentID].Say(text); + + return true; } } + + return false; } - public void DeleteNPC(UUID agentID, Scene scene) + public bool DeleteNPC(UUID agentID, Scene scene) { lock (m_avatars) { @@ -253,8 +280,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC { scene.RemoveClient(agentID); m_avatars.Remove(agentID); + + return true; } } + + return false; } public void PostInitialise() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a05c623..9c32029 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2213,6 +2213,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osNpcStopMoveTo(LSL_Key npc) + { + CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + module.StopMoveToTarget(new UUID(npc.m_string), World); + } + public void osNpcSay(LSL_Key npc, string message) { CheckThreatLevel(ThreatLevel.High, "osNpcSay"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 92473ae..ab0097a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -173,6 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Key osNpcSaveAppearance(string avatar, string notecardName); void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); + void osNpcStopMoveTo(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 4b21c88..a7843dd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -498,6 +498,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveTo(npc, position); } + public void osNpcStopMoveTo(LSL_Key npc) + { + m_OSSL_Functions.osNpcStopMoveTo(npc); + } + public void osNpcSay(key npc, string message) { m_OSSL_Functions.osNpcSay(npc, message); -- cgit v1.1 From 4cb8d6379ddb39cfb8b30a63475e154a00a78110 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Aug 2011 00:59:31 +0100 Subject: Stop trying to deregister caps or close child agents when an NPC is removed --- OpenSim/Framework/IScene.cs | 13 ++++++++++++- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++-------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 12 +----------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +++--- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 1298f26..b5f975b 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -70,8 +70,19 @@ namespace OpenSim.Framework event restart OnRestart; + /// + /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing + /// will promote it to a root agent during login. + /// + /// + /// Remove the given client from the scene. + /// + /// + /// Close the neighbour child agents associated with this client. + void RemoveClient(UUID agentID, bool closeChildAgents); void Restart(); //RegionInfo OtherRegionUp(RegionInfo thisRegion); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 46d7f78..977918a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -512,7 +512,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.Flush(m_udpClient); // Remove ourselves from the scene - m_scene.RemoveClient(AgentId); + m_scene.RemoveClient(AgentId, true); // We can't reach into other scenes and close the connection // We need to do this over grid communications diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b3b6cbc..9aa9bf5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3091,11 +3091,7 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Remove the given client from the scene. - /// - /// - public override void RemoveClient(UUID agentID) + public override void RemoveClient(UUID agentID, bool closeChildAgents) { CheckHeartbeat(); bool childagentYN = false; @@ -3116,15 +3112,17 @@ namespace OpenSim.Region.Framework.Scenes (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); m_sceneGraph.removeUserCount(!childagentYN); - - if (CapsModule != null) + + // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop + // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI + if (closeChildAgents && CapsModule != null) CapsModule.RemoveCaps(agentID); // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever // this method is doing is HORRIBLE!!! avatar.Scene.NeedSceneCacheClear(avatar.UUID); - if (!avatar.IsChildAgent) + if (closeChildAgents && !avatar.IsChildAgent) { //List childknownRegions = new List(); //List ckn = avatar.KnownChildRegionHandles; @@ -3136,6 +3134,7 @@ namespace OpenSim.Region.Framework.Scenes regions.Remove(RegionInfo.RegionHandle); m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); } + m_eventManager.TriggerClientClosed(agentID, this); } catch (NullReferenceException) diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index c4547f2..2f1cdc1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -175,18 +175,8 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Agent/Avatar - /// - /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing - /// will promote it to a root agent during login. - /// - /// - /// Remove a client from the scene - /// - /// - public abstract void RemoveClient(UUID agentID); + public abstract void RemoveClient(UUID agentID, bool closeChildAgents); public bool TryGetScenePresence(UUID agentID, out object scenePresence) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index af28dd9..2db83eb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1146,12 +1146,12 @@ namespace OpenSim.Region.Framework.Scenes /// Complete Avatar's movement into the region. /// /// - /// + /// /// If true, send notification to neighbour regions to expect /// a child agent from the client. These neighbours can be some distance away, depending right now on the /// configuration of DefaultDrawDistance in the [Startup] section of config /// - public void CompleteMovement(IClientAPI client, bool enableNeighbourChildAgents) + public void CompleteMovement(IClientAPI client, bool openChildAgents) { // DateTime startTime = DateTime.Now; @@ -1192,7 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes SendInitialData(); // Create child agents in neighbouring regions - if (enableNeighbourChildAgents && !m_isChildAgent) + if (openChildAgents && !m_isChildAgent) { IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 87cb322..7b9457a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -278,7 +278,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { if (m_avatars.ContainsKey(agentID)) { - scene.RemoveClient(agentID); + scene.RemoveClient(agentID, false); m_avatars.Remove(agentID); return true; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 7ec6e10..dd5f6fe 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -887,7 +887,7 @@ namespace OpenSim.Tests.Common.Mock public void Close() { - m_scene.RemoveClient(AgentId); + m_scene.RemoveClient(AgentId, true); } public void Start() -- cgit v1.1 From 5d6c9644faf6aeac38410af9cff97adfef88d7aa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Aug 2011 01:47:37 +0100 Subject: early code to allow scripts to force npcs not to fly when moving to target this is to allow walking on prims. it will be up to the script writer to be sure that there is a continuous path. currently implemented in osNpcMoveToTarget(), but none of this is final. --- OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs | 2 +- OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++--- OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 +- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 6 +++++- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 +++++++-- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 2 +- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 +- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 4 ++-- .../OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 4 ++-- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 +++++++++++++- .../Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 15 files changed, 45 insertions(+), 18 deletions(-) diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs index de2049f..1023108 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs @@ -169,7 +169,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]); float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]); Vector3 vector = new Vector3(x, y, z); - presence.MoveToTarget(vector); + presence.MoveToTarget(vector, false); } catch (Exception e) { diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 15fc700..a0d10ed 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -935,7 +935,7 @@ namespace OpenSim.Framework event ScriptReset OnScriptReset; event GetScriptRunning OnGetScriptRunning; event SetScriptRunning OnSetScriptRunning; - event Action OnAutoPilotGo; + event Action OnAutoPilotGo; event TerrainUnacked OnUnackedTerrain; event ActivateGesture OnActivateGesture; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 977918a..1d35973 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -231,7 +231,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; public event ActivateGesture OnActivateGesture; public event DeactivateGesture OnDeactivateGesture; @@ -11628,9 +11628,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP locy = Convert.ToSingle(args[1]) - (float)regionY; locz = Convert.ToSingle(args[2]); - Action handlerAutoPilotGo = OnAutoPilotGo; + Action handlerAutoPilotGo = OnAutoPilotGo; if (handlerAutoPilotGo != null) - handlerAutoPilotGo(new Vector3(locx, locy, locz)); + handlerAutoPilotGo(new Vector3(locx, locy, locz), false); } /// diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 08023b8..c87790f 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -222,7 +222,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 763d2dc..06296c9 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -67,8 +67,12 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the NPC /// /// + /// + /// If true, then the avatar will attempt to walk to the location even if it's up in the air. + /// This is to allow walking on prims. + /// /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC - bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos); + bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly); /// /// Stop the NPC's current movement. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3b6a458..fe96152 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); if (avatar != null) { - avatar.MoveToTarget(target); + avatar.MoveToTarget(target, false); } } else diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2db83eb..b8e4e93 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1684,7 +1684,12 @@ namespace OpenSim.Region.Framework.Scenes /// Move to the given target over time. /// /// - public void MoveToTarget(Vector3 pos) + /// + /// If true, then don't allow the avatar to fly to the target, even if it's up in the air. + /// This is to allow movement to targets that are known to be on an elevated platform with a continuous path + /// from start to finish. + /// + public void MoveToTarget(Vector3 pos, bool noFly) { // m_log.DebugFormat( // "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", @@ -1718,7 +1723,7 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); - if (pos.Z > terrainHeight) + if (!noFly && pos.Z > terrainHeight) PhysicsActor.Flying = true; MovingToTarget = true; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 8ebf9cb..15201da 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -806,7 +806,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; public event ActivateGesture OnActivateGesture; public event DeactivateGesture OnDeactivateGesture; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index b3e2495..cfd692d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -328,7 +328,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 7b9457a..d0b5a94 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -217,7 +217,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC return npcAvatar.AgentId; } - public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly) { lock (m_avatars) { @@ -229,7 +229,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC m_log.DebugFormat( "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); - sp.MoveToTarget(pos); + sp.MoveToTarget(pos, noFly); return true; } diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 2ec354f..81497d5 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Vector3 targetPos = startPos + new Vector3(0, 0, 10); - npcModule.MoveToTarget(npc.UUID, scene, targetPos); + npcModule.MoveToTarget(npc.UUID, scene, targetPos, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); @@ -135,7 +135,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // Try a second movement startPos = npc.AbsolutePosition; targetPos = startPos + new Vector3(10, 0, 0); - npcModule.MoveToTarget(npc.UUID, scene, targetPos); + npcModule.MoveToTarget(npc.UUID, scene, targetPos, false); scene.Update(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9c32029..63c882d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2209,7 +2209,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); - module.MoveToTarget(new UUID(npc.m_string), World, pos); + module.MoveToTarget(new UUID(npc.m_string), World, pos, false); + } + } + + public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int noFly) + { + CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); + module.MoveToTarget(new UUID(npc.m_string), World, pos, noFly != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index ab0097a..56be9d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -173,6 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Key osNpcSaveAppearance(string avatar, string notecardName); void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); + void osNpcMoveToTarget(key npc, vector position, int noFly); void osNpcStopMoveTo(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index a7843dd..c745e5c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -498,6 +498,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveTo(npc, position); } + public void osNpcMoveToTarget(key npc, vector position, int noFly) + { + m_OSSL_Functions.osNpcMoveToTarget(npc, position, noFly); + } + public void osNpcStopMoveTo(LSL_Key npc) { m_OSSL_Functions.osNpcStopMoveTo(npc); diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index dd5f6fe..7b64947 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -234,7 +234,7 @@ namespace OpenSim.Tests.Common.Mock public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; -- cgit v1.1 From fb92678b83dca1c1f64cc91f3ac887170408a455 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Aug 2011 22:34:42 +0100 Subject: fly and no fly constants for osNpcMoveToTarget() --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 63c882d..9b5d8d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2220,7 +2220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); + Vector3 pos = new Vector3((float)position.x, (float)position.y, (float)position.z); module.MoveToTarget(new UUID(npc.m_string), World, pos, noFly != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 3f90788..9ed894c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -591,6 +591,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int STATS_ACTIVE_SCRIPTS = 19; public const int STATS_SCRIPT_LPS = 20; + // Constants for osNpc* functions + public const int OS_NPC_FLY = 0; + public const int OS_NPC_NO_FLY = 1; + public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; -- cgit v1.1 From 7f499ff3f386d57bcd81ebb3f58f110011100604 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Aug 2011 23:56:19 +0100 Subject: Add a OS_NPC_LAND_AT_TARGET option to osMoveToTarget() Default for this function is now not to automatically land. This allows better control by scripts when an avatar is going to be landing on a prim rather than the ground. Stopping the avatar involves faking a collision, to avoid the pid controller making it overshoot. A better approach would be to gradually slow the avatar as we near the target --- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 5 +++- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 5 ++++ .../Region/OptionalModules/World/NPC/NPCModule.cs | 33 ++++++++++++++-------- .../World/NPC/Tests/NPCModuleTests.cs | 4 +-- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 2 ++ .../Shared/Api/Implementation/OSSL_Api.cs | 11 ++++++-- .../Shared/Api/Runtime/LSL_Constants.cs | 1 + 7 files changed, 44 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 06296c9..08b973d 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -71,8 +71,11 @@ namespace OpenSim.Region.Framework.Interfaces /// If true, then the avatar will attempt to walk to the location even if it's up in the air. /// This is to allow walking on prims. /// + /// + /// If true and the avatar is flying when it reaches the target, land. + /// /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC - bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly); + bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget); /// /// Stop the NPC's current movement. diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index cfd692d..d63c2a6 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -37,6 +37,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC { public class NPCAvatar : IClientAPI { + /// + /// Signal whether the avatar should land when it reaches a move target + /// + public bool LandAtTarget { get; set; } + private readonly string m_firstname; private readonly string m_lastname; private readonly Vector3 m_startPos; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index d0b5a94..f38af46 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -75,19 +75,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC // We are close enough to the target m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name); + presence.Velocity = Vector3.Zero; + presence.AbsolutePosition = presence.MoveToPositionTarget; + presence.ResetMoveToTarget(); + if (presence.PhysicsActor.Flying) { - Vector3 targetPos = presence.MoveToPositionTarget; - float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; - if (targetPos.Z - terrainHeight < 0.2) - { + for (int i = 0; i < 5; i++) + presence.PhysicsActor.IsColliding = true; + +// Vector3 targetPos = presence.MoveToPositionTarget; + if (m_avatars[presence.UUID].LandAtTarget) presence.PhysicsActor.Flying = false; - } - } - presence.Velocity = Vector3.Zero; - presence.AbsolutePosition = presence.MoveToPositionTarget; - presence.ResetMoveToTarget(); +// float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; +// if (targetPos.Z - terrainHeight < 0.2) +// { +// presence.PhysicsActor.Flying = false; +// } + } // FIXME: This doesn't work if (presence.PhysicsActor.Flying) @@ -217,7 +223,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC return npcAvatar.AgentId; } - public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) { lock (m_avatars) { @@ -227,8 +233,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC scene.TryGetScenePresence(agentID, out sp); m_log.DebugFormat( - "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); + "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", + sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); + m_avatars[agentID].LandAtTarget = landAtTarget; sp.MoveToTarget(pos, noFly); return true; @@ -263,6 +271,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC { if (m_avatars.ContainsKey(agentID)) { + ScenePresence sp; + scene.TryGetScenePresence(agentID, out sp); + m_avatars[agentID].Say(text); return true; diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 81497d5..d220fab 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Vector3 targetPos = startPos + new Vector3(0, 0, 10); - npcModule.MoveToTarget(npc.UUID, scene, targetPos, false); + npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); @@ -135,7 +135,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // Try a second movement startPos = npc.AbsolutePosition; targetPos = startPos + new Vector3(10, 0, 0); - npcModule.MoveToTarget(npc.UUID, scene, targetPos, false); + npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); scene.Update(); diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 4f461ad..ecf5983 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -305,10 +305,12 @@ namespace OpenSim.Region.Physics.OdePlugin { m_iscolliding = true; } + if (m_wascolliding != m_iscolliding) { //base.SendCollisionUpdate(new CollisionEventUpdate()); } + m_wascolliding = m_iscolliding; } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9b5d8d9..f83304b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2209,11 +2209,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); - module.MoveToTarget(new UUID(npc.m_string), World, pos, false); + module.MoveToTarget(new UUID(npc.m_string), World, pos, false, true); } } - public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int noFly) + public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int moveParams) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); @@ -2221,7 +2221,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { Vector3 pos = new Vector3((float)position.x, (float)position.y, (float)position.z); - module.MoveToTarget(new UUID(npc.m_string), World, pos, noFly != 0); + module.MoveToTarget( + new UUID(npc.m_string), + World, + pos, + (moveParams & ScriptBaseClass.OS_NPC_NO_FLY) != 0, + (moveParams & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 9ed894c..e82c281 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -594,6 +594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase // Constants for osNpc* functions public const int OS_NPC_FLY = 0; public const int OS_NPC_NO_FLY = 1; + public const int OS_NPC_LAND_AT_TARGET = 2; public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; -- cgit v1.1 From 951ffad81e15a35bc9f847ea1448dd247a2e6e6f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 00:23:54 +0100 Subject: If SP.MoveToTarget has been called with a force walk, begin by landing the avatar. There is a bug here - once an avatar has landed it glides to its new position instead of performing a walk animation --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b8e4e93..12a4712 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1723,7 +1723,9 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); - if (!noFly && pos.Z > terrainHeight) + if (noFly) + PhysicsActor.Flying = false; + else if (pos.Z > terrainHeight) PhysicsActor.Flying = true; MovingToTarget = true; diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index ecf5983..0a0d13f 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -258,7 +258,11 @@ namespace OpenSim.Region.Physics.OdePlugin public override bool Flying { get { return flying; } - set { flying = value; } + set + { + flying = value; +// m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); + } } /// -- cgit v1.1 From 4402851b086e7faf0d441d2ae0d5f6a3e1ea04b8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 01:56:42 +0100 Subject: Get NPCs to revert to the correct 'resting' animation (e.g. stand or hover) after finishing their movement. This also fixes judder after an avatar has finished "go here"/autopilot movement in a viewer. This meant reseting the SP.AgentControlFlags since the Animator uses these to determine the correct default animation. --- .../Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 10 ++++++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++++ OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 8 +++----- .../Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 1 + .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 4ab818f..e07d8b4 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; +// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); + if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) SendAnimPack(); } @@ -91,6 +93,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (animID == UUID.Zero) return; +// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name); + AddAnimation(animID, objectID); } @@ -127,13 +131,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// public void TrySetMovementAnimation(string anim) { - //m_log.DebugFormat("Updating movement animation to {0}", anim); - if (!m_scenePresence.IsChildAgent) { if (m_animations.TrySetDefaultAnimation( anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) { +// m_log.DebugFormat( +// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}", +// anim, m_scenePresence.Name); + // 16384 is CHANGED_ANIMATION m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); SendAnimPack(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 12a4712..7a30684 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1745,6 +1745,12 @@ namespace OpenSim.Region.Framework.Scenes MovingToTarget = false; MoveToPositionTarget = Vector3.Zero; + + // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct + // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag. + // However, the line is here rather than in the NPC module since it also appears necessary to stop a + // viewer that uses "go here" from juddering on all subsequent avatar movements. + AgentControlFlags = (uint)AgentManager.ControlFlags.NONE; } private void CheckAtSitTarget() diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index f38af46..0e313df 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -95,11 +95,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC // } } - // FIXME: This doesn't work - if (presence.PhysicsActor.Flying) - presence.Animator.TrySetMovementAnimation("HOVER"); - else - presence.Animator.TrySetMovementAnimation("STAND"); +// m_log.DebugFormat( +// "[NPC MODULE]: AgentControlFlags {0}, MovementFlag {1} for {2}", +// presence.AgentControlFlags, presence.MovementFlag, presence.Name); } else { diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index d220fab..2742b67 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -131,6 +131,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); + Assert.That(npc.AgentControlFlags, Is.EqualTo((uint)AgentManager.ControlFlags.NONE)); // Try a second movement startPos = npc.AbsolutePosition; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f83304b..71fc15f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -870,7 +870,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence target = (ScenePresence)World.Entities[avatarID]; if (target != null) { - UUID animID=UUID.Zero; + UUID animID = UUID.Zero; lock (m_host.TaskInventory) { foreach (KeyValuePair inv in m_host.TaskInventory) -- cgit v1.1 From cace6eaa8a82018fbb21ab83ce1bf95ea0a1e154 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 02:06:32 +0100 Subject: comment out some of the currently less useful debug log messages --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 4 ++-- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 4 ++-- .../CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs | 3 ++- .../CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs | 2 +- OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 8db4e67..ff889ea 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -232,7 +232,7 @@ namespace OpenSim.Region.ClientStack.Linden public string SeedCapRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { - m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); +// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index e0807ee..22c05c4 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -118,7 +118,7 @@ namespace OpenSim.Region.ClientStack.Linden //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { - m_log.InfoFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), delegate(Hashtable m_dhttpMethod) @@ -130,7 +130,7 @@ namespace OpenSim.Region.ClientStack.Linden } else { - m_log.InfoFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetMesh", m_URL); } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 35eedb4..24ab06a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -128,12 +128,12 @@ namespace OpenSim.Region.ClientStack.Linden //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { - m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); } else { - m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetTexture", m_URL); } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs index 6543845..d6063ad 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs @@ -93,7 +93,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser lookat = ((ScenePresence)sp).Lookat; } } - m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); + +// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index fa5b873..59a407f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence } } - m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); +// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); m_PresenceService.LogoutAgent(client.SessionId); } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs index b8703c6..2267325 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs @@ -97,7 +97,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } } - m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); +// m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); } } -- cgit v1.1 From ee22569c9262277467df9a4b15674a1472fa0b71 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 02:19:13 +0100 Subject: only accept npc UUIDs to osNpc* functions, not names (except for create) --- .../Shared/Api/Implementation/OSSL_Api.cs | 26 +++++++++------------- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 6 ++--- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 12 +++++----- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 71fc15f..91ac3b7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2153,7 +2153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// The name of the notecard to which to save the appearance. /// The asset ID of the notecard saved. - public LSL_Key osNpcSaveAppearance(string avatar, string notecardName) + public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecardName) { CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); @@ -2161,20 +2161,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID avatarId = UUID.Zero; - if (!UUID.TryParse(avatar, out avatarId)) - return new LSL_Key(UUID.Zero.ToString()); + UUID npcId = new UUID(npc.m_string); - if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); - return SaveAppearanceToNotecard(avatarId, notecardName); + return SaveAppearanceToNotecard(npcId, notecardName); } return new LSL_Key(UUID.Zero.ToString()); } - public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + public void osNpcLoadAppearance(LSL_Key npc, string notecardNameOrUuid) { CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); @@ -2182,11 +2180,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID avatarId = UUID.Zero; - if (!UUID.TryParse(avatar, out avatarId)) - return; + UUID npcId = new UUID(npc.m_string); - if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return; string appearanceSerialized = LoadNotecard(notecardNameOrUuid); @@ -2197,7 +2193,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AvatarAppearance appearance = new AvatarAppearance(); appearance.Unpack(appearanceOsd); - npcModule.SetNPCAppearance(avatarId, appearance, m_host.ParentGroup.Scene); + npcModule.SetNPCAppearance(npcId, appearance, m_host.ParentGroup.Scene); } } @@ -2213,7 +2209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int moveParams) + public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int options) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); @@ -2225,8 +2221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api new UUID(npc.m_string), World, pos, - (moveParams & ScriptBaseClass.OS_NPC_NO_FLY) != 0, - (moveParams & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); + (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, + (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 56be9d9..f4a618b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -170,10 +170,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces key osNpcCreate(string user, string name, vector position, key cloneFrom); - LSL_Key osNpcSaveAppearance(string avatar, string notecardName); - void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); + LSL_Key osNpcSaveAppearance(key npc, string notecardName); + void osNpcLoadAppearance(key npc, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); - void osNpcMoveToTarget(key npc, vector position, int noFly); + void osNpcMoveToTarget(key npc, vector position, int options); void osNpcStopMoveTo(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index c745e5c..84d61f4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -483,14 +483,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); } - public key osNpcSaveAppearance(string avatar, string notecardName) + public key osNpcSaveAppearance(key npc, string notecardName) { - return m_OSSL_Functions.osNpcSaveAppearance(avatar, notecardName); + return m_OSSL_Functions.osNpcSaveAppearance(npc, notecardName); } - public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + public void osNpcLoadAppearance(key npc, string notecardNameOrUuid) { - m_OSSL_Functions.osNpcLoadAppearance(avatar, notecardNameOrUuid); + m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid); } public void osNpcMoveTo(key npc, vector position) @@ -498,9 +498,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveTo(npc, position); } - public void osNpcMoveToTarget(key npc, vector position, int noFly) + public void osNpcMoveToTarget(key npc, vector position, int options) { - m_OSSL_Functions.osNpcMoveToTarget(npc, position, noFly); + m_OSSL_Functions.osNpcMoveToTarget(npc, position, options); } public void osNpcStopMoveTo(LSL_Key npc) -- cgit v1.1 From 29093df1a7f3d2816d1b446524b2de18b0b5ac45 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 02:36:02 +0100 Subject: get rid of intermediate local store of body rotation in ScenePresence, this is not used. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7a30684..e28d1fe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -173,7 +173,7 @@ namespace OpenSim.Region.Framework.Scenes private float m_speedModifier = 1.0f; - private Quaternion m_bodyRot= Quaternion.Identity; + private Quaternion m_bodyRot = Quaternion.Identity; private Quaternion m_bodyRotPrevious = Quaternion.Identity; @@ -1397,7 +1397,6 @@ namespace OpenSim.Region.Framework.Scenes bool update_rotation = false; bool DCFlagKeyPressed = false; Vector3 agent_control_v3 = Vector3.Zero; - Quaternion q = bodyRotation; bool oldflying = PhysicsActor.Flying; @@ -1411,9 +1410,9 @@ namespace OpenSim.Region.Framework.Scenes if (actor.Flying != oldflying) update_movementflag = true; - if (q != m_bodyRot) + if (bodyRotation != m_bodyRot) { - m_bodyRot = q; + m_bodyRot = bodyRotation; update_rotation = true; } @@ -1535,7 +1534,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); - AddNewMovement(agent_control_v3, q); + AddNewMovement(agent_control_v3, bodyRotation); } if (update_movementflag -- cgit v1.1 From 36f7d36fa1556d2b9356bc9bc5d9b16fc81eb96a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 02:54:15 +0100 Subject: instead of setting avatar rotation twice in SP.HandleAgentUpdate(), eliminate the second setting in AddNewMovement() --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 30 ++++++++++------------ .../Region/OptionalModules/World/NPC/NPCModule.cs | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e28d1fe..a1bd672 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1298,7 +1298,6 @@ namespace OpenSim.Region.Framework.Scenes #region Inputs AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; - Quaternion bodyRotation = agentData.BodyRotation; // Camera location in world. We'll need to raytrace // from this location from time to time. @@ -1384,6 +1383,15 @@ namespace OpenSim.Region.Framework.Scenes if (m_allowMovement && !SitGround) { + Quaternion bodyRotation = agentData.BodyRotation; + bool update_rotation = false; + + if (bodyRotation != m_bodyRot) + { + Rotation = bodyRotation; + update_rotation = true; + } + bool update_movementflag = false; if (agentData.UseClientAgentPosition) @@ -1393,8 +1401,6 @@ namespace OpenSim.Region.Framework.Scenes } int i = 0; - - bool update_rotation = false; bool DCFlagKeyPressed = false; Vector3 agent_control_v3 = Vector3.Zero; @@ -1410,12 +1416,6 @@ namespace OpenSim.Region.Framework.Scenes if (actor.Flying != oldflying) update_movementflag = true; - if (bodyRotation != m_bodyRot) - { - m_bodyRot = bodyRotation; - update_rotation = true; - } - if (m_parentID == 0) { bool bAllowUpdateMoveToPosition = false; @@ -1467,8 +1467,8 @@ namespace OpenSim.Region.Framework.Scenes ) // This or is for Nudge forward { m_movementflag -= ((byte)(uint)DCF); - update_movementflag = true; + /* if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) && ((m_movementflag & (byte)nudgehack) == nudgehack)) @@ -1534,7 +1534,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); - AddNewMovement(agent_control_v3, bodyRotation); + AddNewMovement(agent_control_v3); } if (update_movementflag @@ -1732,7 +1732,7 @@ namespace OpenSim.Region.Framework.Scenes Vector3 agent_control_v3 = new Vector3(); HandleMoveToTargetUpdate(ref agent_control_v3, Rotation); - AddNewMovement(agent_control_v3, Rotation); + AddNewMovement(agent_control_v3); } /// @@ -2311,13 +2311,11 @@ namespace OpenSim.Region.Framework.Scenes /// Rotate the avatar to the given rotation and apply a movement in the given relative vector /// /// The vector in which to move. This is relative to the rotation argument - /// The direction in which this avatar should now face. - public void AddNewMovement(Vector3 vec, Quaternion rotation) + public void AddNewMovement(Vector3 vec) { m_perfMonMS = Util.EnvironmentTickCount(); - Rotation = rotation; - Vector3 direc = vec * rotation; + Vector3 direc = vec * Rotation; direc.Normalize(); direc *= 0.03f * 128f * m_speedModifier; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 0e313df..9b86abb 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC Vector3 agent_control_v3 = new Vector3(); presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation); - presence.AddNewMovement(agent_control_v3, presence.Rotation); + presence.AddNewMovement(agent_control_v3); } // //// presence.DoMoveToPositionUpdate((0, presence.MoveToPositionTarget, null); -- cgit v1.1 From 1aa171189397f34d7d18fb358f7bd767d241675a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 03:05:51 +0100 Subject: eliminate the rotation parameter from SP.HandleMoveToTargetUpdate(). This can just use the currently set Rotation looks like I spoke to soon about eliminating jerkiness on "go here"/autopilot. It's still there. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++++----- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 7 ++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a1bd672..afa896c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1496,7 +1496,7 @@ namespace OpenSim.Region.Framework.Scenes } else if (bAllowUpdateMoveToPosition) { - if (HandleMoveToTargetUpdate(ref agent_control_v3, bodyRotation)) + if (HandleMoveToTargetUpdate(ref agent_control_v3)) update_movementflag = true; } } @@ -1556,9 +1556,8 @@ namespace OpenSim.Region.Framework.Scenes /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3. /// /// Cumulative agent movement that this method will update. - /// New body rotation of the avatar. /// True if movement has been updated in some way. False otherwise. - public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3, Quaternion bodyRotation) + public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) { // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); @@ -1594,7 +1593,7 @@ namespace OpenSim.Region.Framework.Scenes // to such forces, but the following simple approach seems to works fine. Vector3 LocalVectorToTarget3D = (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords - * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords + * Matrix4.CreateFromQuaternion(Quaternion.Inverse(Rotation)); // change to avatar coords // Ignore z component of vector // Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); LocalVectorToTarget3D.Normalize(); @@ -1731,7 +1730,7 @@ namespace OpenSim.Region.Framework.Scenes MoveToPositionTarget = pos; Vector3 agent_control_v3 = new Vector3(); - HandleMoveToTargetUpdate(ref agent_control_v3, Rotation); + HandleMoveToTargetUpdate(ref agent_control_v3); AddNewMovement(agent_control_v3); } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 9b86abb..580d7ef 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -81,6 +81,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC if (presence.PhysicsActor.Flying) { + // A horrible hack to stop the NPC dead in its tracks rather than having them overshoot + // the target if flying. + // We really need to be more subtle (slow the avatar as it approaches the target) or at + // least be able to set collision status once, rather than 5 times to give it enough + // weighting so that that PhysicsActor thinks it really is colliding. for (int i = 0; i < 5; i++) presence.PhysicsActor.IsColliding = true; @@ -106,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); Vector3 agent_control_v3 = new Vector3(); - presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation); + presence.HandleMoveToTargetUpdate(ref agent_control_v3); presence.AddNewMovement(agent_control_v3); } // -- cgit v1.1 From 3d4cc93a8e46847d4852eb3fd038ec48c284c18e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 03:07:41 +0100 Subject: minor: a little bit of log message correction/commenting out --- OpenSim/Data/Null/NullRegionData.cs | 2 +- OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index 53e5207..11013c1 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs @@ -97,7 +97,7 @@ namespace OpenSim.Data.Null foreach (RegionData r in m_regionData.Values) { - m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); +// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); if (queryMatch(r.RegionName.ToLower())) ret.Add(r); } diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index aa14054..1d2141e 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs @@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap private Bitmap fetchTexture(UUID id) { AssetBase asset = m_scene.AssetService.Get(id.ToString()); - m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null); + m_log.DebugFormat("[TexturedMapTileRenderer]: Fetched texture {0}, found: {1}", id, asset != null); if (asset == null) return null; ManagedImage managedImage; -- cgit v1.1 From b3a4b1053157d65d0068bf5b3362dc28da4be85a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 03:16:46 +0100 Subject: eliminate redundant ground sitting checks since these are already done in enclosing control structures --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index afa896c..18632d7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1537,10 +1537,7 @@ namespace OpenSim.Region.Framework.Scenes AddNewMovement(agent_control_v3); } - if (update_movementflag - && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) - && (m_parentID == 0) - && !SitGround) + if (update_movementflag && m_parentID == 0) Animator.UpdateMovementAnimations(); } -- cgit v1.1 From 5d694a224f770ca734574e5ada0793745b43ca2c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 20:05:11 +0100 Subject: Add missing System.Xml reference which is required to build on Windows but not mono --- prebuild.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/prebuild.xml b/prebuild.xml index 220c008..dff54a3 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3138,6 +3138,7 @@ ../../../bin/ + -- cgit v1.1 From 83ca5a101d5578282ba0fd7177fcb618f70d3cc9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 20:56:18 +0100 Subject: Split out to-be-common setup stuff from TestOsOwnerSaveAppearance() --- .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 48 +++++++++++++++------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index fc8b551..2218a1f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -50,35 +50,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [TestFixture] public class OSSL_ApiAppearanceTest { - [Test] - public void TestOsOwnerSaveAppearance() - { - TestHelpers.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); + protected Scene m_scene; + protected XEngine.XEngine m_engine; + [SetUp] + public void SetUp() + { IConfigSource initConfigSource = new IniConfigSource(); IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); config.Set("AllowOSFunctions", "true"); config.Set("OSFunctionThreatLevel", "Severe"); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, new AvatarFactoryModule()); + + m_engine = new XEngine.XEngine(); + m_engine.Initialise(initConfigSource); + m_engine.AddRegion(m_scene); + } + + /// + /// Test creation of an NPC where the appearance data comes from a notecard + /// +// [Test] +// public void TestOsNpcCreateFromNotecard() +// { +// TestHelpers.InMethod(); +//// log4net.Config.XmlConfigurator.Configure(); +// } + + [Test] + public void TestOsOwnerSaveAppearance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + UUID userId = TestHelpers.ParseTail(0x1); float newHeight = 1.9f; - Scene scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(scene, new AvatarFactoryModule()); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); sp.Appearance.AvatarHeight = newHeight; SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); SceneObjectPart part = so.RootPart; - scene.AddSceneObject(so); - - XEngine.XEngine engine = new XEngine.XEngine(); - engine.Initialise(initConfigSource); - engine.AddRegion(scene); + m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); - osslApi.Initialize(engine, part, part.LocalId, part.UUID); + osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); string notecardName = "appearanceNc"; @@ -90,7 +108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests TaskInventoryItem ncItem = items[0]; Assert.That(ncItem.Name, Is.EqualTo(notecardName)); - AssetBase ncAsset = scene.AssetService.Get(ncItem.AssetID.ToString()); + AssetBase ncAsset = m_scene.AssetService.Get(ncItem.AssetID.ToString()); Assert.That(ncAsset, Is.Not.Null); AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data); -- cgit v1.1 From 50945dd56029a1280c581ea9b29213ab0e162a0a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 21:43:26 +0100 Subject: add regression test for osNpcCreate when cloning an in-region avatar --- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 4 +- .../Region/OptionalModules/World/NPC/NPCModule.cs | 29 +------- .../World/NPC/Tests/NPCModuleTests.cs | 10 +-- .../Shared/Api/Implementation/OSSL_Api.cs | 6 +- .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 79 ++++++++++++++++++++-- prebuild.xml | 2 + 6 files changed, 89 insertions(+), 41 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 08b973d..5e5c4a1 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -40,9 +40,9 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// The UUID of the avatar from which to clone the NPC's appearance from. + /// The avatar appearance to use for the new NPC. /// The UUID of the ScenePresence created. - UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom); + UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance); /// /// Check if the agent is an NPC. diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 580d7ef..c764c20 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -45,7 +45,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Dictionary m_avatars = new Dictionary(); - private Dictionary m_appearanceCache = new Dictionary(); public void Initialise(Scene scene, IConfigSource source) { @@ -124,28 +123,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC } } - private AvatarAppearance GetAppearance(UUID target, Scene scene) - { - if (m_appearanceCache.ContainsKey(target)) - return m_appearanceCache[target]; - - ScenePresence originalPresence = scene.GetScenePresence(target); - - if (originalPresence != null) - { - AvatarAppearance originalAppearance = originalPresence.Appearance; - m_appearanceCache.Add(target, originalAppearance); - return originalAppearance; - } - else - { - m_log.DebugFormat( - "[NPC MODULE]: Avatar {0} is not in the scene for us to grab baked textures from them. Using defaults.", target); - - return new AvatarAppearance(); - } - } - public bool IsNPC(UUID agentId, Scene scene) { ScenePresence sp = scene.GetScenePresence(agentId); @@ -176,7 +153,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC return true; } - public UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom) + public UUID CreateNPC( + string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance) { NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); @@ -191,8 +169,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC acd.lastname = lastname; acd.ServiceURLs = new Dictionary(); - AvatarAppearance originalAppearance = GetAppearance(cloneAppearanceFrom, scene); - AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true); + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); acd.Appearance = npcAppearance; // for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++) diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 2742b67..f8afc5a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); - IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient; + ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance @@ -72,10 +72,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // ScenePresence.SendInitialData() to reset our entire appearance. scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId)); - afm.SetAppearanceFromClient(originalClient, originalTe, null); + afm.SetAppearanceFromClient(sp.ControllingClient, originalTe, null); INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, originalClient.AgentId); + UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, sp.Appearance); ScenePresence npc = scene.GetScenePresence(npcId); @@ -96,12 +96,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, new NPCModule()); - IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient; + ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, originalClient.AgentId); + UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, sp.Appearance); ScenePresence npc = scene.GetScenePresence(npcId); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 91ac3b7..b18aa3b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2135,11 +2135,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { + ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string)); + if (clonePresence == null) + return new LSL_Key(UUID.Zero.ToString()); + UUID x = module.CreateNPC(firstname, lastname, new Vector3((float) position.x, (float) position.y, (float) position.z), World, - new UUID(cloneFrom)); + clonePresence.Appearance); return new LSL_Key(x.ToString()); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 2218a1f..7f778d7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -27,7 +27,9 @@ using System; using System.Collections.Generic; +using System.Reflection; using System.Text; +using log4net; using Nini.Config; using NUnit.Framework; using OpenMetaverse; @@ -35,6 +37,7 @@ using OpenMetaverse.Assets; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Region.CoreModules.Avatar.AvatarFactory; +using OpenSim.Region.OptionalModules.World.NPC; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api; @@ -61,9 +64,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests config.Set("Enabled", "true"); config.Set("AllowOSFunctions", "true"); config.Set("OSFunctionThreatLevel", "Severe"); + config = initConfigSource.AddConfig("NPC"); + config.Set("Enabled", "true"); m_scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(m_scene, new AvatarFactoryModule()); + SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); m_engine = new XEngine.XEngine(); m_engine.Initialise(initConfigSource); @@ -73,12 +78,72 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests /// /// Test creation of an NPC where the appearance data comes from a notecard /// -// [Test] -// public void TestOsNpcCreateFromNotecard() -// { -// TestHelpers.InMethod(); -//// log4net.Config.XmlConfigurator.Configure(); -// } + //[Test] + public void TestOsNpcCreateFromNotecard() + { + TestHelpers.InMethod(); + log4net.Config.XmlConfigurator.Configure(); + + // Store an avatar with a different height from default in a notecard. + UUID userId = TestHelpers.ParseTail(0x1); + float newHeight = 1.9f; + + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); + sp.Appearance.AvatarHeight = newHeight; + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); + SceneObjectPart part = so.RootPart; + m_scene.AddSceneObject(so); + + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + + string notecardName = "appearanceNc"; + osslApi.osOwnerSaveAppearance(notecardName); + + // Try creating a bot using the appearance in the notecard. + string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName); + Assert.That(npcRaw, Is.Not.Null); + + UUID npcId = new UUID(npcRaw); + ScenePresence npc = m_scene.GetScenePresence(npcId); + Assert.That(npc, Is.Not.Null); + Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight)); + } + + /// + /// Test creation of an NPC where the appearance data comes from an avatar already in the region. + /// + [Test] + public void TestOsNpcCreateFromAvatar() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + // Store an avatar with a different height from default in a notecard. + UUID userId = TestHelpers.ParseTail(0x1); + float newHeight = 1.9f; + + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); + sp.Appearance.AvatarHeight = newHeight; + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); + SceneObjectPart part = so.RootPart; + m_scene.AddSceneObject(so); + + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + + string notecardName = "appearanceNc"; + osslApi.osOwnerSaveAppearance(notecardName); + + // Try creating a bot using the existing avatar's appearance + string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), sp.UUID.ToString()); + Assert.That(npcRaw, Is.Not.Null); + + UUID npcId = new UUID(npcRaw); + ScenePresence npc = m_scene.GetScenePresence(npcId); + Assert.That(npc, Is.Not.Null); + Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight)); + } [Test] public void TestOsOwnerSaveAppearance() diff --git a/prebuild.xml b/prebuild.xml index dff54a3..411ceb0 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3143,11 +3143,13 @@ + + -- cgit v1.1 From b1ae930c6b8e7d985e2c148a4e18a59ac880dcbd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 22:26:47 +0100 Subject: Implement osAgentSaveAppearance() to save the appearance of an avatar in the region to a notecard This is separate from osOwnerSaveAppearance() so that owner saves can be allowed without allowing arbitrary avatar saves --- .../Shared/Api/Implementation/OSSL_Api.cs | 35 +++++++++++++++--- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++ .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 41 ++++++++++++++++++++++ 4 files changed, 78 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b18aa3b..939602a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2165,7 +2165,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID npcId = new UUID(npc.m_string); + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return new LSL_Key(UUID.Zero.ToString()); if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); @@ -2273,14 +2275,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return SaveAppearanceToNotecard(m_host.OwnerID, notecardName); } - protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) + public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecardName) + { + CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); + + return SaveAppearanceToNotecard(avatarId, notecardName); + } + + protected LSL_Key SaveAppearanceToNotecard(ScenePresence sp, string notecardName) { IAvatarFactory appearanceModule = World.RequestModuleInterface(); if (appearanceModule != null) { - appearanceModule.SaveBakedTextures(m_host.OwnerID); - ScenePresence sp = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID); + appearanceModule.SaveBakedTextures(sp.UUID); OSDMap appearancePacked = sp.Appearance.Pack(); TaskInventoryItem item @@ -2293,6 +2301,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(UUID.Zero.ToString()); } } + + protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) + { + ScenePresence sp = World.GetScenePresence(avatarId); + + if (sp == null || sp.IsChildAgent) + return new LSL_Key(UUID.Zero.ToString()); + + return SaveAppearanceToNotecard(sp, notecardName); + } + + protected LSL_Key SaveAppearanceToNotecard(LSL_Key rawAvatarId, string notecardName) + { + UUID avatarId; + if (!UUID.TryParse(rawAvatarId, out avatarId)) + return new LSL_Key(UUID.Zero.ToString()); + + return SaveAppearanceToNotecard(avatarId, notecardName); + } /// /// Get current region's map texture UUID diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index f4a618b..88e1f15 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -168,7 +168,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); - key osNpcCreate(string user, string name, vector position, key cloneFrom); LSL_Key osNpcSaveAppearance(key npc, string notecardName); void osNpcLoadAppearance(key npc, string notecardNameOrUuid); @@ -179,6 +178,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcRemove(key npc); LSL_Key osOwnerSaveAppearance(string notecardName); + LSL_Key osAgentSaveAppearance(key agentId, string notecardName); key osGetMapTexture(); key osGetRegionMapTexture(string regionName); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 84d61f4..4701736 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -523,6 +523,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osOwnerSaveAppearance(notecardName); } + public LSL_Key osAgentSaveAppearance(LSL_Key agentId, string notecardName) + { + return m_OSSL_Functions.osAgentSaveAppearance(agentId, notecardName); + } + public OSSLPrim Prim; [Serializable] diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 7f778d7..85cf507 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -184,5 +184,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight)); } + + [Test] + public void TestOsAgentSaveAppearance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID ownerId = TestHelpers.ParseTail(0x1); + UUID nonOwnerId = TestHelpers.ParseTail(0x2); + float newHeight = 1.9f; + + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, nonOwnerId); + sp.Appearance.AvatarHeight = newHeight; + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId); + SceneObjectPart part = so.RootPart; + m_scene.AddSceneObject(so); + + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + + string notecardName = "appearanceNc"; + + osslApi.osAgentSaveAppearance(new LSL_Types.LSLString(nonOwnerId.ToString()), notecardName); + + IList items = part.Inventory.GetInventoryItems(notecardName); + Assert.That(items.Count, Is.EqualTo(1)); + + TaskInventoryItem ncItem = items[0]; + Assert.That(ncItem.Name, Is.EqualTo(notecardName)); + + AssetBase ncAsset = m_scene.AssetService.Get(ncItem.AssetID.ToString()); + Assert.That(ncAsset, Is.Not.Null); + + AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data); + anc.Decode(); + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(anc.BodyText); + AvatarAppearance savedAppearance = new AvatarAppearance(); + savedAppearance.Unpack(appearanceOsd); + + Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight)); + } } } \ No newline at end of file -- cgit v1.1 From a21e98ae1a3e2f570cc119e020d4d4ea111e0ad2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 23:28:14 +0100 Subject: implement osNpcGetRot() and osNpcSetRot() Rotation works if done around the z axis. Anything else leads to random results. --- .../Shared/Api/Implementation/LSL_Api.cs | 3 +- .../Shared/Api/Implementation/OSSL_Api.cs | 57 ++++++++++++++++++++-- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++ 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 86ee28a..8a281d4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -369,7 +369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // convert a LSL_Rotation to a Quaternion - protected Quaternion Rot2Quaternion(LSL_Rotation r) + public static Quaternion Rot2Quaternion(LSL_Rotation r) { Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); q.Normalize(); @@ -2061,6 +2061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return llGetRootRotation(); } + m_host.AddScriptLPS(1); Quaternion q = m_host.GetWorldRotation(); return new LSL_Rotation(q.X, q.Y, q.Z, q.W); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 939602a..1874826 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2186,9 +2186,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID npcId = new UUID(npc.m_string); - - if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) return; string appearanceSerialized = LoadNotecard(notecardNameOrUuid); @@ -2210,8 +2209,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return; + Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); - module.MoveToTarget(new UUID(npc.m_string), World, pos, false, true); + module.MoveToTarget(npcId, World, pos, false, true); } } @@ -2222,6 +2225,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return; + Vector3 pos = new Vector3((float)position.x, (float)position.y, (float)position.z); module.MoveToTarget( new UUID(npc.m_string), @@ -2232,6 +2239,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public LSL_Rotation osNpcGetRot(LSL_Key npc) + { + CheckThreatLevel(ThreatLevel.High, "osNpcGetRot"); + + INPCModule npcModule = World.RequestModuleInterface(); + if (npcModule != null) + { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); + + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) + return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); + + ScenePresence sp = World.GetScenePresence(npcId); + Quaternion rot = sp.Rotation; + + return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); + } + + return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); + } + + public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) + { + CheckThreatLevel(ThreatLevel.High, "osNpcSetRot"); + + INPCModule npcModule = World.RequestModuleInterface(); + if (npcModule != null) + { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return; + + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) + return; + + ScenePresence sp = World.GetScenePresence(npcId); + sp.Rotation = LSL_Api.Rot2Quaternion(rotation); + } + } + public void osNpcStopMoveTo(LSL_Key npc) { CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 88e1f15..7c08e84 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -173,6 +173,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcLoadAppearance(key npc, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); void osNpcMoveToTarget(key npc, vector position, int options); + rotation osNpcGetRot(key npc); + void osNpcSetRot(LSL_Key npc, rotation rot); void osNpcStopMoveTo(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 4701736..e8e5f52 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -503,6 +503,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveToTarget(npc, position, options); } + public rotation osNpcGetRot(key npc) + { + return m_OSSL_Functions.osNpcGetRot(npc); + } + + public void osNpcSetRot(key npc, rotation rot) + { + m_OSSL_Functions.osNpcSetRot(npc, rot); + } + public void osNpcStopMoveTo(LSL_Key npc) { m_OSSL_Functions.osNpcStopMoveTo(npc); -- cgit v1.1 From d23d37d2aa7c5a3d9c6ec1726aef7941d5e52519 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 23:36:22 +0100 Subject: implement osNpcGetPos() --- .../Shared/Api/Implementation/OSSL_Api.cs | 21 +++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1874826..b1066b5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2202,6 +2202,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public LSL_Vector osNpcGetPos(LSL_Key npc) + { + CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); + + INPCModule npcModule = World.RequestModuleInterface(); + if (npcModule != null) + { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return new LSL_Vector(0, 0, 0); + + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) + return new LSL_Vector(0, 0, 0); + + Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; + return new LSL_Vector(pos.X, pos.Y, pos.Z); + } + + return new LSL_Vector(0, 0, 0); + } + public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 7c08e84..9f0d07c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -171,6 +171,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces key osNpcCreate(string user, string name, vector position, key cloneFrom); LSL_Key osNpcSaveAppearance(key npc, string notecardName); void osNpcLoadAppearance(key npc, string notecardNameOrUuid); + vector osNpcGetPos(key npc); void osNpcMoveTo(key npc, vector position); void osNpcMoveToTarget(key npc, vector position, int options); rotation osNpcGetRot(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e8e5f52..3ccb3f1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -493,6 +493,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid); } + public vector osNpcGetPos(LSL_Key npc) + { + return m_OSSL_Functions.osNpcGetPos(npc); + } + public void osNpcMoveTo(key npc, vector position) { m_OSSL_Functions.osNpcMoveTo(npc, position); -- cgit v1.1 From 0a1bbc27d26a430c53e84e22b7aad0df2f1f4a09 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Aug 2011 00:14:06 +0100 Subject: Allow the osNpcCreate() function to accept a notecard name or asset for initial appearance --- .../Shared/Api/Implementation/OSSL_Api.cs | 28 ++++++++++++++++++---- .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 4 ++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b1066b5..90c4636 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2130,20 +2130,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom) { CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); - //QueueUserWorkItem INPCModule module = World.RequestModuleInterface(); if (module != null) { - ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string)); - if (clonePresence == null) + AvatarAppearance appearance = null; + + UUID cloneId; + if (UUID.TryParse(cloneFrom, out cloneId)) + { + ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string)); + if (clonePresence != null) + appearance = clonePresence.Appearance; + } + + if (appearance == null) + { + string appearanceSerialized = LoadNotecard(cloneFrom.m_string); + + if (appearanceSerialized != null) + { + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); + appearance = new AvatarAppearance(); + appearance.Unpack(appearanceOsd); + } + } + + if (appearance == null) return new LSL_Key(UUID.Zero.ToString()); UUID x = module.CreateNPC(firstname, lastname, new Vector3((float) position.x, (float) position.y, (float) position.z), World, - clonePresence.Appearance); + appearance); return new LSL_Key(x.ToString()); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 85cf507..7573dff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -78,11 +78,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests /// /// Test creation of an NPC where the appearance data comes from a notecard /// - //[Test] + [Test] public void TestOsNpcCreateFromNotecard() { TestHelpers.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); // Store an avatar with a different height from default in a notecard. UUID userId = TestHelpers.ParseTail(0x1); -- cgit v1.1 From 65c4b8d37b304c4b6c09c0c4b07184c4a7ffda7d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Aug 2011 00:51:05 +0100 Subject: Fix kicking of NPCs via "kick user" console command. Needed to hook up the Close() function in the NPCAvatar IClientAPI implementation, which [unfortunately] is still needed --- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index d63c2a6..4441579 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -842,6 +842,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void Close() { + // Remove ourselves from the scene + m_scene.RemoveClient(AgentId, false); } public void Start() -- cgit v1.1 From 2169cf04f92a6465fe9cd58a2bac0d1380a561bd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Aug 2011 01:24:15 +0100 Subject: When saving appearance, only save the baked textures, not the other face textures (which are already stored permanently) --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 48 +++++++++++++++++++--- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 +- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 75d8143..4627701 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -271,16 +271,30 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory "[AV FACTORY]: Permanently saving baked textures for {0} in {1}", sp.Name, m_scene.RegionInfo.RegionName); - for (int i = 0; i < faceTextures.Length; i++) + foreach (int i in Enum.GetValues(typeof(BakeType))) { + BakeType bakeType = (BakeType)i; + + if (bakeType == BakeType.Unknown) + continue; + // m_log.DebugFormat( // "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); - if (faceTextures[i] == null) + int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); + Primitive.TextureEntryFace bakedTextureFace = faceTextures[ftIndex]; + + if (bakedTextureFace == null) + { + m_log.WarnFormat( + "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently", + bakeType, sp.Name, m_scene.RegionInfo.RegionName); + continue; + } - AssetBase asset = m_scene.AssetService.Get(faceTextures[i].TextureID.ToString()); + AssetBase asset = m_scene.AssetService.Get(bakedTextureFace.TextureID.ToString()); if (asset != null) { @@ -290,11 +304,35 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory else { m_log.WarnFormat( - "[AV FACTORY]: Baked texture {0} for {1} in {2} unexpectedly not found when trying to save permanently", - faceTextures[i].TextureID, sp.Name, m_scene.RegionInfo.RegionName); + "[AV FACTORY]: Baked texture id {0} not found for bake {1} for avatar {2} in {3} when trying to save permanently", + bakedTextureFace.TextureID, bakeType, sp.Name, m_scene.RegionInfo.RegionName); } } +// for (int i = 0; i < faceTextures.Length; i++) +// { +//// m_log.DebugFormat( +//// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", +//// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); +// +// if (faceTextures[i] == null) +// continue; +// +// AssetBase asset = m_scene.AssetService.Get(faceTextures[i].TextureID.ToString()); +// +// if (asset != null) +// { +// asset.Temporary = false; +// m_scene.AssetService.Store(asset); +// } +// else +// { +// m_log.WarnFormat( +// "[AV FACTORY]: Baked texture {0} for {1} in {2} not found when trying to save permanently", +// faceTextures[i].TextureID, sp.Name, m_scene.RegionInfo.RegionName); +// } +// } + return true; } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 4441579..31e79fa 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -843,7 +843,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void Close() { // Remove ourselves from the scene - m_scene.RemoveClient(AgentId, false); + m_scene.RemoveClient(AgentId, false); } public void Start() -- cgit v1.1 From aebd46a4348cf55d25eaa56325940a0f33d8b8fe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Aug 2011 01:32:49 +0100 Subject: rename osNpcStopMoveTo() to osNpcStopMoveToTarget() --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 90c4636..07473e5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2322,7 +2322,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osNpcStopMoveTo(LSL_Key npc) + public void osNpcStopMoveToTarget(LSL_Key npc) { CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 9f0d07c..2ba68ff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -176,7 +176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcMoveToTarget(key npc, vector position, int options); rotation osNpcGetRot(key npc); void osNpcSetRot(LSL_Key npc, rotation rot); - void osNpcStopMoveTo(LSL_Key npc); + void osNpcStopMoveToTarget(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 3ccb3f1..140501c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -518,9 +518,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcSetRot(npc, rot); } - public void osNpcStopMoveTo(LSL_Key npc) + public void osNpcStopMoveToTarget(LSL_Key npc) { - m_OSSL_Functions.osNpcStopMoveTo(npc); + m_OSSL_Functions.osNpcStopMoveToTarget(npc); } public void osNpcSay(key npc, string message) -- cgit v1.1 From 16ac5413ddb57ac347addebc82d425364a083637 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Aug 2011 01:52:12 +0100 Subject: rename position parameter in osNpcMoveToTarget to target --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 07473e5..2e28907 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2259,7 +2259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int options) + public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); @@ -2270,7 +2270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(npc.m_string, out npcId)) return; - Vector3 pos = new Vector3((float)position.x, (float)position.y, (float)position.z); + Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z); module.MoveToTarget( new UUID(npc.m_string), World, diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 2ba68ff..1f3454f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -173,7 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcLoadAppearance(key npc, string notecardNameOrUuid); vector osNpcGetPos(key npc); void osNpcMoveTo(key npc, vector position); - void osNpcMoveToTarget(key npc, vector position, int options); + void osNpcMoveToTarget(key npc, vector target, int options); rotation osNpcGetRot(key npc); void osNpcSetRot(LSL_Key npc, rotation rot); void osNpcStopMoveToTarget(LSL_Key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 140501c..13cf7fa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -503,9 +503,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveTo(npc, position); } - public void osNpcMoveToTarget(key npc, vector position, int options) + public void osNpcMoveToTarget(key npc, vector target, int options) { - m_OSSL_Functions.osNpcMoveToTarget(npc, position, options); + m_OSSL_Functions.osNpcMoveToTarget(npc, target, options); } public rotation osNpcGetRot(key npc) -- cgit v1.1 From 76e0afe83f012e451a66a145c50e79c1bd047f37 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Aug 2011 02:46:44 +0100 Subject: tidy up some OSSL NPC parameter names --- .../Shared/Api/Implementation/OSSL_Api.cs | 42 +++++++++++----------- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 10 +++--- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 16 ++++----- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2e28907..d791885 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2127,7 +2127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return retVal; } - public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom) + public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) { CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); @@ -2136,17 +2136,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { AvatarAppearance appearance = null; - UUID cloneId; - if (UUID.TryParse(cloneFrom, out cloneId)) + UUID id; + if (UUID.TryParse(notecard, out id)) { - ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string)); + ScenePresence clonePresence = World.GetScenePresence(id); if (clonePresence != null) appearance = clonePresence.Appearance; } if (appearance == null) { - string appearanceSerialized = LoadNotecard(cloneFrom.m_string); + string appearanceSerialized = LoadNotecard(notecard); if (appearanceSerialized != null) { @@ -2175,9 +2175,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// Save the current appearance of the NPC permanently to the named notecard. /// /// - /// The name of the notecard to which to save the appearance. + /// The name of the notecard to which to save the appearance. /// The asset ID of the notecard saved. - public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecardName) + public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard) { CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); @@ -2192,13 +2192,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); - return SaveAppearanceToNotecard(npcId, notecardName); + return SaveAppearanceToNotecard(npcId, notecard); } return new LSL_Key(UUID.Zero.ToString()); } - public void osNpcLoadAppearance(LSL_Key npc, string notecardNameOrUuid) + public void osNpcLoadAppearance(LSL_Key npc, string notecard) { CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); @@ -2210,7 +2210,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(npc.m_string, out npcId)) return; - string appearanceSerialized = LoadNotecard(notecardNameOrUuid); + string appearanceSerialized = LoadNotecard(notecard); OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); // Console.WriteLine("appearanceSerialized {0}", appearanceSerialized); @@ -2356,23 +2356,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// Save the current appearance of the script owner permanently to the named notecard. /// - /// The name of the notecard to which to save the appearance. + /// The name of the notecard to which to save the appearance. /// The asset ID of the notecard saved. - public LSL_Key osOwnerSaveAppearance(string notecardName) + public LSL_Key osOwnerSaveAppearance(string notecard) { CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); - return SaveAppearanceToNotecard(m_host.OwnerID, notecardName); + return SaveAppearanceToNotecard(m_host.OwnerID, notecard); } - public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecardName) + public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard) { CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); - return SaveAppearanceToNotecard(avatarId, notecardName); + return SaveAppearanceToNotecard(avatarId, notecard); } - protected LSL_Key SaveAppearanceToNotecard(ScenePresence sp, string notecardName) + protected LSL_Key SaveAppearanceToNotecard(ScenePresence sp, string notecard) { IAvatarFactory appearanceModule = World.RequestModuleInterface(); @@ -2382,7 +2382,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api OSDMap appearancePacked = sp.Appearance.Pack(); TaskInventoryItem item - = SaveNotecard(notecardName, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); + = SaveNotecard(notecard, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); return new LSL_Key(item.AssetID.ToString()); } @@ -2392,23 +2392,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) + protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecard) { ScenePresence sp = World.GetScenePresence(avatarId); if (sp == null || sp.IsChildAgent) return new LSL_Key(UUID.Zero.ToString()); - return SaveAppearanceToNotecard(sp, notecardName); + return SaveAppearanceToNotecard(sp, notecard); } - protected LSL_Key SaveAppearanceToNotecard(LSL_Key rawAvatarId, string notecardName) + protected LSL_Key SaveAppearanceToNotecard(LSL_Key rawAvatarId, string notecard) { UUID avatarId; if (!UUID.TryParse(rawAvatarId, out avatarId)) return new LSL_Key(UUID.Zero.ToString()); - return SaveAppearanceToNotecard(avatarId, notecardName); + return SaveAppearanceToNotecard(avatarId, notecard); } /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 1f3454f..87cfe1a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -168,9 +168,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); - key osNpcCreate(string user, string name, vector position, key cloneFrom); - LSL_Key osNpcSaveAppearance(key npc, string notecardName); - void osNpcLoadAppearance(key npc, string notecardNameOrUuid); + key osNpcCreate(string user, string name, vector position, string notecard); + LSL_Key osNpcSaveAppearance(key npc, string notecard); + void osNpcLoadAppearance(key npc, string notecard); vector osNpcGetPos(key npc); void osNpcMoveTo(key npc, vector position); void osNpcMoveToTarget(key npc, vector target, int options); @@ -180,8 +180,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcSay(key npc, string message); void osNpcRemove(key npc); - LSL_Key osOwnerSaveAppearance(string notecardName); - LSL_Key osAgentSaveAppearance(key agentId, string notecardName); + LSL_Key osOwnerSaveAppearance(string notecard); + LSL_Key osAgentSaveAppearance(key agentId, string notecard); key osGetMapTexture(); key osGetRegionMapTexture(string regionName); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 13cf7fa..bbc8cc6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -483,14 +483,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); } - public key osNpcSaveAppearance(key npc, string notecardName) + public key osNpcSaveAppearance(key npc, string notecard) { - return m_OSSL_Functions.osNpcSaveAppearance(npc, notecardName); + return m_OSSL_Functions.osNpcSaveAppearance(npc, notecard); } - public void osNpcLoadAppearance(key npc, string notecardNameOrUuid) + public void osNpcLoadAppearance(key npc, string notecard) { - m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid); + m_OSSL_Functions.osNpcLoadAppearance(npc, notecard); } public vector osNpcGetPos(LSL_Key npc) @@ -533,14 +533,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcRemove(npc); } - public LSL_Key osOwnerSaveAppearance(string notecardName) + public LSL_Key osOwnerSaveAppearance(string notecard) { - return m_OSSL_Functions.osOwnerSaveAppearance(notecardName); + return m_OSSL_Functions.osOwnerSaveAppearance(notecard); } - public LSL_Key osAgentSaveAppearance(LSL_Key agentId, string notecardName) + public LSL_Key osAgentSaveAppearance(LSL_Key agentId, string notecard) { - return m_OSSL_Functions.osAgentSaveAppearance(agentId, notecardName); + return m_OSSL_Functions.osAgentSaveAppearance(agentId, notecard); } public OSSLPrim Prim; -- cgit v1.1 From 4b88f04c0afd36f9e88680bbafb7ccc4680fd504 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Aug 2011 22:46:42 +0100 Subject: minor: On "login disable/enable" always tell the user the final login status, rather than remaining silent if it was already on/off --- OpenSim/Region/CoreModules/World/Access/AccessModule.cs | 6 ++---- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index c355b13..b5e1fd9 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -129,13 +129,11 @@ namespace OpenSim.Region.CoreModules.World switch (cmd[1]) { case "enable": - if (scene.LoginsDisabled) - MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName)); + MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName)); scene.LoginsDisabled = false; break; case "disable": - if (!scene.LoginsDisabled) - MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName)); + MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName)); scene.LoginsDisabled = true; break; case "status": diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index c764c20..11fda6d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -105,9 +105,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC } else { - m_log.DebugFormat( - "[NPC MODULE]: Updating npc {0} at {1} for next movement to {2}", - presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); +// m_log.DebugFormat( +// "[NPC MODULE]: Updating npc {0} at {1} for next movement to {2}", +// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); Vector3 agent_control_v3 = new Vector3(); presence.HandleMoveToTargetUpdate(ref agent_control_v3); -- cgit v1.1 From ed142ead25834f6ce77585262a69f873db03a393 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Aug 2011 22:50:58 +0100 Subject: minor: change login enable/disable messages in last commit so that they occur after the setting has been made --- OpenSim/Region/CoreModules/World/Access/AccessModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index b5e1fd9..2399134 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -129,12 +129,12 @@ namespace OpenSim.Region.CoreModules.World switch (cmd[1]) { case "enable": - MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName)); scene.LoginsDisabled = false; + MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName)); break; case "disable": - MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName)); scene.LoginsDisabled = true; + MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName)); break; case "status": if (scene.LoginsDisabled) -- cgit v1.1 From 78ff82bfe9728b83a56e315522ee33961abe9a9d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Aug 2011 23:40:22 +0100 Subject: If a map request to a server fails, always close the outbound connection. This probably doesn't help with the current memory leak. --- OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index fac2dab..7b00597 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -682,7 +682,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap mapitemsrequest.ContentLength = buffer.Length; //Count bytes to send os = mapitemsrequest.GetRequestStream(); os.Write(buffer, 0, buffer.Length); //Send it - os.Close(); //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver); } catch (WebException ex) @@ -705,6 +704,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap responseMap["connect"] = OSD.FromBoolean(false); return responseMap; } + finally + { + if (os != null) + os.Close(); + } string response_mapItems_reply = null; { // get the response -- cgit v1.1 From 90c6fa89bea62f97376222f8251d576fa9af1298 Mon Sep 17 00:00:00 2001 From: Aaron Duffy Date: Sat, 6 Aug 2011 22:34:41 -0600 Subject: Fix a bug preventing region modules from creating trees at anything but the default scale. --- OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs index c2ad7b8..ab8e1bf 100644 --- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs +++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs @@ -100,15 +100,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation { case Tree.Cypress1: case Tree.Cypress2: - tree.Scale = new Vector3(4, 4, 10); + tree.Scale *= new Vector3(8, 8, 20); break; // case... other tree types - // tree.Scale = new Vector3(?, ?, ?); + // tree.Scale *= new Vector3(?, ?, ?); // break; default: - tree.Scale = new Vector3(4, 4, 4); + tree.Scale *= new Vector3(8, 8, 8); break; } } -- cgit v1.1 From d0bcaf1f16134d8d6f267744d8bcd1bace5d897f Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Mon, 8 Aug 2011 20:31:37 -0500 Subject: llGetPrimitveParams fix prim hollow/hole shape return value --- prebuild.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/prebuild.xml b/prebuild.xml index 411ceb0..b56c5b5 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3146,6 +3146,7 @@ + -- cgit v1.1 From 77625dae36f7a843cb347d7e9f47d6bd00f85379 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 13 Aug 2011 01:13:17 +0100 Subject: Revert "llGetPrimitveParams fix prim hollow/hole shape return value" This reverts commit d0bcaf1f16134d8d6f267744d8bcd1bace5d897f. Accidentally applied only the prebuild.xml conflict fix. But the full application seems to generate a regression test error anyway. --- prebuild.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/prebuild.xml b/prebuild.xml index b56c5b5..411ceb0 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3146,7 +3146,6 @@ - -- cgit v1.1 From dcb4b2de09032380fb428f73d9e3fd10aa662377 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 13 Aug 2011 15:16:43 +0100 Subject: Fix a problem in the Flotsam asset cache where assets were being put into the memory cache even when it wasn't enabled. This hopefully addresses http://opensimulator.org/mantis/view.php?id=5634 This is the most probable cause of the memory problems that people have been seeing in the past month. This bug has been around since commit 5dc785b (4th July 2011). Doh! This is why regressions tests are such a good idea... :) Many thanks to Nebadon for using git bisect to track down this bug, which made it a 5 minute fix. --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 7ef759c..abfc771 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -357,8 +357,6 @@ namespace Flotsam.RegionModules.AssetCache asset = (AssetBase)bformatter.Deserialize(stream); - UpdateMemoryCache(id, asset); - m_DiskHits++; } catch (System.Runtime.Serialization.SerializationException e) @@ -419,9 +417,15 @@ namespace Flotsam.RegionModules.AssetCache if (m_MemoryCacheEnabled) asset = GetFromMemoryCache(id); + if (asset == null && m_FileCacheEnabled) + { asset = GetFromFileCache(id); + if (m_MemoryCacheEnabled && asset != null) + UpdateMemoryCache(id, asset); + } + if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0)) { m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0; -- cgit v1.1 From b80dfb6572438cb583e95884c0f607342f0c88d4 Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Fri, 12 Aug 2011 21:09:01 -0500 Subject: llGetPrimitiveParams fix prim hollow/hole shape value --- .../Shared/Api/Implementation/LSL_Api.cs | 6 +- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 175 +++++++++++++++++++++ prebuild.xml | 1 + 3 files changed, 179 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8a281d4..c84afee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7650,7 +7650,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_TYPE_BOX: case ScriptBaseClass.PRIM_TYPE_CYLINDER: case ScriptBaseClass.PRIM_TYPE_PRISM: - res.Add(new LSL_Integer(Shape.ProfileCurve)); + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); @@ -7659,7 +7659,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case ScriptBaseClass.PRIM_TYPE_SPHERE: - res.Add(new LSL_Integer(Shape.ProfileCurve)); + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); @@ -7675,7 +7675,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_TYPE_TUBE: case ScriptBaseClass.PRIM_TYPE_TORUS: // holeshape - res.Add(new LSL_Integer(Shape.ProfileCurve)); + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. // cut res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 3f37ec7..623c82d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -27,11 +27,13 @@ using System.Collections.Generic; using NUnit.Framework; +using OpenSim.Framework; using OpenSim.Tests.Common; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.Framework.Scenes; using Nini.Config; using OpenSim.Region.ScriptEngine.Shared.Api; +using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenMetaverse; using System; using OpenSim.Tests.Common.Mock; @@ -47,6 +49,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; + private const double FLOAT_ACCURACY = 0.00005d; private LSL_Api m_lslApi; [SetUp] @@ -166,6 +169,178 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests } [Test] + // llSetPrimitiveParams and llGetPrimitiveParams test. + public void TestllSetPrimitiveParams() + { + // Create Prim1. + Scene scene = SceneHelpers.SetupScene(); + string obj1Name = "Prim1"; + UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); + SceneObjectPart part1 = + new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, + Vector3.Zero, Quaternion.Identity, + Vector3.Zero) { Name = obj1Name, UUID = objUuid }; + Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); + + // Test a sphere. + CheckllSetPrimitiveParams( + "test 1", // Prim test identification string + new LSL_Types.Vector3(6.0d, 9.9d, 9.9d), // Prim size + ScriptBaseClass.PRIM_TYPE_SPHERE, // Prim type + ScriptBaseClass.PRIM_HOLE_DEFAULT, // Prim hole type + new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut + 0.80d, // Prim hollow + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(0.32d, 0.76d, 0.0d)); // Prim dimple + + // Test a prism. + CheckllSetPrimitiveParams( + "test 2", // Prim test identification string + new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size + ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type + ScriptBaseClass.PRIM_HOLE_CIRCLE, // Prim hole type + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut + 0.90d, // Prim hollow + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear + + // Test a box. + CheckllSetPrimitiveParams( + "test 3", // Prim test identification string + new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size + ScriptBaseClass.PRIM_TYPE_BOX, // Prim type + ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut + 0.90d, // Prim hollow + new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear + + // Test a tube. + CheckllSetPrimitiveParams( + "test 4", // Prim test identification string + new LSL_Types.Vector3(4.2d, 4.2d, 4.2d), // Prim size + ScriptBaseClass.PRIM_TYPE_TUBE, // Prim type + ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut + 0.00d, // Prim hollow + new LSL_Types.Vector3(1.0d, -1.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(1.0d, 0.5d, 0.0d), // Prim hole size + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim profile cut + new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper + 1.0d, // Prim revolutions + 1.0d, // Prim radius + 0.0d); // Prim skew + } + + // Set prim params for a box, cylinder or prism and check results. + public void CheckllSetPrimitiveParams(string primTest, + LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear) + { + // Set the prim params. + m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, + ScriptBaseClass.PRIM_TYPE, primType, primHoleType, + primCut, primHollow, primTwist, primTaper, primShear)); + + // Get params for prim to validate settings. + LSL_Types.list primParams = + m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); + + // Validate settings. + CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size"); + Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1), + "TestllSetPrimitiveParams " + primTest + " prim type check fail"); + Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), + "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); + CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); + Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); + CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); + CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper"); + CheckllSetPrimitiveParamsVector(primShear, m_lslApi.llList2Vector(primParams, 7), primTest + " prim shear"); + } + + // Set prim params for a sphere and check results. + public void CheckllSetPrimitiveParams(string primTest, + LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple) + { + // Set the prim params. + m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, + ScriptBaseClass.PRIM_TYPE, primType, primHoleType, + primCut, primHollow, primTwist, primDimple)); + + // Get params for prim to validate settings. + LSL_Types.list primParams = + m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); + + // Validate settings. + CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size"); + Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1), + "TestllSetPrimitiveParams " + primTest + " prim type check fail"); + Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), + "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); + CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); + Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); + CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); + CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple"); + } + + // Set prim params for a torus, tube or ring and check results. + public void CheckllSetPrimitiveParams(string primTest, + LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, + LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, + double primRev, double primRadius, double primSkew) + { + // Set the prim params. + m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, + ScriptBaseClass.PRIM_TYPE, primType, primHoleType, + primCut, primHollow, primTwist, primHoleSize, primShear, primProfCut, + primTaper, primRev, primRadius, primSkew)); + + // Get params for prim to validate settings. + LSL_Types.list primParams = + m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); + + // Valdate settings. + CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size"); + Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1), + "TestllSetPrimitiveParams " + primTest + " prim type check fail"); + Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), + "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); + CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); + Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); + CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); + CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size"); + CheckllSetPrimitiveParamsVector(primShear, m_lslApi.llList2Vector(primParams, 7), primTest + " prim shear"); + CheckllSetPrimitiveParamsVector(primProfCut, m_lslApi.llList2Vector(primParams, 8), primTest + " prim profile cut"); + CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 9), primTest + " prim taper"); + Assert.AreEqual(primRev, m_lslApi.llList2Float(primParams, 10), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim revolution fail"); + Assert.AreEqual(primRadius, m_lslApi.llList2Float(primParams, 11), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim radius fail"); + Assert.AreEqual(primSkew, m_lslApi.llList2Float(primParams, 12), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim skew fail"); + } + + public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg) + { + // Check each vector component against expected result. + Assert.AreEqual(vecCheck.x, vecReturned.x, VECTOR_COMPONENT_ACCURACY, + "TestllSetPrimitiveParams " + msg + " vector check fail on x component"); + Assert.AreEqual(vecCheck.y, vecReturned.y, VECTOR_COMPONENT_ACCURACY, + "TestllSetPrimitiveParams " + msg + " vector check fail on y component"); + Assert.AreEqual(vecCheck.z, vecReturned.z, VECTOR_COMPONENT_ACCURACY, + "TestllSetPrimitiveParams " + msg + " vector check fail on z component"); + } + + [Test] // llVecNorm test. public void TestllVecNorm() { diff --git a/prebuild.xml b/prebuild.xml index 411ceb0..b56c5b5 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3146,6 +3146,7 @@ + -- cgit v1.1 From e19843a0ee6deb1f9f96a954c97c011b3110aac0 Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Sun, 14 Aug 2011 17:45:23 +0200 Subject: WorldMap: Added map item for Land-for-Sale. Implemented backlist item timeouts (default 10 minutes; see also new config file setting BlacklistTimeout) and removing backlisted neigboring regions that have been restarted from the blacklist. --- .../CoreModules/World/WorldMap/WorldMapModule.cs | 206 +++++++++++++++++++-- bin/OpenSimDefaults.ini | 3 + 2 files changed, 190 insertions(+), 19 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 7b00597..710230a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -46,6 +46,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.CoreModules.World.Land; using Caps=OpenSim.Framework.Capabilities.Caps; using OSDArray=OpenMetaverse.StructuredData.OSDArray; using OSDMap=OpenMetaverse.StructuredData.OSDMap; @@ -68,6 +69,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap protected Scene m_scene; private List cachedMapBlocks = new List(); private int cachedTime = 0; + private int blacklistTimeout = 10*60*1000; // 10 minutes private byte[] myMapImageJPEG; protected volatile bool m_Enabled = false; private Dictionary m_openRequests = new Dictionary(); @@ -85,6 +87,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap IConfig startupConfig = config.Configs["Startup"]; if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap") m_Enabled = true; + + blacklistTimeout = startupConfig.GetInt("BlacklistTimeout", 10*60) * 1000; } public virtual void AddRegion (Scene scene) @@ -159,11 +163,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scene.EventManager.OnClientClosed += ClientLoggedOut; m_scene.EventManager.OnMakeChildAgent += MakeChildAgent; m_scene.EventManager.OnMakeRootAgent += MakeRootAgent; + m_scene.EventManager.OnRegionUp += OnRegionUp; + + StartThread(new object()); } // this has to be called with a lock on m_scene protected virtual void RemoveHandlers() { + StopThread(); + + m_scene.EventManager.OnRegionUp -= OnRegionUp; m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent; m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent; m_scene.EventManager.OnClientClosed -= ClientLoggedOut; @@ -279,7 +289,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) { - m_log.Debug("[WORLD MAP]: MapLayer Request in region: " + m_scene.RegionInfo.RegionName); + m_log.DebugFormat("[WORLD MAP]: MapLayer Request in region: {0}", m_scene.RegionInfo.RegionName); LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); return mapResponse; @@ -321,8 +331,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap lock (m_rootAgents) { m_rootAgents.Remove(AgentId); - if (m_rootAgents.Count == 0) - StopThread(); } } #endregion @@ -362,6 +370,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle) { +// m_log.DebugFormat("[WORLD MAP]: Handle MapItem request {0} {1}", regionhandle, itemtype); + lock (m_rootAgents) { if (!m_rootAgents.Contains(remoteClient.AgentId)) @@ -370,7 +380,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap uint xstart = 0; uint ystart = 0; Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); - if (itemtype == 6) // we only sevice 6 right now (avatar green dots) + if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) { if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) { @@ -414,14 +424,58 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // Remote Map Item Request // ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes. - // Note that we only start up a remote mapItem Request thread if there's users who could - // be making requests - if (!threadrunning) + RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle); + } + } else if (itemtype == 7) // Service 7 (MAP_ITEM_LAND_FOR_SALE) + { + if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) + { + // Parcels + ILandChannel landChannel = m_scene.LandChannel; + List parcels = landChannel.AllParcels(); + + // Local Map Item Request + int tc = Environment.TickCount; + List mapitems = new List(); + mapItemReply mapitem = new mapItemReply(); + if ((parcels != null) && (parcels.Count >= 1)) { - m_log.Warn("[WORLD MAP]: Starting new remote request thread manually. This means that AvatarEnteringParcel never fired! This needs to be fixed! Don't Mantis this, as the developers can see it in this message"); - StartThread(new object()); + foreach (ILandObject parcel_interface in parcels) + { + // Play it safe + if (!(parcel_interface is LandObject)) + continue; + + LandObject land = (LandObject)parcel_interface; + LandData parcel = land.LandData; + + // Show land for sale + if ((parcel.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale) + { + Vector3 min = parcel.AABBMin; + Vector3 max = parcel.AABBMax; + float x = (min.X+max.X)/2; + float y = (min.Y+max.Y)/2; + + mapitem = new mapItemReply(); + mapitem.x = (uint)(xstart + x); + mapitem.y = (uint)(ystart + y); + // mapitem.z = (uint)m_scene.GetGroundHeight(x,y); + mapitem.id = UUID.Zero; + mapitem.name = parcel.Name; + mapitem.Extra = parcel.Area; + mapitem.Extra2 = parcel.SalePrice; + mapitems.Add(mapitem); + } + } } + remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); + } + else + { + // Remote Map Item Request + // ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes. RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle); } } @@ -542,6 +596,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags); } + + // Service 7 (MAP_ITEM_LAND_FOR_SALE) + uint itemtype = 7; + + if (response.ContainsKey(itemtype.ToString())) + { + List returnitems = new List(); + OSDArray itemarray = (OSDArray)response[itemtype.ToString()]; + for (int i = 0; i < itemarray.Count; i++) + { + OSDMap mapitem = (OSDMap)itemarray[i]; + mapItemReply mi = new mapItemReply(); + mi.x = (uint)mapitem["X"].AsInteger(); + mi.y = (uint)mapitem["Y"].AsInteger(); + mi.id = mapitem["ID"].AsUUID(); + mi.Extra = mapitem["Extra"].AsInteger(); + mi.Extra2 = mapitem["Extra2"].AsInteger(); + mi.name = mapitem["Name"].AsString(); + returnitems.Add(mi); + } + av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags); + } } } } @@ -589,12 +665,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private OSDMap RequestMapItemsAsync(UUID id, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle) { +// m_log.DebugFormat("[WORLDMAP]: RequestMapItemsAsync; region handle: {0} {1}", regionhandle, itemtype); + string httpserver = ""; bool blacklisted = false; lock (m_blacklistedregions) { if (m_blacklistedregions.ContainsKey(regionhandle)) - blacklisted = true; + { + if (Environment.TickCount > (m_blacklistedregions[regionhandle] + blacklistTimeout)) + { + m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted region {0}", regionhandle); + + m_blacklistedregions.Remove(regionhandle); + } + else + blacklisted = true; + } } if (blacklisted) @@ -636,7 +723,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap lock (m_blacklistedurls) { if (m_blacklistedurls.ContainsKey(httpserver)) - blacklisted = true; + { + if (Environment.TickCount > (m_blacklistedurls[httpserver] + blacklistTimeout)) + { + m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted URL {0}", httpserver); + + m_blacklistedurls.Remove(httpserver); + } + else + blacklisted = true; + } } // Can't find the http server @@ -1064,6 +1160,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); + // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) + OSDMap responsemap = new OSDMap(); int tc = Environment.TickCount; if (m_scene.GetRootAgentCount() == 0) @@ -1096,6 +1194,60 @@ namespace OpenSim.Region.CoreModules.World.WorldMap }); responsemap["6"] = responsearr; } + + // Service 7 (MAP_ITEM_LAND_FOR_SALE) + + ILandChannel landChannel = m_scene.LandChannel; + List parcels = landChannel.AllParcels(); + + if ((parcels == null) || (parcels.Count == 0)) + { + OSDMap responsemapdata = new OSDMap(); + responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1)); + responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1)); + responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); + responsemapdata["Name"] = OSD.FromString(""); + responsemapdata["Extra"] = OSD.FromInteger(0); + responsemapdata["Extra2"] = OSD.FromInteger(0); + OSDArray responsearr = new OSDArray(); + responsearr.Add(responsemapdata); + + responsemap["7"] = responsearr; + } + else + { + OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); + foreach (ILandObject parcel_interface in parcels) + { + // Play it safe + if (!(parcel_interface is LandObject)) + continue; + + LandObject land = (LandObject)parcel_interface; + LandData parcel = land.LandData; + + // Show land for sale + if ((parcel.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale) + { + Vector3 min = parcel.AABBMin; + Vector3 max = parcel.AABBMax; + float x = (min.X+max.X)/2; + float y = (min.Y+max.Y)/2; + + OSDMap responsemapdata = new OSDMap(); + responsemapdata["X"] = OSD.FromInteger((int)(xstart + x)); + responsemapdata["Y"] = OSD.FromInteger((int)(ystart + y)); + // responsemapdata["Z"] = OSD.FromInteger((int)m_scene.GetGroundHeight(x,y)); + responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); + responsemapdata["Name"] = OSD.FromString(parcel.Name); + responsemapdata["Extra"] = OSD.FromInteger(parcel.Area); + responsemapdata["Extra2"] = OSD.FromInteger(parcel.SalePrice); + responsearr.Add(responsemapdata); + } + } + responsemap["7"] = responsearr; + } + return responsemap; } @@ -1144,12 +1296,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private void MakeRootAgent(ScenePresence avatar) { - // You may ask, why this is in a threadpool to start with.. - // The reason is so we don't cause the thread to freeze waiting - // for the 1 second it costs to start a thread manually. - if (!threadrunning) - Util.FireAndForget(this.StartThread); - lock (m_rootAgents) { if (!m_rootAgents.Contains(avatar.UUID)) @@ -1164,8 +1310,30 @@ namespace OpenSim.Region.CoreModules.World.WorldMap lock (m_rootAgents) { m_rootAgents.Remove(avatar.UUID); - if (m_rootAgents.Count == 0) - StopThread(); + } + } + + public void OnRegionUp(GridRegion otherRegion) + { + ulong regionhandle = otherRegion.RegionHandle; + string httpserver = otherRegion.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); + + lock (m_blacklistedregions) + { + if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_blacklistedregions.Remove(regionhandle); + } + + lock (m_blacklistedurls) + { + if (m_blacklistedurls.ContainsKey(httpserver)) + m_blacklistedurls.Remove(httpserver); + } + + lock (m_cachedRegionMapItemsAddress) + { + if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) + m_cachedRegionMapItemsAddress.Remove(regionhandle); } } diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 23218f1..31e86a5 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -216,6 +216,9 @@ ;WorldMapModule = "WorldMap" ;MapImageModule = "MapImageModule" + ; World map blacklist timeout in seconds + ;BlacklistTimeout = 600 + ; Set to false to not generate any maptiles ;GenerateMaptiles = true -- cgit v1.1 From 70ea62544716134447884e999898267497b85a12 Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Sun, 14 Aug 2011 18:20:20 +0200 Subject: Added optional Login Service parameter "Currency" to be able to change the currency name shown in the viewer. --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 19 ++++++++++++++++++- OpenSim/Services/LLLoginService/LLLoginService.cs | 4 +++- bin/Robust.HG.ini.example | 2 ++ bin/Robust.ini.example | 2 ++ bin/config-include/StandaloneCommon.ini.example | 2 ++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index f68c078..1a874c8 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -183,6 +183,8 @@ namespace OpenSim.Services.LLLoginService private BuddyList m_buddyList = null; + private string currency; + static LLLoginResponse() { // This is being set, but it's not used @@ -218,7 +220,7 @@ namespace OpenSim.Services.LLLoginService public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, GridRegion destination, List invSkel, FriendInfo[] friendsList, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, List gestures, string message, - GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL) + GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency) : this() { FillOutInventoryData(invSkel, libService); @@ -236,6 +238,7 @@ namespace OpenSim.Services.LLLoginService StartLocation = where; MapTileURL = mapTileURL; SearchURL = searchURL; + Currency = currency; FillOutHomeData(pinfo, home); LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); @@ -382,6 +385,8 @@ namespace OpenSim.Services.LLLoginService initialOutfit.Add(InitialOutfitHash); mapTileURL = String.Empty; searchURL = String.Empty; + + currency = String.Empty; } @@ -456,6 +461,12 @@ namespace OpenSim.Services.LLLoginService responseData["buddy-list"] = m_buddyList.ToArray(); } + if (currency != String.Empty) + { + // responseData["real_currency"] = currency; + responseData["currency"] = currency; + } + responseData["login"] = "true"; return responseData; @@ -940,6 +951,12 @@ namespace OpenSim.Services.LLLoginService set { m_buddyList = value; } } + public string Currency + { + get { return currency; } + set { currency = value; } + } + #endregion public class UserInfo diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 00405a1..4ccc7ff 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -75,6 +75,7 @@ namespace OpenSim.Services.LLLoginService protected bool m_AllowRemoteSetLoginLevel; protected string m_MapTileURL; protected string m_SearchURL; + protected string m_Currency; protected string m_AllowedClients; protected string m_DeniedClients; @@ -108,6 +109,7 @@ namespace OpenSim.Services.LLLoginService m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); + m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); @@ -408,7 +410,7 @@ namespace OpenSim.Services.LLLoginService // Finally, fill out the response and return it // LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, - where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL); + where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL, m_Currency); m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); return response; diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index ea271b8..b760abd 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -203,6 +203,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" + ;Currency = "" + WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 14f79aa..a36d255 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -188,6 +188,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 LibraryService = "OpenSim.Services.InventoryService.dll:LibraryService" FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" + ;Currency = "" + WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index ee0523f..babd116 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -99,6 +99,8 @@ ;; For Viewer 2 MapTileURL = "http://127.0.0.1:9000/" + ;Currency = "" + ;; Regular expressions for controlling which client versions are accepted/denied. ;; An empty string means nothing is checked. ;; -- cgit v1.1 From 9a6ad1535e83a4d1b216ae879173ab8c524da60b Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Mon, 15 Aug 2011 17:46:51 +0200 Subject: Added console command "delete object outside" to delete all objects outside region boundaries. This is especiyll useful in cases where physical objects outside regions boundaries cause much physics engine lag. --- OpenSim/Region/Framework/Scenes/Scene.cs | 39 ++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9aa9bf5..13b4cbc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -611,6 +611,10 @@ namespace OpenSim.Region.Framework.Scenes "delete object name ", "Delete object by name", HandleDeleteObject); + MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", + "delete object outside", + "Delete all objects outside boundaries", HandleDeleteObject); + //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(simDataService.StoreLandObject); @@ -4941,11 +4945,19 @@ namespace OpenSim.Region.Framework.Scenes private void HandleDeleteObject(string module, string[] cmd) { - if (cmd.Length < 4) + if (cmd.Length < 3) return; string mode = cmd[2]; - string o = cmd[3]; + string o = ""; + + if (mode != "outside") + { + if (cmd.Length < 4) + return; + + o = cmd[3]; + } List deletes = new List(); @@ -4987,10 +4999,33 @@ namespace OpenSim.Region.Framework.Scenes deletes.Add(g); }); break; + case "outside": + ForEachSOG(delegate (SceneObjectGroup g) + { + SceneObjectPart rootPart = g.RootPart; + bool delete = false; + + if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) + { + delete = true; + } else { + ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); + + if (parcel == null || parcel.LandData.Name == "NO LAND") + delete = true; + } + + if (delete && !rootPart.IsAttachment && !deletes.Contains(g)) + deletes.Add(g); + }); + break; } foreach (SceneObjectGroup g in deletes) + { + m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID); DeleteSceneObject(g, false); + } } private void HandleReloadEstate(string module, string[] cmd) -- cgit v1.1 From e870442e310195e234ed62c373aeb4eff8b5e791 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 15 Aug 2011 12:59:17 -0400 Subject: Remove un-needed ATTACH command in migration script. This was causing issues when using specified paths to database files by using a hard-coded name. --- OpenSim/Data/SQLite/Resources/XInventoryStore.migrations | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations b/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations index d5b3019..de44982 100644 --- a/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations +++ b/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations @@ -41,11 +41,9 @@ COMMIT; :VERSION 2 -ATTACH 'inventoryStore.db' AS old; - BEGIN TRANSACTION; INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders; INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems; -COMMIT; \ No newline at end of file +COMMIT; -- cgit v1.1 From dc772c608d886b3fe55b7cfef6189e47372c777b Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 15 Aug 2011 16:17:32 -0400 Subject: Fix for monodevelop External libraries need the "path=..." set so Prebuild.exe can properly build the projects --- prebuild.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prebuild.xml b/prebuild.xml index b56c5b5..9877973 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3150,7 +3150,7 @@ - + -- cgit v1.1 From 0784791a44d5f5b7db7c3d2534cc158160819d01 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 15 Aug 2011 16:21:04 -0400 Subject: Add "shutdown" message to RegionReady Add "shutdown" message when removing region. From a patch submitted by Michelle Argus. Thanks Michelle --- .../OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 05c729a..963d1e2 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -126,6 +126,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; + if(m_uri != string.Empty) + { + RRAlert("shutdown"); + } + m_scene = null; } -- cgit v1.1 From 8c95c83562db7e273cbf555514224773f21a2b19 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 21:03:43 +0100 Subject: On Flotsam asset cache, go back to moving the file from the temporary location rather than copying. Copying doesn't prevent IOExceptions on Windows due to file locking. (e.g. Mantis 5642, 5630). So instead go back to moving the file, swallowing IOExceptions that occur just for the move due to competing caching threads or even different opensimulator instances. --- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 73 ++++++++++++++-------- 1 file changed, 47 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index abfc771..b2f6e13 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -593,39 +593,60 @@ namespace Flotsam.RegionModules.AssetCache try { - if (!Directory.Exists(directory)) + try { - Directory.CreateDirectory(directory); + if (!Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + + stream = File.Open(tempname, FileMode.Create); + BinaryFormatter bformatter = new BinaryFormatter(); + bformatter.Serialize(stream, asset); } + catch (IOException e) + { + m_log.ErrorFormat( + "[FLOTSAM ASSET CACHE]: Failed to write asset {0} to temporary location {1} (final {2}) on cache in {3}. Exception {4} {5}.", + asset.ID, tempname, filename, directory, e.Message, e.StackTrace); - stream = File.Open(tempname, FileMode.Create); - BinaryFormatter bformatter = new BinaryFormatter(); - bformatter.Serialize(stream, asset); - stream.Close(); - - // Now that it's written, rename it so that it can be found. - // We're doing this as a file copy operation so that if two threads are competing to cache this asset, - // then both suceed instead of one failing when it tries to move the file to a final filename that - // already exists. - // This assumes that the file copy operation is atomic. Assuming this holds, then copying also works - // if another simulator is using the same cache directory. - File.Copy(tempname, filename, true); - File.Delete(tempname); + return; + } + finally + { + if (stream != null) + stream.Close(); + } - if (m_LogLevel >= 2) - m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[FLOTSAM ASSET CACHE]: Failed to write asset {0} to cache. Directory {1}, tempname {2}, filename {3}. Exception {4} {5}.", - asset.ID, directory, tempname, filename, e.Message, e.StackTrace); + try + { + // Now that it's written, rename it so that it can be found. + // + // File.Copy(tempname, filename, true); + // File.Delete(tempname); + // + // For a brief period, this was done as a separate copy and then temporary file delete operation. + // However, this causes exceptions on Windows when other threads attempt to read a file + // which is still being copied. So instead, go back to moving the file and swallowing any IOException + // that occurs because two threads race to cache the same data (and the second fails because the file + // already exists). + // + // This situation occurs fairly rarely anyway. We assume in this that moves are atomic on the + // filesystem. + File.Move(tempname, filename); + + if (m_LogLevel >= 2) + m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID); + } + catch (IOException) + { + // If we see an IOException here it's likely that some other competing thread has written the + // cache file first, so ignore. Other IOException errors (e.g. filesystem full) should be + // signally by the earlier temporary file writing code. + } } finally { - if (stream != null) - stream.Close(); - // Even if the write fails with an exception, we need to make sure // that we release the lock on that file, otherwise it'll never get // cached -- cgit v1.1 From fd3a7ab70c04742a8ea776180144ea016e0d4e31 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 21:31:08 +0100 Subject: minor: change some comment text in flotsam asset cache --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index b2f6e13..22c301b 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -625,11 +625,10 @@ namespace Flotsam.RegionModules.AssetCache // File.Copy(tempname, filename, true); // File.Delete(tempname); // - // For a brief period, this was done as a separate copy and then temporary file delete operation. + // For a brief period, this was done as a separate copy and then temporary file delete operation to + // avoid an IOException caused by move if some competing thread had already written the file. // However, this causes exceptions on Windows when other threads attempt to read a file - // which is still being copied. So instead, go back to moving the file and swallowing any IOException - // that occurs because two threads race to cache the same data (and the second fails because the file - // already exists). + // which is still being copied. So instead, go back to moving the file and swallow any IOException. // // This situation occurs fairly rarely anyway. We assume in this that moves are atomic on the // filesystem. -- cgit v1.1 From e29e50798a248bbcae3b541397a6087a511d5133 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 21:31:48 +0100 Subject: minor: Add warning to OpenSim.ini.example about bullet plugins not working right now, pending the new plugin --- bin/OpenSim.ini.example | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index bcfaf76..45fe399 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -151,6 +151,7 @@ ;; OpenDynamicsEngine is by some distance the most developed physics engine ;; basicphysics effectively does not model physics at all, making all ;; objects phantom + ;; The Bullet plugins do not work properly right now. A better Bullet plugin is on the way. ;; Default is OpenDynamicsEngine ; physics = OpenDynamicsEngine ; physics = basicphysics -- cgit v1.1 From 96ee87e39bf0310aa5648b04e1a5d47d5795daab Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 21:38:51 +0100 Subject: Change the default standalone asset cache to be the Flotsam asset cache (with memory caching not enabled). This matches the GridCommon setting and is the best tested setting. It appears to work fine on standalone. Also, add information that the flotsam asset cache is the recommended cache, since it is most used and actively maintained. --- bin/config-include/GridCommon.ini.example | 1 + bin/config-include/StandaloneCommon.ini.example | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index 4e34059..c5598c0 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -122,6 +122,7 @@ [Modules] ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. ;; Copy the config .example file into your own .ini file and change configs there + ;; We recommend the use of the FlotsamAssetCache since this is most actively maintained. AssetCaching = "FlotsamAssetCache" Include-FlotsamCache = "config-include/FlotsamCache.ini" diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index babd116..431dce1 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -45,14 +45,15 @@ [Modules] ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. ;; Copy the config .example file into your own .ini file and change configs there + ;; We recommend the use of the FlotsamAssetCache since this is most actively maintained. - ;AssetCaching = "GlynnTuckerAssetCache" + AssetCaching = "FlotsamAssetCache" + Include-FlotsamCache = "config-include/FlotsamCache.ini" - ;AssetCaching = "FlotsamAssetCache" - ;Include-FlotsamCache = "config-include/FlotsamCache.ini" + ;AssetCaching = "GlynnTuckerAssetCache" - AssetCaching = "CenomeMemoryAssetCache" - Include-CenomeCache = "config-include/CenomeCache.ini" + ; AssetCaching = "CenomeMemoryAssetCache" + ; Include-CenomeCache = "config-include/CenomeCache.ini" ;; Authorization is not on by default, as it depends on external php ;AuthorizationServices = "LocalAuthorizationServicesConnector" -- cgit v1.1 From 8d866ae8c3e2c866f8b4b905d5a74370042100c3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 21:45:01 +0100 Subject: minor: remove some mono compiler warnings --- OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 6 +++--- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 22c05c4..e7bd2e7 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -50,8 +50,8 @@ namespace OpenSim.Region.ClientStack.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class GetMeshModule : INonSharedRegionModule { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; private IAssetService m_AssetService; @@ -113,7 +113,7 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { - UUID capID = UUID.Random(); +// UUID capID = UUID.Random(); //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 24ab06a..fffcee2 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -54,8 +54,9 @@ namespace OpenSim.Region.ClientStack.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class GetTextureModule : INonSharedRegionModule { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; private IAssetService m_assetService; -- cgit v1.1 From eb431f91c092eda1e06bb5f47d604eedcf892ec7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 21:50:15 +0100 Subject: Add terminating quotes to http addresses in [SimulatorFeatures] section of OpenSim.ini.example. As per http://opensimulator.org/mantis/view.php?id=5638. Thanks DutchGlory. --- bin/OpenSim.ini.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 45fe399..c36d2a4 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -319,8 +319,8 @@ ; meant to override the MapImage and search server url given at login, and varying ; on a sim-basis. ; Viewers that don't understand it, will ignore it - ;MapImageServerURI = "http://127.0.0.1:9000/ - ;SearchServerURI = "http://127.0.0.1:9000/ + ;MapImageServerURI = "http://127.0.0.1:9000/" + ;SearchServerURI = "http://127.0.0.1:9000/" [Chat] -- cgit v1.1 From 66eb537d0cedfd017fd8872fb1b60ed15d871d2b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 21:56:56 +0100 Subject: relocate AttachmentTests.cs to AttachmentsModuleTests.cs --- .../Attachments/Tests/AttachmentsModuleTests.cs | 172 +++++++++++++++++++++ .../Framework/Scenes/Tests/AttachmentTests.cs | 172 --------------------- prebuild.xml | 1 + 3 files changed, 173 insertions(+), 172 deletions(-) create mode 100644 OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs new file mode 100644 index 0000000..cc810d7 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -0,0 +1,172 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Timers; +using Timer=System.Timers.Timer; +using Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.CoreModules.World.Serialiser; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests +{ + /// + /// Attachment tests + /// + [TestFixture] + public class AttachmentsModuleTests + { + public Scene scene, scene2; + public UUID agent1; + public static Random random; + public ulong region1, region2; + public AgentCircuitData acd1; + public SceneObjectGroup sog1, sog2, sog3; + + [TestFixtureSetUp] + public void Init() + { + TestHelpers.InMethod(); + + scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + + ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); + interregionComms.Initialise(new IniConfigSource()); + interregionComms.PostInitialise(); + SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); + + agent1 = UUID.Random(); + random = new Random(); + sog1 = NewSOG(UUID.Random(), scene, agent1); + sog2 = NewSOG(UUID.Random(), scene, agent1); + sog3 = NewSOG(UUID.Random(), scene, agent1); + + //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); + region1 = scene.RegionInfo.RegionHandle; + region2 = scene2.RegionInfo.RegionHandle; + + SceneHelpers.AddScenePresence(scene, agent1); + } + + [Test] + public void T030_TestAddAttachments() + { + TestHelpers.InMethod(); + + ScenePresence presence = scene.GetScenePresence(agent1); + + presence.AddAttachment(sog1); + presence.AddAttachment(sog2); + presence.AddAttachment(sog3); + + Assert.That(presence.HasAttachments(), Is.True); + Assert.That(presence.ValidateAttachments(), Is.True); + } + + [Test] + public void T031_RemoveAttachments() + { + TestHelpers.InMethod(); + + ScenePresence presence = scene.GetScenePresence(agent1); + presence.RemoveAttachment(sog1); + presence.RemoveAttachment(sog2); + presence.RemoveAttachment(sog3); + Assert.That(presence.HasAttachments(), Is.False); + } + + // I'm commenting this test because scene setup NEEDS InventoryService to + // be non-null + //[Test] + public void T032_CrossAttachments() + { + TestHelpers.InMethod(); + + ScenePresence presence = scene.GetScenePresence(agent1); + ScenePresence presence2 = scene2.GetScenePresence(agent1); + presence2.AddAttachment(sog1); + presence2.AddAttachment(sog2); + + ISharedRegionModule serialiser = new SerialiserModule(); + SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); + SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); + + Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); + + //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); + Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); + Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); + } + + private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) + { + SceneObjectPart sop = new SceneObjectPart(); + sop.Name = RandomName(); + sop.Description = RandomName(); + sop.Text = RandomName(); + sop.SitName = RandomName(); + sop.TouchName = RandomName(); + sop.UUID = uuid; + sop.Shape = PrimitiveBaseShape.Default; + sop.Shape.State = 1; + sop.OwnerID = agent; + + SceneObjectGroup sog = new SceneObjectGroup(sop); + sog.SetScene(scene); + + return sog; + } + + private static string RandomName() + { + StringBuilder name = new StringBuilder(); + int size = random.Next(5,12); + char ch; + for (int i = 0; i < size; i++) + { + ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; + name.Append(ch); + } + + return name.ToString(); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs deleted file mode 100644 index 07b30f4..0000000 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using System.Threading; -using System.Timers; -using Timer=System.Timers.Timer; -using Nini.Config; -using NUnit.Framework; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.CoreModules.World.Serialiser; -using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; -using OpenSim.Tests.Common; -using OpenSim.Tests.Common.Mock; - -namespace OpenSim.Region.Framework.Scenes.Tests -{ - /// - /// Attachment tests - /// - [TestFixture] - public class AttachmentTests - { - public Scene scene, scene2; - public UUID agent1; - public static Random random; - public ulong region1, region2; - public AgentCircuitData acd1; - public SceneObjectGroup sog1, sog2, sog3; - - [TestFixtureSetUp] - public void Init() - { - TestHelpers.InMethod(); - - scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); - - ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); - interregionComms.Initialise(new IniConfigSource()); - interregionComms.PostInitialise(); - SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); - SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); - - agent1 = UUID.Random(); - random = new Random(); - sog1 = NewSOG(UUID.Random(), scene, agent1); - sog2 = NewSOG(UUID.Random(), scene, agent1); - sog3 = NewSOG(UUID.Random(), scene, agent1); - - //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); - region1 = scene.RegionInfo.RegionHandle; - region2 = scene2.RegionInfo.RegionHandle; - - SceneHelpers.AddScenePresence(scene, agent1); - } - - [Test] - public void T030_TestAddAttachments() - { - TestHelpers.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - - presence.AddAttachment(sog1); - presence.AddAttachment(sog2); - presence.AddAttachment(sog3); - - Assert.That(presence.HasAttachments(), Is.True); - Assert.That(presence.ValidateAttachments(), Is.True); - } - - [Test] - public void T031_RemoveAttachments() - { - TestHelpers.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - presence.RemoveAttachment(sog1); - presence.RemoveAttachment(sog2); - presence.RemoveAttachment(sog3); - Assert.That(presence.HasAttachments(), Is.False); - } - - // I'm commenting this test because scene setup NEEDS InventoryService to - // be non-null - //[Test] - public void T032_CrossAttachments() - { - TestHelpers.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - ScenePresence presence2 = scene2.GetScenePresence(agent1); - presence2.AddAttachment(sog1); - presence2.AddAttachment(sog2); - - ISharedRegionModule serialiser = new SerialiserModule(); - SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); - SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); - - Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); - - //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); - Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); - Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); - } - - private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) - { - SceneObjectPart sop = new SceneObjectPart(); - sop.Name = RandomName(); - sop.Description = RandomName(); - sop.Text = RandomName(); - sop.SitName = RandomName(); - sop.TouchName = RandomName(); - sop.UUID = uuid; - sop.Shape = PrimitiveBaseShape.Default; - sop.Shape.State = 1; - sop.OwnerID = agent; - - SceneObjectGroup sog = new SceneObjectGroup(sop); - sog.SetScene(scene); - - return sog; - } - - private static string RandomName() - { - StringBuilder name = new StringBuilder(); - int size = random.Next(5,12); - char ch; - for (int i = 0; i < size; i++) - { - ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; - name.Append(ch); - } - - return name.ToString(); - } - } -} \ No newline at end of file diff --git a/prebuild.xml b/prebuild.xml index 9877973..618b469 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2958,6 +2958,7 @@ + -- cgit v1.1 From 601257f8b6ff7ad97f62e0ab2a428912095bf6dc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 21:58:52 +0100 Subject: remove setting up of second scene in attachments since it's not currently used --- .../Attachments/Tests/AttachmentsModuleTests.cs | 45 ++++++++++------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index cc810d7..b008499 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -52,10 +52,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests [TestFixture] public class AttachmentsModuleTests { - public Scene scene, scene2; + public Scene scene; public UUID agent1; public static Random random; - public ulong region1, region2; + public ulong region1; public AgentCircuitData acd1; public SceneObjectGroup sog1, sog2, sog3; @@ -65,13 +65,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests TestHelpers.InMethod(); scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); interregionComms.Initialise(new IniConfigSource()); interregionComms.PostInitialise(); SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); - SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); agent1 = UUID.Random(); random = new Random(); @@ -81,7 +79,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); region1 = scene.RegionInfo.RegionHandle; - region2 = scene2.RegionInfo.RegionHandle; SceneHelpers.AddScenePresence(scene, agent1); } @@ -116,25 +113,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // I'm commenting this test because scene setup NEEDS InventoryService to // be non-null //[Test] - public void T032_CrossAttachments() - { - TestHelpers.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - ScenePresence presence2 = scene2.GetScenePresence(agent1); - presence2.AddAttachment(sog1); - presence2.AddAttachment(sog2); - - ISharedRegionModule serialiser = new SerialiserModule(); - SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); - SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); - - Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); - - //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); - Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); - Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); - } +// public void T032_CrossAttachments() +// { +// TestHelpers.InMethod(); +// +// ScenePresence presence = scene.GetScenePresence(agent1); +// ScenePresence presence2 = scene2.GetScenePresence(agent1); +// presence2.AddAttachment(sog1); +// presence2.AddAttachment(sog2); +// +// ISharedRegionModule serialiser = new SerialiserModule(); +// SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); +// SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); +// +// Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); +// +// //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); +// Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); +// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); +// } private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) { -- cgit v1.1 From c58b32e7baf199fd2168851a1f718d5650f31423 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 22:09:13 +0100 Subject: drop number of attachments in test from 3 to 2 to reduce text complexity --- .../CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index b008499..2e32377 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests public static Random random; public ulong region1; public AgentCircuitData acd1; - public SceneObjectGroup sog1, sog2, sog3; + public SceneObjectGroup sog1, sog2; [TestFixtureSetUp] public void Init() @@ -75,7 +75,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests random = new Random(); sog1 = NewSOG(UUID.Random(), scene, agent1); sog2 = NewSOG(UUID.Random(), scene, agent1); - sog3 = NewSOG(UUID.Random(), scene, agent1); //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); region1 = scene.RegionInfo.RegionHandle; @@ -92,7 +91,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests presence.AddAttachment(sog1); presence.AddAttachment(sog2); - presence.AddAttachment(sog3); Assert.That(presence.HasAttachments(), Is.True); Assert.That(presence.ValidateAttachments(), Is.True); @@ -106,7 +104,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests ScenePresence presence = scene.GetScenePresence(agent1); presence.RemoveAttachment(sog1); presence.RemoveAttachment(sog2); - presence.RemoveAttachment(sog3); Assert.That(presence.HasAttachments(), Is.False); } -- cgit v1.1 From 0bbf7c21d719de19d517417523e36bc25ac6ad70 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 22:13:13 +0100 Subject: Isolate existing incomplete attachments tests rather than have them rely on each other. Much easier to debug this way. --- .../Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 2e32377..d182996 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -59,11 +59,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests public AgentCircuitData acd1; public SceneObjectGroup sog1, sog2; - [TestFixtureSetUp] + [SetUp] public void Init() { - TestHelpers.InMethod(); - scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); @@ -83,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests } [Test] - public void T030_TestAddAttachments() + public void TestAddAttachments() { TestHelpers.InMethod(); @@ -97,11 +95,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests } [Test] - public void T031_RemoveAttachments() + public void TestRemoveAttachments() { TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); + presence.AddAttachment(sog1); + presence.AddAttachment(sog2); presence.RemoveAttachment(sog1); presence.RemoveAttachment(sog2); Assert.That(presence.HasAttachments(), Is.False); -- cgit v1.1 From d3c10e609e2862165c3a9a4e1f436634191201d3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 22:27:52 +0100 Subject: Move some previously common code back into separate tests. Remove unused region handle from test. --- .../Attachments/Tests/AttachmentsModuleTests.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index d182996..c524090 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -55,7 +55,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests public Scene scene; public UUID agent1; public static Random random; - public ulong region1; public AgentCircuitData acd1; public SceneObjectGroup sog1, sog2; @@ -73,11 +72,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests random = new Random(); sog1 = NewSOG(UUID.Random(), scene, agent1); sog2 = NewSOG(UUID.Random(), scene, agent1); - - //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); - region1 = scene.RegionInfo.RegionHandle; - - SceneHelpers.AddScenePresence(scene, agent1); } [Test] @@ -85,8 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests { TestHelpers.InMethod(); - ScenePresence presence = scene.GetScenePresence(agent1); - + ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); presence.AddAttachment(sog1); presence.AddAttachment(sog2); @@ -99,14 +92,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests { TestHelpers.InMethod(); - ScenePresence presence = scene.GetScenePresence(agent1); + ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); presence.AddAttachment(sog1); - presence.AddAttachment(sog2); + presence.AddAttachment(sog2); presence.RemoveAttachment(sog1); presence.RemoveAttachment(sog2); Assert.That(presence.HasAttachments(), Is.False); } +// [Test] +// public void TestRezAttachmentsOnAvatarEntrance() +// { +// ScenePresence presence = scene.GetScenePresence(agent1); +// } + // I'm commenting this test because scene setup NEEDS InventoryService to // be non-null //[Test] -- cgit v1.1 From 57e54d84d641787d40a2b45549f6f2d373c5f2f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 23:05:08 +0100 Subject: Add new FireAndForgetMethod.None. This executes the callback on the same thread that made the request. Designed for use only by regression tests that rely on a predicable event ordering. --- OpenSim/Framework/AvatarAppearance.cs | 12 +++++- OpenSim/Framework/Util.cs | 11 +++++- .../Attachments/Tests/AttachmentsModuleTests.cs | 46 ++++++++++++++++------ 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 02af5d9..ab4ed66 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -412,12 +412,20 @@ namespace OpenSim.Framework } /// - /// Add an attachment, if the attachpoint has the + /// Add an attachment + /// + /// + /// If the attachpoint has the /// 0x80 bit set then we assume this is an append /// operation otherwise we replace whatever is /// currently attached at the attachpoint + /// + /// + /// If UUID.Zero, then an any attachment at the attachpoint is removed. + /// + /// /// return true if something actually changed - /// + /// public bool SetAttachment(int attachpoint, UUID item, UUID asset) { if (attachpoint == 0) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 984a7a8..51ced7b 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -56,8 +56,13 @@ namespace OpenSim.Framework /// /// The method used by Util.FireAndForget for asynchronously firing events /// + /// + /// None is used to execute the method in the same thread that made the call. It should only be used by regression + /// test code that relies on predictable event ordering. + /// public enum FireAndForgetMethod { + None, UnsafeQueueUserWorkItem, QueueUserWorkItem, BeginInvoke, @@ -89,7 +94,8 @@ namespace OpenSim.Framework public static readonly Regex UUIDPattern = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); - public static FireAndForgetMethod FireAndForgetMethod = FireAndForgetMethod.SmartThreadPool; + public static FireAndForgetMethod DefaultFireAndForgetMethod = FireAndForgetMethod.SmartThreadPool; + public static FireAndForgetMethod FireAndForgetMethod = DefaultFireAndForgetMethod; /// /// Gets the name of the directory where the current running executable @@ -1506,6 +1512,9 @@ namespace OpenSim.Framework switch (FireAndForgetMethod) { + case FireAndForgetMethod.None: + realCallback.Invoke(obj); + break; case FireAndForgetMethod.UnsafeQueueUserWorkItem: ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj); break; diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index c524090..7f25864 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -37,10 +37,11 @@ using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.CoreModules.Avatar.Attachments; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; @@ -61,18 +62,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests [SetUp] public void Init() { - scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. + Util.FireAndForgetMethod = FireAndForgetMethod.None; - ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); - interregionComms.Initialise(new IniConfigSource()); - interregionComms.PostInitialise(); - SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); + scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + SceneHelpers.SetupSceneModules(scene, new AttachmentsModule()); agent1 = UUID.Random(); random = new Random(); sog1 = NewSOG(UUID.Random(), scene, agent1); sog2 = NewSOG(UUID.Random(), scene, agent1); - } + } + + [TearDown] + public void TearDown() + { + // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple + // threads. Possibly, later tests should be rewritten not to worry about such things. + Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; + } [Test] public void TestAddAttachments() @@ -100,11 +108,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests Assert.That(presence.HasAttachments(), Is.False); } -// [Test] -// public void TestRezAttachmentsOnAvatarEntrance() -// { -// ScenePresence presence = scene.GetScenePresence(agent1); -// } + [Test] + public void TestRezAttachmentsOnAvatarEntrance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID spId = TestHelpers.ParseTail(0x1); + UUID attItemId = TestHelpers.ParseTail(0x2); + UUID attAssetId = TestHelpers.ParseTail(0x3); + + AgentCircuitData acd = SceneHelpers.GenerateAgentData(spId); + acd.Appearance = new AvatarAppearance(); + acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItemId, attAssetId); + ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); + +// Assert.That(presence.HasAttachments(), Is.True); + } // I'm commenting this test because scene setup NEEDS InventoryService to // be non-null -- cgit v1.1 From d73c42407848edbf7d9c37fab17585fd6038c269 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Aug 2011 23:12:58 +0100 Subject: get rid of logged warnings about lack of some modules - afaik these never occur in real life and just clutter up tests --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 18632d7..90c4706 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1197,10 +1197,6 @@ namespace OpenSim.Region.Framework.Scenes IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) m_agentTransfer.EnableChildAgents(this); - else - m_log.DebugFormat( - "[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}", - m_scene.RegionInfo.RegionName); IFriendsModule friendsModule = m_scene.RequestModuleInterface(); if (friendsModule != null) @@ -2516,13 +2512,7 @@ namespace OpenSim.Region.Framework.Scenes // We have an appearance but we may not have the baked textures. Check the asset cache // to see if all the baked textures are already here. if (m_scene.AvatarFactory != null) - { cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); - } - else - { - m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); - } // If we aren't using a cached appearance, then clear out the baked textures if (!cachedappearance) -- cgit v1.1 From 696bd448334c89607c95385f05a53e2ab72cb984 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Aug 2011 00:37:33 +0100 Subject: Add new regression TestRezAttachmentsOnAvatarEntrance() to do simple attachments check --- .../Avatar/Attachments/AttachmentsModule.cs | 2 +- .../Attachments/Tests/AttachmentsModuleTests.cs | 22 +++++++++---- .../InventoryAccess/InventoryAccessModule.cs | 12 +++++++ .../Framework/Scenes/Tests/UserInventoryTests.cs | 8 ++--- OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs | 8 ++--- .../Tests/Common/Helpers/UserInventoryHelpers.cs | 37 +++++++++++++++++++--- 6 files changed, 69 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index ebb5bd2..4dbc5e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments false, false, remoteClient.AgentId, true); // m_log.DebugFormat( -// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", +// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", // objatt.Name, remoteClient.Name, AttachmentPt); if (objatt != null) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 7f25864..8c79ab4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -38,6 +38,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Attachments; +using OpenSim.Region.CoreModules.Framework.InventoryAccess; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.Framework.Scenes; @@ -65,8 +66,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. Util.FireAndForgetMethod = FireAndForgetMethod.None; - scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - SceneHelpers.SetupSceneModules(scene, new AttachmentsModule()); + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); + + scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule()); agent1 = UUID.Random(); random = new Random(); @@ -114,16 +119,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - UUID spId = TestHelpers.ParseTail(0x1); + UUID userId = TestHelpers.ParseTail(0x1); UUID attItemId = TestHelpers.ParseTail(0x2); UUID attAssetId = TestHelpers.ParseTail(0x3); - AgentCircuitData acd = SceneHelpers.GenerateAgentData(spId); + UserAccountHelpers.CreateUserWithInventory(scene, userId); + InventoryItemBase attItem + = UserInventoryHelpers.CreateInventoryItem( + scene, "att", attItemId, attAssetId, userId, InventoryType.Object); + + AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); acd.Appearance = new AvatarAppearance(); - acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItemId, attAssetId); + acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); -// Assert.That(presence.HasAttachments(), Is.True); + Assert.That(presence.HasAttachments(), Is.True); } // I'm commenting this test because scene setup NEEDS InventoryService to diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 4933147..65ba87b 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -964,8 +964,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } } } + else + { + m_log.WarnFormat( + "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", item.AssetID, item.Name, item.ID, remoteClient.Name); + } + return group; } + else + { + m_log.WarnFormat( + "[InventoryAccessModule]: Could not find item {0} for {1} in RezObject()", + itemID, remoteClient.Name); + } return null; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 50b1a48..55fc1e7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -59,8 +59,8 @@ namespace OpenSim.Region.Framework.Tests // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); - UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); - UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); + UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); + UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); @@ -86,8 +86,8 @@ namespace OpenSim.Region.Framework.Tests // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); - UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); - UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); + UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); + UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); InventoryFolderBase folder1 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs index d924ecd..b73df2c 100644 --- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs @@ -118,13 +118,12 @@ namespace OpenSim.Tests.Common public static UserAccount CreateUserWithInventory(Scene scene) { - return CreateUserWithInventory(scene, 99); + return CreateUserWithInventory(scene, TestHelpers.ParseTail(99)); } - public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail) + public static UserAccount CreateUserWithInventory(Scene scene, UUID userId) { - return CreateUserWithInventory( - scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll"); + return CreateUserWithInventory(scene, "Bill", "Bailey", userId, "troll"); } public static UserAccount CreateUserWithInventory( @@ -139,7 +138,6 @@ namespace OpenSim.Tests.Common { // FIXME: This should really be set up by UserAccount itself ua.ServiceURLs = new Dictionary(); - scene.UserAccountService.StoreUserAccount(ua); scene.InventoryService.CreateUserInventory(ua.PrincipalID); scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 1703597..4e60ca9 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -52,7 +52,22 @@ namespace OpenSim.Tests.Common /// public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) { - return CreateInventoryItem(scene, itemName, UUID.Random(), userId); + return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, InventoryType.Notecard); + } + + /// + /// Creates an item of the given type with an accompanying asset. + /// + /// + /// + /// + /// + /// Type of item to create + /// + public static InventoryItemBase CreateInventoryItem( + Scene scene, string itemName, UUID userId, InventoryType type) + { + return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, type); } /// @@ -61,18 +76,32 @@ namespace OpenSim.Tests.Common /// /// /// + /// /// + /// Type of item to create /// - public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) + public static InventoryItemBase CreateInventoryItem( + Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type) { - AssetBase asset = AssetHelpers.CreateAsset(scene, userId); + AssetBase asset = null; + + if (type == InventoryType.Notecard) + asset = AssetHelpers.CreateAsset(scene, userId); + else if (type == InventoryType.Object) + asset + = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId)); + else + throw new Exception(string.Format("Inventory type {0} not supported", type)); + + scene.AssetService.Store(asset); + InventoryItemBase item = new InventoryItemBase(); item.Name = itemName; item.AssetID = asset.FullID; item.ID = itemId; item.Owner = userId; item.AssetType = asset.Type; - item.InvType = (int)InventoryType.Notecard; + item.InvType = (int)type; InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); -- cgit v1.1 From bd5d35ee323df9b15d5303c2dcad7e29a4f3e0eb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Aug 2011 00:42:58 +0100 Subject: extend test to check that there is one attachment and that it has the right name --- .../CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 8c79ab4..5bac4c6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -122,11 +122,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests UUID userId = TestHelpers.ParseTail(0x1); UUID attItemId = TestHelpers.ParseTail(0x2); UUID attAssetId = TestHelpers.ParseTail(0x3); + string attName = "att"; UserAccountHelpers.CreateUserWithInventory(scene, userId); InventoryItemBase attItem = UserInventoryHelpers.CreateInventoryItem( - scene, "att", attItemId, attAssetId, userId, InventoryType.Object); + scene, attName, attItemId, attAssetId, userId, InventoryType.Object); AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); acd.Appearance = new AvatarAppearance(); @@ -134,6 +135,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); Assert.That(presence.HasAttachments(), Is.True); + List attachments = presence.Attachments; + + Assert.That(attachments.Count, Is.EqualTo(1)); + Assert.That(attachments[0].Name, Is.EqualTo(attName)); } // I'm commenting this test because scene setup NEEDS InventoryService to -- cgit v1.1 From acfdca34fd9bf6d66d144ae5c0a325dd5e864517 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Aug 2011 01:35:33 +0100 Subject: Fix issue where loading a new appearance onto an NPC would not remove the previous attachments from the scene. Addresses http://opensimulator.org/mantis/view.php?id=5636 --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 4 ++-- OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | 3 ++- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 4dbc5e6..0316d29 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -101,7 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) { - m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); +// m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); try { @@ -466,7 +466,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); group.DetachToInventoryPrep(); - m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); +// m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); // If an item contains scripts, it's always changed. // This ensures script state is saved on detach diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 6cc64c6..4cb3df2 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -96,9 +96,10 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Detach an object from the avatar. /// - /// + /// /// This method is called in response to a client's detach request, so we only update the information in /// inventory + /// /// /// void DetachObject(uint objectLocalID, IClientAPI remoteClient); diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 11fda6d..3b7ae9d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -143,6 +143,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC if (!m_avatars.ContainsKey(agentId)) return false; + // FIXME: An extremely bad bit of code that reaches directly into the attachments list and manipulates it + List attachments = sp.Attachments; + lock (attachments) + { + foreach (SceneObjectGroup att in attachments) + scene.DeleteSceneObject(att, false); + + attachments.Clear(); + } + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); sp.Appearance = npcAppearance; sp.RezAttachments(); -- cgit v1.1 From 4a9b8184f71197d1270a920b5e4ad85c9de6bed5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Aug 2011 01:51:58 +0100 Subject: For now, supress 'OH NOES' warnings given by HGInventoryBroker.CacheInventoryServiceURL when it tries to cache it for an NPC This concept is meaningless for NPCs. However, it might be better to make NPCism an actual property on ScenePresence and check. Addresses http://opensimulator.org/mantis/view.php?id=5643 --- .../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 698fd56..72ae3363 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -211,11 +211,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return; } } - else - { - m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID); - return; - } +// else +// { +// m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID); +// return; +// } } } if (sp == null) -- cgit v1.1 From 6b51d8a10e44eed7c39b58aab256789ab188ecca Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Aug 2011 23:24:41 +0100 Subject: In the asset service, check that an asset exists before attempting to store it. --- OpenSim/Data/MySQL/MySQLAssetData.cs | 9 +++++++-- OpenSim/Services/AssetService/AssetService.cs | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index e740232..a743479 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -251,12 +251,14 @@ namespace OpenSim.Data.MySQL } /// - /// check if the asset UUID exist in database + /// Check if the asset exists in the database /// /// The asset UUID - /// true if exist. + /// true if it exists, false otherwise. override public bool ExistsAsset(UUID uuid) { +// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid); + bool assetExists = false; lock (m_dbLock) @@ -273,7 +275,10 @@ namespace OpenSim.Data.MySQL using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if (dbReader.Read()) + { +// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid); assetExists = true; + } } } catch (Exception e) diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index c7a259d..d40aa4b 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -174,10 +174,12 @@ namespace OpenSim.Services.AssetService public virtual string Store(AssetBase asset) { -// m_log.DebugFormat( -// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); - - m_Database.StoreAsset(asset); + if (!m_Database.ExistsAsset(asset.FullID)) + { +// m_log.DebugFormat( +// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); + m_Database.StoreAsset(asset); + } return asset.ID; } -- cgit v1.1 From eb8b6b7d523dd6ef540d7860fc3e2121d8f60f09 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Aug 2011 23:28:57 +0100 Subject: minor: remove mono compiler warning --- OpenSim/Services/HypergridService/HGInstantMessageService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index 0d59636..0c9cfd3 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs @@ -120,7 +120,7 @@ namespace OpenSim.Services.HypergridService public bool IncomingInstantMessage(GridInstantMessage im) { // m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID); - UUID toAgentID = new UUID(im.toAgentID); +// UUID toAgentID = new UUID(im.toAgentID); bool success = false; if (m_IMSimConnector != null) -- cgit v1.1 From d8f886ccdb6f1bf185e7edaed7cd80b3027d58f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Aug 2011 23:41:20 +0100 Subject: comment out noisy attachments logging --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 0316d29..a3639e8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -226,9 +226,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public UUID RezSingleAttachmentFromInventory( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) { - m_log.DebugFormat( - "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", - (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); +// m_log.DebugFormat( +// "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", +// (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // be removed when that functionality is implemented in opensim @@ -566,8 +566,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) { - m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", - so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); +// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", +// so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); so.DetachFromBackup(); -- cgit v1.1 From c1a34cd8da293e63d3cba70b5271c9a297789db2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 18 Aug 2011 00:53:05 +0100 Subject: Don't try to save changed attachment states when an NPC with attachments is removed from the scene. This is done by introducing a PresenceType enum into ScenePresence which currently has two values, User and Npc. This seems better than a SaveAttachments flag in terms of code comprehension, though I'm still slightly uneasy about introducing these semantics to core objects --- OpenSim/Framework/IScene.cs | 7 ++-- OpenSim/Framework/PresenceType.cs | 39 ++++++++++++++++++++++ .../Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../Avatar/Attachments/AttachmentsModule.cs | 4 +-- .../Region/Examples/SimpleModule/RegionModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 9 ++--- OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 5 +-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++++-- .../Scenes/Tests/ScenePresenceAgentTests.cs | 4 +-- .../Server/IRCClientView.cs | 2 +- .../Region/OptionalModules/World/NPC/NPCModule.cs | 2 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 14 files changed, 71 insertions(+), 23 deletions(-) create mode 100644 OpenSim/Framework/PresenceType.cs diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index b5f975b..8f7a2e5 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -72,10 +72,11 @@ namespace OpenSim.Framework /// /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing - /// will promote it to a root agent during login. + /// will promote it to a root agent. /// - /// + /// The type of agent to add. + void AddNewClient(IClientAPI client, PresenceType type); /// /// Remove the given client from the scene. diff --git a/OpenSim/Framework/PresenceType.cs b/OpenSim/Framework/PresenceType.cs new file mode 100644 index 0000000..8c4c6e6 --- /dev/null +++ b/OpenSim/Framework/PresenceType.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; + +namespace OpenSim.Framework +{ + /// + /// Indicate the type of ScenePresence. + /// + public enum PresenceType + { + User, + Npc + } +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1d35973..f71871e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -692,7 +692,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public virtual void Start() { - m_scene.AddNewClient(this); + m_scene.AddNewClient(this, PresenceType.User); RefreshGroupMembership(); } diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index a3639e8..97a1be6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -501,10 +501,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// Update the attachment asset for the new sog details if they have changed. /// - /// + /// /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects, /// these details are not stored on the region. - /// + /// /// /// /// diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs index 088b818..3b8ce37 100644 --- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs +++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs @@ -95,7 +95,7 @@ namespace OpenSim.Region.Examples.SimpleModule for (int i = 0; i < 1; i++) { MyNpcCharacter m_character = new MyNpcCharacter(m_scene); - m_scene.AddNewClient(m_character); + m_scene.AddNewClient(m_character, PresenceType.Npc); m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 13b4cbc..ae88a87 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2543,10 +2543,11 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Avatar Methods /// - /// Adding a New Client and Create a Presence for it. + /// Add a new client and create a child agent for it. /// /// - public override void AddNewClient(IClientAPI client) + /// The type of agent to add. + public override void AddNewClient(IClientAPI client, PresenceType type) { AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); bool vialogin = false; @@ -2566,7 +2567,7 @@ namespace OpenSim.Region.Framework.Scenes m_clientManager.Add(client); SubscribeToClientEvents(client); - ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); + ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); m_eventManager.TriggerOnNewPresence(sp); sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; @@ -3149,7 +3150,7 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnRemovePresence(agentID); - if (avatar != null && (!avatar.IsChildAgent)) + if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc) avatar.SaveChangedAttachments(); ForEachClient( diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 2f1cdc1..ec94f10 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -175,7 +175,7 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Agent/Avatar - public abstract void AddNewClient(IClientAPI client); + public abstract void AddNewClient(IClientAPI client, PresenceType type); public abstract void RemoveClient(UUID agentID, bool closeChildAgents); public bool TryGetScenePresence(UUID agentID, out object scenePresence) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 65dc2c9..f40b373 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -590,12 +590,13 @@ namespace OpenSim.Region.Framework.Scenes } } - protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) + protected internal ScenePresence CreateAndAddChildScenePresence( + IClientAPI client, AvatarAppearance appearance, PresenceType type) { ScenePresence newAvatar = null; // ScenePresence always defaults to child agent - newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); + newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type); AddScenePresence(newAvatar); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 90c4706..e3bd393 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -75,6 +75,11 @@ namespace OpenSim.Region.Framework.Scenes private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// What type of presence is this? User, NPC, etc. + /// + public PresenceType PresenceType { get; private set; } + // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); @@ -715,8 +720,9 @@ namespace OpenSim.Region.Framework.Scenes m_animator = new ScenePresenceAnimator(this); } - private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() + private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, PresenceType type) : this() { + PresenceType = type; m_DrawDistance = world.DefaultDrawDistance; m_rootRegionHandle = reginfo.RegionHandle; m_controllingClient = client; @@ -764,8 +770,8 @@ namespace OpenSim.Region.Framework.Scenes SetDirectionVectors(); } - public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) - : this(client, world, reginfo) + public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type) + : this(client, world, reginfo, type) { m_appearance = appearance; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index dd2c717..35b41fb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -207,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests scene.NewUserConnection(acd1, 0, out reason); if (testclient == null) testclient = new TestClient(acd1, scene); - scene.AddNewClient(testclient); + scene.AddNewClient(testclient, PresenceType.User); ScenePresence presence = scene.GetScenePresence(agent1); presence.MakeRootAgent(new Vector3(90,90,90),false); @@ -257,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Adding child agent to region 1001 string reason; scene2.NewUserConnection(acd1,0, out reason); - scene2.AddNewClient(testclient); + scene2.AddNewClient(testclient, PresenceType.User); ScenePresence presence = scene.GetScenePresence(agent1); presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 15201da..c413634 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -893,7 +893,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public void Start() { - Scene.AddNewClient(this); + Scene.AddNewClient(this, PresenceType.User); // Mimicking LLClientView which gets always set appearance from client. Scene scene = (Scene)Scene; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 3b7ae9d..c1da803 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -190,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC // } scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); - scene.AddNewClient(npcAvatar); + scene.AddNewClient(npcAvatar, PresenceType.Npc); ScenePresence sp; if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 8d2108c..03df7ab 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -379,7 +379,7 @@ namespace OpenSim.Tests.Common // Stage 2: add the new client as a child agent to the scene TestClient client = new TestClient(agentData, scene); - scene.AddNewClient(client); + scene.AddNewClient(client, PresenceType.User); // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. ScenePresence scp = scene.GetScenePresence(agentData.AgentID); diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 7b64947..b7cefeb 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -579,7 +579,7 @@ namespace OpenSim.Tests.Common.Mock // Stage 2: add the new client as a child agent to the scene TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene); - TeleportTargetScene.AddNewClient(TeleportSceneClient); + TeleportTargetScene.AddNewClient(TeleportSceneClient, PresenceType.User); } public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, -- cgit v1.1 From 45c37ef494df3e6303a2c0346cb239731d448bed Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 18 Aug 2011 01:11:23 +0100 Subject: refactor: Fold 3 ScenePresence() constructors into one since only one is called. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e3bd393..564a456 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -713,15 +713,12 @@ namespace OpenSim.Region.Framework.Scenes #region Constructor(s) - public ScenePresence() + public ScenePresence( + IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type) { m_sendCourseLocationsMethod = SendCoarseLocationsDefault; CreateSceneViewer(); m_animator = new ScenePresenceAnimator(this); - } - - private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, PresenceType type) : this() - { PresenceType = type; m_DrawDistance = world.DefaultDrawDistance; m_rootRegionHandle = reginfo.RegionHandle; @@ -768,11 +765,7 @@ namespace OpenSim.Region.Framework.Scenes RegisterToEvents(); SetDirectionVectors(); - } - public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type) - : this(client, world, reginfo, type) - { m_appearance = appearance; } -- cgit v1.1 From 8d29d490a10c840a5b4f7b58c66e04295fe34edd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 18 Aug 2011 01:16:58 +0100 Subject: minor: remove some mono compiler warnings --- OpenSim/Data/MSSQL/MSSQLMigration.cs | 2 +- OpenSim/Data/MSSQL/MSSQLXInventoryData.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLMigration.cs b/OpenSim/Data/MSSQL/MSSQLMigration.cs index 1aa96c7..c2fecef 100644 --- a/OpenSim/Data/MSSQL/MSSQLMigration.cs +++ b/OpenSim/Data/MSSQL/MSSQLMigration.cs @@ -88,7 +88,7 @@ namespace OpenSim.Data.MSSQL cmd.ExecuteNonQuery(); } } - catch (Exception ex) + catch (Exception) { throw new Exception(sql); diff --git a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs index 10b0f29..b19a0da 100644 --- a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs @@ -191,7 +191,7 @@ namespace OpenSim.Data.MSSQL { cmd.ExecuteNonQuery(); } - catch (Exception e) + catch (Exception) { return false; } -- cgit v1.1 From 49258350e8e34ce36bce08a2f40b8824d67449ab Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 18 Aug 2011 01:22:01 +0100 Subject: refactor: fold CreateSceneViewer() back into ScenePresence constructor --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 564a456..719f2da 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -717,7 +717,7 @@ namespace OpenSim.Region.Framework.Scenes IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type) { m_sendCourseLocationsMethod = SendCoarseLocationsDefault; - CreateSceneViewer(); + m_sceneViewer = new SceneViewer(this); m_animator = new ScenePresenceAnimator(this); PresenceType = type; m_DrawDistance = world.DefaultDrawDistance; @@ -769,11 +769,6 @@ namespace OpenSim.Region.Framework.Scenes m_appearance = appearance; } - private void CreateSceneViewer() - { - m_sceneViewer = new SceneViewer(this); - } - public void RegisterToEvents() { m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; -- cgit v1.1 From 3146f4bae0d6c0b190fb6b8477c690046a1c79af Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 18 Aug 2011 23:36:43 +0100 Subject: Don't need to try both AssetService.Get and GetCached in GetMesh since Get always calls GetCached and code paths were identical --- .../Handlers/GetMesh/GetMeshHandler.cs | 45 +++++----------------- OpenSim/Services/Interfaces/IAssetService.cs | 8 +++- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs index c60abb1..720640e 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs @@ -57,7 +57,6 @@ namespace OpenSim.Capabilities.Handlers public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) { - Hashtable responsedata = new Hashtable(); responsedata["int_response_code"] = 400; //501; //410; //404; responsedata["content_type"] = "text/plain"; @@ -69,7 +68,6 @@ namespace OpenSim.Capabilities.Handlers if (request.ContainsKey("mesh_id")) meshStr = request["mesh_id"].ToString(); - UUID meshID = UUID.Zero; if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID)) { @@ -82,12 +80,11 @@ namespace OpenSim.Capabilities.Handlers return responsedata; } - AssetBase mesh; - // Only try to fetch locally cached textures. Misses are redirected - mesh = m_assetService.GetCached(meshID.ToString()); + AssetBase mesh = m_assetService.Get(meshID.ToString()); + if (mesh != null) { - if (mesh.Type == (SByte)AssetType.Mesh) + if (mesh.Type == (SByte)AssetType.Mesh) { responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); responsedata["content_type"] = "application/vnd.ll.mesh"; @@ -105,39 +102,15 @@ namespace OpenSim.Capabilities.Handlers } else { - mesh = m_assetService.Get(meshID.ToString()); - if (mesh != null) - { - if (mesh.Type == (SByte)AssetType.Mesh) - { - responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); - responsedata["content_type"] = "application/vnd.ll.mesh"; - responsedata["int_response_code"] = 200; - } - // Optionally add additional mesh types here - else - { - responsedata["int_response_code"] = 404; //501; //410; //404; - responsedata["content_type"] = "text/plain"; - responsedata["keepalive"] = false; - responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh."; - return responsedata; - } - } - - else - { - responsedata["int_response_code"] = 404; //501; //410; //404; - responsedata["content_type"] = "text/plain"; - responsedata["keepalive"] = false; - responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; - return responsedata; - } + responsedata["int_response_code"] = 404; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; + return responsedata; } - } return responsedata; } } -} +} \ No newline at end of file diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs index 1ac1cec..80494f1 100644 --- a/OpenSim/Services/Interfaces/IAssetService.cs +++ b/OpenSim/Services/Interfaces/IAssetService.cs @@ -56,7 +56,7 @@ namespace OpenSim.Services.Interfaces byte[] GetData(string id); /// - /// Synchronously fetches an asset from the local cache only + /// Synchronously fetches an asset from the local cache only. /// /// Asset ID /// The fetched asset, or null if it did not exist in the local cache @@ -75,7 +75,9 @@ namespace OpenSim.Services.Interfaces /// /// Creates a new asset /// - /// Returns a random ID if none is passed into it + /// + /// Returns a random ID if none is passed via the asset argument. + /// /// /// string Store(AssetBase asset); @@ -83,7 +85,9 @@ namespace OpenSim.Services.Interfaces /// /// Update an asset's content /// + /// /// Attachments and bare scripts need this!! + /// /// /// /// -- cgit v1.1 From c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 19 Aug 2011 00:45:22 +0100 Subject: Stop NPC's getting hypergrid like names in some circumstances. This meant punching in another AddUser() method in IUserManagement to do a direct name to UUID associated without the account check (since NPCs don't have accounts). May address http://opensimulator.org/mantis/view.php?id=5645 --- .../UserManagement/UserManagementModule.cs | 45 +++++++++++++++------- .../Region/Framework/Interfaces/IUserManagement.cs | 37 +++++++++++++++++- OpenSim/Region/Framework/Scenes/Scene.cs | 42 +++++++++++++------- .../World/NPC/Tests/NPCModuleTests.cs | 6 ++- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 1 + 5 files changed, 102 insertions(+), 29 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index a4861ec..b0b35e4 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -186,7 +186,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } - private string[] GetUserNames(UUID uuid) { string[] returnstring = new string[2]; @@ -292,6 +291,25 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return userID.ToString(); } + public void AddUser(UUID uuid, string first, string last) + { + if (m_UserCache.ContainsKey(uuid)) + return; + + UserData user = new UserData(); + user.Id = uuid; + user.FirstName = first; + user.LastName = last; + // user.ProfileURL = we should initialize this to the default + + AddUserInternal(user); + } + + public void AddUser(UUID uuid, string first, string last, string profileURL) + { + AddUser(uuid, profileURL + ";" + first + " " + last); + } + public void AddUser(UUID id, string creatorData) { if (m_UserCache.ContainsKey(id)) @@ -299,18 +317,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); - UserData user = new UserData(); - user.Id = id; UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); if (account != null) { - user.FirstName = account.FirstName; - user.LastName = account.LastName; - // user.ProfileURL = we should initialize this to the default + AddUser(id, account.FirstName, account.LastName); } else { + UserData user = new UserData(); + user.Id = id; + if (creatorData != null && creatorData != string.Empty) { //creatorData = ; @@ -338,17 +355,19 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement user.FirstName = "Unknown"; user.LastName = "User"; } - } - lock (m_UserCache) - m_UserCache[id] = user; - - m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.HomeURL); + AddUserInternal(user); + } } - public void AddUser(UUID uuid, string first, string last, string profileURL) + void AddUserInternal(UserData user) { - AddUser(uuid, profileURL + ";" + first + " " + last); + lock (m_UserCache) + m_UserCache[user.Id] = user; + + m_log.DebugFormat( + "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", + user.Id, user.FirstName, user.LastName, user.HomeURL); } //public void AddUser(UUID uuid, string userData) diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index 5d30aa8..c66e053 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs @@ -5,13 +5,48 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { + /// + /// This maintains the relationship between a UUID and a user name. + /// public interface IUserManagement { string GetUserName(UUID uuid); string GetUserHomeURL(UUID uuid); string GetUserUUI(UUID uuid); string GetUserServerURL(UUID uuid, string serverType); - void AddUser(UUID uuid, string userData); + + /// + /// Add a user. + /// + /// + /// If an account is found for the UUID, then the names in this will be used rather than any information + /// extracted from creatorData. + /// + /// + /// The creator data for this user. + void AddUser(UUID uuid, string creatorData); + + /// + /// Add a user. + /// + /// + /// The UUID is related to the name without any other checks being performed, such as user account presence. + /// + /// + /// + /// + void AddUser(UUID uuid, string firstName, string lastName); + + /// + /// Add a user. + /// + /// + /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the + /// AddUser(UUID uuid, string creatorData) method. + /// + /// + /// + /// void AddUser(UUID uuid, string firstName, string lastName, string profileURL); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ae88a87..513c0ea 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2582,12 +2582,13 @@ namespace OpenSim.Region.Framework.Scenes } } - if (GetScenePresence(client.AgentId) != null) + ScenePresence createdSp = GetScenePresence(client.AgentId); + if (createdSp != null) { m_LastLogin = Util.EnvironmentTickCount(); // Cache the user's name - CacheUserName(aCircuit); + CacheUserName(createdSp, aCircuit); EventManager.TriggerOnNewClient(client); if (vialogin) @@ -2595,28 +2596,41 @@ namespace OpenSim.Region.Framework.Scenes } } - private void CacheUserName(AgentCircuitData aCircuit) + /// + /// Cache the user name for later use. + /// + /// + /// + private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) { IUserManagement uMan = RequestModuleInterface(); if (uMan != null) { - string homeURL = string.Empty; string first = aCircuit.firstname, last = aCircuit.lastname; - if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) - homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); - - if (aCircuit.lastname.StartsWith("@")) + if (sp.PresenceType == PresenceType.Npc) + { + uMan.AddUser(aCircuit.AgentID, first, last); + } + else { - string[] parts = aCircuit.firstname.Split('.'); - if (parts.Length >= 2) + string homeURL = string.Empty; + + if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) + homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); + + if (aCircuit.lastname.StartsWith("@")) { - first = parts[0]; - last = parts[1]; + string[] parts = aCircuit.firstname.Split('.'); + if (parts.Length >= 2) + { + first = parts[0]; + last = parts[1]; + } } - } - uMan.AddUser(aCircuit.AgentID, first, last, homeURL); + uMan.AddUser(aCircuit.AgentID, first, last, homeURL); + } } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index f8afc5a..78296a4 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -34,6 +34,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.AvatarFactory; +using OpenSim.Region.CoreModules.Framework.UserManagement; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -57,8 +58,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests config.Configs["NPC"].Set("Enabled", "true"); AvatarFactoryModule afm = new AvatarFactoryModule(); + UserManagementModule umm = new UserManagementModule(); + TestScene scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); + SceneHelpers.SetupSceneModules(scene, config, afm, umm, new NPCModule()); ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); @@ -81,6 +84,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc, Is.Not.Null); Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); + Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); } [Test] diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 03df7ab..086a725 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -331,6 +331,7 @@ namespace OpenSim.Tests.Common agentData.InventoryFolder = UUID.Zero; agentData.startpos = Vector3.Zero; agentData.CapsPath = "http://wibble.com"; + agentData.ServiceURLs = new Dictionary(); return agentData; } -- cgit v1.1 From bb5b396fc5ac15d7451df407e75c2ca99c0b9dd1 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 18 Aug 2011 15:27:03 -0700 Subject: Fix exception when using BasicPhysics --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7778ebc..a0e87d0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1603,7 +1603,6 @@ namespace OpenSim.Region.Framework.Scenes RotationOffset, RigidBody, m_localId); - PhysActor.SetMaterial(Material); } catch { @@ -1615,6 +1614,7 @@ namespace OpenSim.Region.Framework.Scenes { PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info PhysActor.SOPDescription = this.Description; + PhysActor.SetMaterial(Material); DoPhysicsPropertyUpdate(RigidBody, true); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); } @@ -4530,11 +4530,11 @@ namespace OpenSim.Region.Framework.Scenes RotationOffset, UsePhysics, m_localId); - PhysActor.SetMaterial(Material); pa = PhysActor; if (pa != null) { + PhysActor.SetMaterial(Material); DoPhysicsPropertyUpdate(UsePhysics, true); if (m_parentGroup != null) -- cgit v1.1 From a0a0c64cb181b56d9e87bbcf9eaa731171af2e41 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 19 Aug 2011 03:02:17 +0100 Subject: Get rid of HttpServer.dll to avoid confusion since we use HttpServer_OpenSim.dll (patched version) instead --- bin/HttpServer.dll | Bin 102400 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 bin/HttpServer.dll diff --git a/bin/HttpServer.dll b/bin/HttpServer.dll deleted file mode 100755 index 717ceed..0000000 Binary files a/bin/HttpServer.dll and /dev/null differ -- cgit v1.1