aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-09-29 01:14:23 +0100
committerJustin Clark-Casey (justincc)2012-09-29 01:14:23 +0100
commit818379ba14e487568571113d24a9de7c3a29b458 (patch)
tree43d0f69be77551c77cf6ae45ff4cf256a3539d95 /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-818379ba14e487568571113d24a9de7c3a29b458.zip
opensim-SC_OLD-818379ba14e487568571113d24a9de7c3a29b458.tar.gz
opensim-SC_OLD-818379ba14e487568571113d24a9de7c3a29b458.tar.bz2
opensim-SC_OLD-818379ba14e487568571113d24a9de7c3a29b458.tar.xz
Fire EventManager.TriggerOnAttach (and hence LSL attach event) when an object is attached from the scene.
Enables previously disabled regression test. Based on SingpostMarv's patch in http://opensimulator.org/mantis/view.php?id=6302 but I prefer a simpler approach that does not expose a resume scripts option right now.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs4
2 files changed, 18 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index c74584c..130c869 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -238,9 +238,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
238 238
239 sp.ClearAttachments(); 239 sp.ClearAttachments();
240 } 240 }
241 241
242 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp) 242 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp)
243 { 243 {
244 if (!Enabled)
245 return false;
246
247 if (AttachObjectInternal(sp, group, attachmentPt, silent, temp))
248 {
249 m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID);
250 return true;
251 }
252
253 return false;
254 }
255
256 private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp)
257 {
244 lock (sp.AttachmentsSyncLock) 258 lock (sp.AttachmentsSyncLock)
245 { 259 {
246// m_log.DebugFormat( 260// m_log.DebugFormat(
@@ -794,7 +808,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
794 // This will throw if the attachment fails 808 // This will throw if the attachment fails
795 try 809 try
796 { 810 {
797 AttachObject(sp, objatt, attachmentPt, false, false); 811 AttachObjectInternal(sp, objatt, attachmentPt, false, false);
798 } 812 }
799 catch (Exception e) 813 catch (Exception e)
800 { 814 {
@@ -951,15 +965,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
951 AttachmentPt &= 0x7f; 965 AttachmentPt &= 0x7f;
952 966
953 // Calls attach with a Zero position 967 // Calls attach with a Zero position
954 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false)) 968 AttachObject(sp, part.ParentGroup, AttachmentPt, false, false);
955 {
956// m_log.Debug(
957// "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
958// + ", AttachmentPoint: " + AttachmentPt);
959
960 // Save avatar attachment information
961 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
962 }
963 } 969 }
964 catch (Exception e) 970 catch (Exception e)
965 { 971 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 8d4e2e0..0ee01c7 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -225,9 +225,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
225 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 225 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
226 226
227 // Check events 227 // Check events
228 228 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
229 // FIXME: This is currently not occuring!
230// Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
231 } 229 }
232 230
233 /// <summary> 231 /// <summary>