From b6476eaac35c37862ae74e6f6a070a80cf51c0c0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 17 Jul 2012 00:00:26 +0100 Subject: Stop sending the viewer an inventory create message if a known attachment item is updated. This doesn't seem to make any sense and probably stems from a period when this code was directly involved in attaching objects directly from the scene. This message is already being sent by InventoryAccessModule code instead. --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 64ee7e4..fff47e2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -566,11 +566,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments item.InvType = (int)InventoryType.Object; m_scene.InventoryService.UpdateItem(item); - - // this gets called when the agent logs off! - if (sp.ControllingClient != null) - sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); } + grp.HasGroupChanged = false; // Prevent it being saved over and over } // else -- cgit v1.1 From 356d5972961cc91593cfcc5c529a8ba81381b8f4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 17 Jul 2012 00:17:51 +0100 Subject: Restore update of inventory item on derez/logout. This is necessary to update the name if this has been changed whilst attached. Note, this behaviour appears to be at variance with the ll grid as of Tues 17 July 2012, testing with viewer 3.2.1. The item name in inventory does not change either at the point of detach or after a relog. --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index fff47e2..d34a8f6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -566,8 +566,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments item.InvType = (int)InventoryType.Object; m_scene.InventoryService.UpdateItem(item); + + // If the name of the object has been changed whilst attached then we want to update the inventory + // item in the viewer. + if (sp.ControllingClient != null) + sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); } - + grp.HasGroupChanged = false; // Prevent it being saved over and over } // else -- cgit v1.1 From ecb759c1e5b0ea3e1c81310acf3fe31561d2be3a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 17 Jul 2012 23:31:38 +0100 Subject: Fix regression where llGiveInventory() had stopped asking non-owner receivers to accept/decline. This appears to be a regression from back in commit db91044 (Mon Aug 22 2011) where we started to send TaskInventoryOffered msg dialog rather than InventoryOffered dialog. This is probably correct, but failed because the bucket was too large and because we wouldn't have handled the TaskInventoryDeclined option anyway. This patch handles both of these and make llGiveInventoryList() use TaskInventoryOffered as well Fixes http://opensimulator.org/mantis/view.php?id=6089 --- .../Avatar/InstantMessage/MessageTransferModule.cs | 19 +++++++++++-------- .../Inventory/Transfer/InventoryTransferModule.cs | 4 +++- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 0dad3c4..596174b 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -137,13 +137,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage foreach (Scene scene in m_Scenes) { // m_log.DebugFormat( -// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", +// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", // toAgentID.ToString(), scene.RegionInfo.RegionName); + ScenePresence sp = scene.GetScenePresence(toAgentID); if (sp != null && !sp.IsChildAgent) { // Local message -// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); + m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", sp.Name, toAgentID); + sp.ControllingClient.SendInstantMessage(im); // Message sent @@ -155,13 +157,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage // try child avatar second foreach (Scene scene in m_Scenes) { -// m_log.DebugFormat( -// "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); + m_log.DebugFormat( + "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); + ScenePresence sp = scene.GetScenePresence(toAgentID); if (sp != null) { // Local message -// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); + m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", sp.Name, toAgentID); + sp.ControllingClient.SendInstantMessage(im); // Message sent @@ -170,10 +174,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } -// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); - SendGridInstantMessageViaXMLRPC(im, result); + m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); - return; + SendGridInstantMessageViaXMLRPC(im, result); } private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 19c774f..f3af59a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -297,7 +297,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer }); } } - else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) + else if ( + im.dialog == (byte)InstantMessageDialog.InventoryDeclined + || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) { // Here, the recipient is local and we can assume that the // inventory is loaded. Courtesy of the above bulk update, -- cgit v1.1 From c4533e755bd321195056cfbbebc80dcc05998680 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jul 2012 23:13:08 +0100 Subject: Comment out OnIncomingInstantMessage and OnInstantMessage handlers in GroupsModule, since these led to a private blank method --- .../Region/CoreModules/Avatar/Groups/GroupsModule.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs index 31363e5..b258e13 100644 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs @@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClientClosed += OnClientClosed; - scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; +// scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; } public void PostInitialise() @@ -133,7 +133,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups private void OnNewClient(IClientAPI client) { // Subscribe to instant messages - client.OnInstantMessage += OnInstantMessage; +// client.OnInstantMessage += OnInstantMessage; client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; lock (m_ClientMap) @@ -171,15 +171,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups ActiveGroupTitle); } - private void OnInstantMessage(IClientAPI client, GridInstantMessage im) - { - } +// private void OnInstantMessage(IClientAPI client, GridInstantMessage im) +// { +// } - private void OnGridInstantMessage(GridInstantMessage msg) - { - // Trigger the above event handler - OnInstantMessage(null, msg); - } +// private void OnGridInstantMessage(GridInstantMessage msg) +// { +// // Trigger the above event handler +// OnInstantMessage(null, msg); +// } private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client) { -- cgit v1.1 From fe99948c582cb7a9c0a999bbbc179f254b2e47c7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 20 Jul 2012 11:54:59 +0200 Subject: Fix the order of operations on detach. The object must always be serialized while still in the scene to avoid losing important script state. DeleteSceneObject can not be called before doing this! --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d34a8f6..0f3b1e8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -690,18 +690,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); sp.RemoveAttachment(so); - // We can only remove the script instances from the script engine after we've retrieved their xml state - // when we update the attachment item. - m_scene.DeleteSceneObject(so, false, false); - // Prepare sog for storage so.AttachedAvatar = UUID.Zero; so.RootPart.SetParentLocalId(0); so.IsAttachment = false; - so.AbsolutePosition = so.RootPart.AttachedPos; + + // We cannot use AbsolutePosition here because that would + // attempt to cross the prim as it is detached + so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); UpdateKnownItem(sp, so, true); - so.RemoveScriptInstances(true); + + // This MUST happen AFTER serialization because it will + // either stop or remove the scripts. Both will cause scripts + // to be serialized in a stopped state with the true run + // state already lost. + m_scene.DeleteSceneObject(so, false, true); } private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( -- cgit v1.1 From e126915bc168f16f2c4462492814a1b733aefe87 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 23 Jul 2012 21:08:02 +0200 Subject: Change attachment handling to remove object from the scene first as per justincc's original work. Sample scripts before doing so. Also refactor some crucial common code and eliminate parameters that were only ever used with the same constant value. --- .../Avatar/Attachments/AttachmentsModule.cs | 88 +++++++++++++++------- 1 file changed, 59 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 0f3b1e8..464dfd3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -28,6 +28,8 @@ using System; using System.Collections.Generic; using System.Reflection; +using System.IO; +using System.Xml; using log4net; using Mono.Addins; using Nini.Config; @@ -202,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } - public void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted) + public void DeRezAttachments(IScenePresence sp) { if (!Enabled) return; @@ -213,18 +215,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { foreach (SceneObjectGroup so in sp.GetAttachments()) { - // We can only remove the script instances from the script engine after we've retrieved their xml state - // when we update the attachment item. - m_scene.DeleteSceneObject(so, false, false); - - if (saveChanged || saveAllScripted) - { - so.IsAttachment = false; - so.AbsolutePosition = so.RootPart.AttachedPos; - UpdateKnownItem(sp, so, saveAllScripted); - } - - so.RemoveScriptInstances(true); + UpdateDetachedObject(sp, so); } sp.ClearAttachments(); @@ -528,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// /// - private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, bool saveAllScripted) + private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, string scriptedState) { // Saving attachments for NPCs messes them up for the real owner! INPCModule module = m_scene.RequestModuleInterface(); @@ -538,13 +529,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return; } - if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts())) + if (grp.HasGroupChanged) { // m_log.DebugFormat( // "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", // grp.UUID, grp.AttachmentPoint); - string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); + string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState); InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID); item = m_scene.InventoryService.GetItem(item); @@ -683,29 +674,68 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return newItem; } - private void DetachSingleAttachmentToInvInternal(IScenePresence sp, SceneObjectGroup so) + private string GetObjectScriptStates(SceneObjectGroup grp) { - // m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name); + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + grp.SaveScriptedState(writer); + } - m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); - sp.RemoveAttachment(so); + return sw.ToString(); + } + } + + private void UpdateDetachedObject(IScenePresence sp, SceneObjectGroup so) + { + // Don't save attachments for HG visitors, it + // messes up their inventory. When a HG visitor logs + // out on a foreign grid, their attachments will be + // reloaded in the state they were in when they left + // the home grid. This is best anyway as the visited + // grid may use an incompatible script engine. + bool saveChanged + = sp.PresenceType != PresenceType.Npc + && (m_scene.UserManagementModule == null + || m_scene.UserManagementModule.IsLocalGridUser(sp.UUID)); + + // Scripts MUST be snapshotted before the object is + // removed from the scene because doing otherwise will + // clobber the run flag + string scriptedState = GetObjectScriptStates(so); + + // Remove the object from the scene so no more updates + // are sent. Doing this before the below changes will ensure + // updates can't cause "HUD artefacts" + m_scene.DeleteSceneObject(so, false, false); // Prepare sog for storage so.AttachedAvatar = UUID.Zero; so.RootPart.SetParentLocalId(0); so.IsAttachment = false; - // We cannot use AbsolutePosition here because that would - // attempt to cross the prim as it is detached - so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); + if (saveChanged) + { + // We cannot use AbsolutePosition here because that would + // attempt to cross the prim as it is detached + so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); + + UpdateKnownItem(sp, so, scriptedState); + } + + // Now, remove the scripts + so.RemoveScriptInstances(true); + } - UpdateKnownItem(sp, so, true); + private void DetachSingleAttachmentToInvInternal(IScenePresence sp, SceneObjectGroup so) + { + // m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name); + + m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); + sp.RemoveAttachment(so); - // This MUST happen AFTER serialization because it will - // either stop or remove the scripts. Both will cause scripts - // to be serialized in a stopped state with the true run - // state already lost. - m_scene.DeleteSceneObject(so, false, true); + UpdateDetachedObject(sp, so); } private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( -- cgit v1.1 From 2858b1b1f44f67d7ac88b5dcaffbc9710e9e365c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Jul 2012 22:33:54 +0100 Subject: extend regression TestDetachScriptedAttachementToInventory() to check correct running status on a re-rezzed attachment --- .../Attachments/Tests/AttachmentsModuleTests.cs | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index b021a47..8d2128c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -47,6 +47,8 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.ScriptEngine.Interfaces; +using OpenSim.Region.ScriptEngine.Shared.Instance; using OpenSim.Region.ScriptEngine.XEngine; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; @@ -379,29 +381,49 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); - TaskInventoryHelpers.AddScript(scene, so.RootPart); + TaskInventoryItem scriptTaskItem + = TaskInventoryHelpers.AddScript( + scene, + so.RootPart, + "scriptItem", + "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); + InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000); // FIXME: Right now, we have to do a tricksy chat listen to make sure we know when the script is running. // In the future, we need to be able to do this programatically more predicably. scene.EventManager.OnChatFromWorld += OnChatFromWorld; - SceneObjectGroup soRezzed + SceneObjectGroup rezzedSo = scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); // Wait for chat to signal rezzed script has been started. m_chatEvent.WaitOne(60000); - scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, soRezzed); + scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo); InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem); AssetBase asset = scene.AssetService.Get(userItemUpdated.AssetID.ToString()); + // TODO: It would probably be better here to check script state via the saving and retrieval of state + // information at a higher level, rather than having to inspect the serialization. XmlDocument soXml = new XmlDocument(); soXml.LoadXml(Encoding.UTF8.GetString(asset.Data)); XmlNodeList scriptStateNodes = soXml.GetElementsByTagName("ScriptState"); Assert.That(scriptStateNodes.Count, Is.EqualTo(1)); + + // Re-rez the attachment to check script running state + SceneObjectGroup reRezzedSo = scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); + + // Wait for chat to signal rezzed script has been started. + m_chatEvent.WaitOne(60000); + + TaskInventoryItem reRezzedScriptItem = reRezzedSo.RootPart.Inventory.GetInventoryItem(scriptTaskItem.Name); + IScriptModule xengine = scene.RequestModuleInterface(); + Assert.That(xengine.GetScriptState(reRezzedScriptItem.ItemID), Is.True); + +// Console.WriteLine(soXml.OuterXml); } /// -- cgit v1.1 From c99262957630749debbf12372cab88c1f3faa6b8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Jul 2012 22:40:06 +0100 Subject: extend regression TestRezScriptedAttachmentFromInventory() to check actual start of script rather than just the script status reported by SOG.ContainsScripts() --- .../Attachments/Tests/AttachmentsModuleTests.cs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 8d2128c..8337345 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -291,21 +291,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests { TestHelpers.InMethod(); - Scene scene = CreateTestScene(); + Scene scene = CreateScriptingEnabledTestScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); + ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); - TaskInventoryHelpers.AddScript(scene, so.RootPart); + TaskInventoryItem scriptItem + = TaskInventoryHelpers.AddScript( + scene, + so.RootPart, + "scriptItem", + "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); + InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000); + // FIXME: Right now, we have to do a tricksy chat listen to make sure we know when the script is running. + // In the future, we need to be able to do this programatically more predicably. + scene.EventManager.OnChatFromWorld += OnChatFromWorld; + scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); + m_chatEvent.WaitOne(60000); + // TODO: Need to have a test that checks the script is actually started but this involves a lot more // plumbing of the script engine and either pausing for events or more infrastructure to turn off various // script engine delays/asychronicity that isn't helpful in an automated regression testing context. SceneObjectGroup attSo = scene.GetSceneObjectGroup(so.Name); Assert.That(attSo.ContainsScripts(), Is.True); + + TaskInventoryItem reRezzedScriptItem = attSo.RootPart.Inventory.GetInventoryItem(scriptItem.Name); + IScriptModule xengine = scene.RequestModuleInterface(); + Assert.That(xengine.GetScriptState(reRezzedScriptItem.ItemID), Is.True); } [Test] -- cgit v1.1 From c846a5461ca2f27a1ddb4a6cad12194e8eb3b955 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Jul 2012 22:46:22 +0100 Subject: Remove bad using statement in AttachmentsModuleTests. It seems that the mono 2.10.8.1 doesn't choke on this but for some reason 2.4.3 fails. --- .../CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 8337345..6e7a414 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -48,7 +48,6 @@ using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.ScriptEngine.Interfaces; -using OpenSim.Region.ScriptEngine.Shared.Instance; using OpenSim.Region.ScriptEngine.XEngine; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; @@ -307,7 +306,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // FIXME: Right now, we have to do a tricksy chat listen to make sure we know when the script is running. // In the future, we need to be able to do this programatically more predicably. - scene.EventManager.OnChatFromWorld += OnChatFromWorld; + scene.EventManager.OnChatFromWorld += OnChatFromWorld; scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); -- cgit v1.1 From 35efa88c26d249d315837fdca0faf643511e1a4e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Jul 2012 23:11:50 +0100 Subject: Rename OpenSim.Framework.Statistics to OpenSim.Framework.Monitoring. This better reflects the long-term purpose of that project and matches Monitoring modules. --- OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar') diff --git a/OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs b/OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs index 4bcd2ac..764adf9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs @@ -37,7 +37,7 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Statistics; +using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -- cgit v1.1