diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
4 files changed, 170 insertions, 145 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8a3eeaa..b6a7481 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -241,12 +241,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
241 | 241 | ||
242 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); | 242 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); |
243 | 243 | ||
244 | List<SceneObjectGroup> attachments = sp.GetAttachments(); | ||
245 | |||
246 | if (attachments.Count <= 0) | ||
247 | return; | ||
248 | |||
249 | Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>(); | ||
250 | |||
251 | foreach (SceneObjectGroup so in attachments) | ||
252 | { | ||
253 | // Scripts MUST be snapshotted before the object is | ||
254 | // removed from the scene because doing otherwise will | ||
255 | // clobber the run flag | ||
256 | // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from | ||
257 | // scripts performing attachment operations at the same time. Getting object states stops the scripts. | ||
258 | scriptStates[so] = PrepareScriptInstanceForSave(so, false); | ||
259 | } | ||
260 | |||
244 | lock (sp.AttachmentsSyncLock) | 261 | lock (sp.AttachmentsSyncLock) |
245 | { | 262 | { |
246 | foreach (SceneObjectGroup so in sp.GetAttachments()) | 263 | foreach (SceneObjectGroup so in attachments) |
247 | { | 264 | UpdateDetachedObject(sp, so, scriptStates[so]); |
248 | UpdateDetachedObject(sp, so); | ||
249 | } | ||
250 | 265 | ||
251 | sp.ClearAttachments(); | 266 | sp.ClearAttachments(); |
252 | } | 267 | } |
@@ -285,32 +300,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
285 | 300 | ||
286 | private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp) | 301 | private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp) |
287 | { | 302 | { |
288 | lock (sp.AttachmentsSyncLock) | ||
289 | { | ||
290 | // m_log.DebugFormat( | 303 | // m_log.DebugFormat( |
291 | // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", | 304 | // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", |
292 | // group.Name, group.LocalId, sp.Name, attachmentPt, silent); | 305 | // group.Name, group.LocalId, sp.Name, attachmentPt, silent); |
293 | 306 | ||
294 | if (group.GetSittingAvatarsCount() != 0) | 307 | if (group.GetSittingAvatarsCount() != 0) |
295 | { | 308 | { |
296 | // m_log.WarnFormat( | 309 | // m_log.WarnFormat( |
297 | // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since {4} avatars are still sitting on it", | 310 | // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since {4} avatars are still sitting on it", |
298 | // group.Name, group.LocalId, sp.Name, attachmentPt, group.GetSittingAvatarsCount()); | 311 | // group.Name, group.LocalId, sp.Name, attachmentPt, group.GetSittingAvatarsCount()); |
299 | 312 | ||
300 | return false; | 313 | return false; |
301 | } | 314 | } |
302 | 315 | ||
303 | if (sp.GetAttachments(attachmentPt).Contains(group)) | 316 | if (sp.GetAttachments(attachmentPt).Contains(group)) |
304 | { | 317 | { |
305 | // m_log.WarnFormat( | 318 | // m_log.WarnFormat( |
306 | // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", | 319 | // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", |
307 | // group.Name, group.LocalId, sp.Name, AttachmentPt); | 320 | // group.Name, group.LocalId, sp.Name, AttachmentPt); |
308 | 321 | ||
309 | return false; | 322 | return false; |
310 | } | 323 | } |
311 | 324 | ||
325 | // Remove any previous attachments | ||
326 | List<SceneObjectGroup> existingAttachments = sp.GetAttachments(attachmentPt); | ||
327 | |||
328 | // At the moment we can only deal with a single attachment | ||
329 | if (existingAttachments.Count != 0 && existingAttachments[0].FromItemID != UUID.Zero) | ||
330 | DetachSingleAttachmentToInv(sp, group); | ||
331 | |||
332 | lock (sp.AttachmentsSyncLock) | ||
333 | { | ||
312 | Vector3 attachPos = group.AbsolutePosition; | 334 | Vector3 attachPos = group.AbsolutePosition; |
313 | 335 | ||
314 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 336 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
315 | // be removed when that functionality is implemented in opensim | 337 | // be removed when that functionality is implemented in opensim |
316 | attachmentPt &= 0x7f; | 338 | attachmentPt &= 0x7f; |
@@ -322,14 +344,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
322 | { | 344 | { |
323 | attachPos = Vector3.Zero; | 345 | attachPos = Vector3.Zero; |
324 | } | 346 | } |
325 | 347 | ||
326 | // AttachmentPt 0 means the client chose to 'wear' the attachment. | 348 | // AttachmentPt 0 means the client chose to 'wear' the attachment. |
327 | if (attachmentPt == 0) | 349 | if (attachmentPt == 0) |
328 | { | 350 | { |
329 | // Check object for stored attachment point | 351 | // Check object for stored attachment point |
330 | attachmentPt = group.AttachmentPoint; | 352 | attachmentPt = group.AttachmentPoint; |
331 | } | 353 | } |
332 | 354 | ||
333 | // if we still didn't find a suitable attachment point....... | 355 | // if we still didn't find a suitable attachment point....... |
334 | if (attachmentPt == 0) | 356 | if (attachmentPt == 0) |
335 | { | 357 | { |
@@ -337,13 +359,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
337 | attachmentPt = (uint)AttachmentPoint.LeftHand; | 359 | attachmentPt = (uint)AttachmentPoint.LeftHand; |
338 | attachPos = Vector3.Zero; | 360 | attachPos = Vector3.Zero; |
339 | } | 361 | } |
340 | 362 | ||
341 | group.AttachmentPoint = attachmentPt; | 363 | group.AttachmentPoint = attachmentPt; |
342 | group.AbsolutePosition = attachPos; | 364 | group.AbsolutePosition = attachPos; |
343 | 365 | ||
344 | if (sp.PresenceType != PresenceType.Npc) | 366 | if (sp.PresenceType != PresenceType.Npc) |
345 | UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp); | 367 | UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp); |
346 | 368 | ||
347 | AttachToAgent(sp, group, attachmentPt, attachPos, silent); | 369 | AttachToAgent(sp, group, attachmentPt, attachPos, silent); |
348 | } | 370 | } |
349 | 371 | ||
@@ -352,21 +374,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
352 | 374 | ||
353 | private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp) | 375 | private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp) |
354 | { | 376 | { |
355 | // Remove any previous attachments | ||
356 | List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); | ||
357 | |||
358 | // At the moment we can only deal with a single attachment | ||
359 | if (attachments.Count != 0) | ||
360 | { | ||
361 | if (attachments[0].FromItemID != UUID.Zero) | ||
362 | DetachSingleAttachmentToInvInternal(sp, attachments[0]); | ||
363 | // Error logging commented because UUID.Zero now means temp attachment | ||
364 | // else | ||
365 | // m_log.WarnFormat( | ||
366 | // "[ATTACHMENTS MODULE]: When detaching existing attachment {0} {1} at point {2} to make way for {3} {4} for {5}, couldn't find the associated item ID to adjust inventory attachment record!", | ||
367 | // attachments[0].Name, attachments[0].LocalId, attachmentPt, group.Name, group.LocalId, sp.Name); | ||
368 | } | ||
369 | |||
370 | // Add the new attachment to inventory if we don't already have it. | 377 | // Add the new attachment to inventory if we don't already have it. |
371 | if (!temp) | 378 | if (!temp) |
372 | { | 379 | { |
@@ -426,12 +433,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
426 | return; | 433 | return; |
427 | 434 | ||
428 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name); | 435 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name); |
429 | lock (sp.AttachmentsSyncLock) | 436 | |
437 | foreach (KeyValuePair<UUID, uint> rez in rezlist) | ||
430 | { | 438 | { |
431 | foreach (KeyValuePair<UUID, uint> rez in rezlist) | 439 | RezSingleAttachmentFromInventory(sp, rez.Key, rez.Value); |
432 | { | ||
433 | RezSingleAttachmentFromInventory(sp, rez.Key, rez.Value); | ||
434 | } | ||
435 | } | 440 | } |
436 | } | 441 | } |
437 | 442 | ||
@@ -511,25 +516,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
511 | 516 | ||
512 | public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) | 517 | public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) |
513 | { | 518 | { |
519 | if (so.AttachedAvatar != sp.UUID) | ||
520 | { | ||
521 | m_log.WarnFormat( | ||
522 | "[ATTACHMENTS MODULE]: Tried to detach object {0} from {1} {2} but attached avatar id was {3} in {4}", | ||
523 | so.Name, sp.Name, sp.UUID, so.AttachedAvatar, m_scene.RegionInfo.RegionName); | ||
524 | |||
525 | return; | ||
526 | } | ||
527 | |||
528 | // Scripts MUST be snapshotted before the object is | ||
529 | // removed from the scene because doing otherwise will | ||
530 | // clobber the run flag | ||
531 | // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from | ||
532 | // scripts performing attachment operations at the same time. Getting object states stops the scripts. | ||
533 | string scriptedState = PrepareScriptInstanceForSave(so, true); | ||
534 | |||
514 | lock (sp.AttachmentsSyncLock) | 535 | lock (sp.AttachmentsSyncLock) |
515 | { | 536 | { |
516 | // Save avatar attachment information | 537 | // Save avatar attachment information |
517 | // m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID); | 538 | // m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID); |
518 | 539 | ||
519 | if (so.AttachedAvatar != sp.UUID) | ||
520 | { | ||
521 | m_log.WarnFormat( | ||
522 | "[ATTACHMENTS MODULE]: Tried to detach object {0} from {1} {2} but attached avatar id was {3} in {4}", | ||
523 | so.Name, sp.Name, sp.UUID, so.AttachedAvatar, m_scene.RegionInfo.RegionName); | ||
524 | |||
525 | return; | ||
526 | } | ||
527 | |||
528 | bool changed = sp.Appearance.DetachAttachment(so.FromItemID); | 540 | bool changed = sp.Appearance.DetachAttachment(so.FromItemID); |
529 | if (changed && m_scene.AvatarFactory != null) | 541 | if (changed && m_scene.AvatarFactory != null) |
530 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); | 542 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); |
531 | 543 | ||
532 | DetachSingleAttachmentToInvInternal(sp, so); | 544 | sp.RemoveAttachment(so); |
545 | UpdateDetachedObject(sp, so, scriptedState); | ||
533 | } | 546 | } |
534 | } | 547 | } |
535 | 548 | ||
@@ -739,8 +752,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
739 | return newItem; | 752 | return newItem; |
740 | } | 753 | } |
741 | 754 | ||
742 | private string GetObjectScriptStates(SceneObjectGroup grp) | 755 | /// <summary> |
756 | /// Prepares the script instance for save. | ||
757 | /// </summary> | ||
758 | /// <remarks> | ||
759 | /// This involves triggering the detach event and getting the script state (which also stops the script) | ||
760 | /// This MUST be done outside sp.AttachmentsSyncLock, since otherwise there is a chance of deadlock if a | ||
761 | /// running script is performing attachment operations. | ||
762 | /// </remarks> | ||
763 | /// <returns> | ||
764 | /// The script state ready for persistence. | ||
765 | /// </returns> | ||
766 | /// <param name='grp'> | ||
767 | /// </param> | ||
768 | /// <param name='fireDetachEvent'> | ||
769 | /// If true, then fire the script event before we save its state. | ||
770 | /// </param> | ||
771 | private string PrepareScriptInstanceForSave(SceneObjectGroup grp, bool fireDetachEvent) | ||
743 | { | 772 | { |
773 | if (fireDetachEvent) | ||
774 | m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); | ||
775 | |||
744 | using (StringWriter sw = new StringWriter()) | 776 | using (StringWriter sw = new StringWriter()) |
745 | { | 777 | { |
746 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | 778 | using (XmlTextWriter writer = new XmlTextWriter(sw)) |
@@ -752,7 +784,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
752 | } | 784 | } |
753 | } | 785 | } |
754 | 786 | ||
755 | private void UpdateDetachedObject(IScenePresence sp, SceneObjectGroup so) | 787 | private void UpdateDetachedObject(IScenePresence sp, SceneObjectGroup so, string scriptedState) |
756 | { | 788 | { |
757 | // Don't save attachments for HG visitors, it | 789 | // Don't save attachments for HG visitors, it |
758 | // messes up their inventory. When a HG visitor logs | 790 | // messes up their inventory. When a HG visitor logs |
@@ -765,11 +797,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
765 | && (m_scene.UserManagementModule == null | 797 | && (m_scene.UserManagementModule == null |
766 | || m_scene.UserManagementModule.IsLocalGridUser(sp.UUID)); | 798 | || m_scene.UserManagementModule.IsLocalGridUser(sp.UUID)); |
767 | 799 | ||
768 | // Scripts MUST be snapshotted before the object is | ||
769 | // removed from the scene because doing otherwise will | ||
770 | // clobber the run flag | ||
771 | string scriptedState = GetObjectScriptStates(so); | ||
772 | |||
773 | // Remove the object from the scene so no more updates | 800 | // Remove the object from the scene so no more updates |
774 | // are sent. Doing this before the below changes will ensure | 801 | // are sent. Doing this before the below changes will ensure |
775 | // updates can't cause "HUD artefacts" | 802 | // updates can't cause "HUD artefacts" |
@@ -793,91 +820,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
793 | so.RemoveScriptInstances(true); | 820 | so.RemoveScriptInstances(true); |
794 | } | 821 | } |
795 | 822 | ||
796 | private void DetachSingleAttachmentToInvInternal(IScenePresence sp, SceneObjectGroup so) | ||
797 | { | ||
798 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name); | ||
799 | |||
800 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); | ||
801 | sp.RemoveAttachment(so); | ||
802 | |||
803 | UpdateDetachedObject(sp, so); | ||
804 | } | ||
805 | |||
806 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 823 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
807 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt) | 824 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt) |
808 | { | 825 | { |
809 | if (m_invAccessModule == null) | 826 | if (m_invAccessModule == null) |
810 | return null; | 827 | return null; |
811 | 828 | ||
812 | lock (sp.AttachmentsSyncLock) | 829 | SceneObjectGroup objatt; |
830 | |||
831 | if (itemID != UUID.Zero) | ||
832 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | ||
833 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
834 | false, false, sp.UUID, true); | ||
835 | else | ||
836 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | ||
837 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
838 | false, false, sp.UUID, true); | ||
839 | |||
840 | if (objatt == null) | ||
813 | { | 841 | { |
814 | SceneObjectGroup objatt; | 842 | m_log.WarnFormat( |
843 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
844 | itemID, sp.Name, attachmentPt); | ||
815 | 845 | ||
816 | if (itemID != UUID.Zero) | 846 | return null; |
817 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | 847 | } |
818 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
819 | false, false, sp.UUID, true); | ||
820 | else | ||
821 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | ||
822 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
823 | false, false, sp.UUID, true); | ||
824 | 848 | ||
825 | if (objatt != null) | 849 | // Remove any previous attachments |
826 | { | 850 | List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); |
851 | |||
852 | // At the moment we can only deal with a single attachment | ||
853 | if (attachments.Count != 0) | ||
854 | DetachSingleAttachmentToInv(sp, attachments[0]); | ||
855 | |||
856 | lock (sp.AttachmentsSyncLock) | ||
857 | { | ||
827 | // m_log.DebugFormat( | 858 | // m_log.DebugFormat( |
828 | // "[ATTACHMENTS MODULE]: Rezzed single object {0} for attachment to {1} on point {2} in {3}", | 859 | // "[ATTACHMENTS MODULE]: Rezzed single object {0} for attachment to {1} on point {2} in {3}", |
829 | // objatt.Name, sp.Name, attachmentPt, m_scene.Name); | 860 | // objatt.Name, sp.Name, attachmentPt, m_scene.Name); |
830 | 861 | ||
831 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. | 862 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. |
832 | objatt.HasGroupChanged = false; | 863 | objatt.HasGroupChanged = false; |
833 | bool tainted = false; | 864 | bool tainted = false; |
834 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) | 865 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) |
835 | tainted = true; | 866 | tainted = true; |
836 | 867 | ||
837 | // FIXME: Detect whether it's really likely for AttachObject to throw an exception in the normal | 868 | // FIXME: Detect whether it's really likely for AttachObject to throw an exception in the normal |
838 | // course of events. If not, then it's probably not worth trying to recover the situation | 869 | // course of events. If not, then it's probably not worth trying to recover the situation |
839 | // since this is more likely to trigger further exceptions and confuse later debugging. If | 870 | // since this is more likely to trigger further exceptions and confuse later debugging. If |
840 | // exceptions can be thrown in expected error conditions (not NREs) then make this consistent | 871 | // exceptions can be thrown in expected error conditions (not NREs) then make this consistent |
841 | // since other normal error conditions will simply return false instead. | 872 | // since other normal error conditions will simply return false instead. |
842 | // This will throw if the attachment fails | 873 | // This will throw if the attachment fails |
843 | try | 874 | try |
844 | { | 875 | { |
845 | AttachObjectInternal(sp, objatt, attachmentPt, false, false); | 876 | AttachObjectInternal(sp, objatt, attachmentPt, false, false); |
846 | } | 877 | } |
847 | catch (Exception e) | 878 | catch (Exception e) |
848 | { | 879 | { |
849 | m_log.ErrorFormat( | 880 | m_log.ErrorFormat( |
850 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", | 881 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", |
851 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); | 882 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); |
852 | |||
853 | // Make sure the object doesn't stick around and bail | ||
854 | sp.RemoveAttachment(objatt); | ||
855 | m_scene.DeleteSceneObject(objatt, false); | ||
856 | return null; | ||
857 | } | ||
858 | 883 | ||
859 | if (tainted) | 884 | // Make sure the object doesn't stick around and bail |
860 | objatt.HasGroupChanged = true; | 885 | sp.RemoveAttachment(objatt); |
886 | m_scene.DeleteSceneObject(objatt, false); | ||
887 | return null; | ||
888 | } | ||
861 | 889 | ||
862 | // Fire after attach, so we don't get messy perms dialogs | 890 | if (tainted) |
863 | // 4 == AttachedRez | 891 | objatt.HasGroupChanged = true; |
864 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
865 | objatt.ResumeScripts(); | ||
866 | 892 | ||
867 | // Do this last so that event listeners have access to all the effects of the attachment | 893 | // Fire after attach, so we don't get messy perms dialogs |
868 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | 894 | // 4 == AttachedRez |
895 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
896 | objatt.ResumeScripts(); | ||
869 | 897 | ||
870 | return objatt; | 898 | // Do this last so that event listeners have access to all the effects of the attachment |
871 | } | 899 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); |
872 | else | ||
873 | { | ||
874 | m_log.WarnFormat( | ||
875 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
876 | itemID, sp.Name, attachmentPt); | ||
877 | } | ||
878 | } | ||
879 | 900 | ||
880 | return null; | 901 | return objatt; |
902 | } | ||
881 | } | 903 | } |
882 | 904 | ||
883 | /// <summary> | 905 | /// <summary> |
@@ -1027,17 +1049,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1027 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | 1049 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
1028 | if (sp != null) | 1050 | if (sp != null) |
1029 | { | 1051 | { |
1030 | lock (sp.AttachmentsSyncLock) | 1052 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
1053 | |||
1054 | foreach (SceneObjectGroup group in attachments) | ||
1031 | { | 1055 | { |
1032 | List<SceneObjectGroup> attachments = sp.GetAttachments(); | 1056 | if (group.FromItemID == itemID && group.FromItemID != UUID.Zero) |
1033 | |||
1034 | foreach (SceneObjectGroup group in attachments) | ||
1035 | { | 1057 | { |
1036 | if (group.FromItemID == itemID && group.FromItemID != UUID.Zero) | 1058 | DetachSingleAttachmentToInv(sp, group); |
1037 | { | 1059 | return; |
1038 | DetachSingleAttachmentToInv(sp, group); | ||
1039 | return; | ||
1040 | } | ||
1041 | } | 1060 | } |
1042 | } | 1061 | } |
1043 | } | 1062 | } |
@@ -1055,4 +1074,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1055 | 1074 | ||
1056 | #endregion | 1075 | #endregion |
1057 | } | 1076 | } |
1058 | } | 1077 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 07c3666..01b1668 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1206,6 +1206,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1206 | // region doesn't take it | 1206 | // region doesn't take it |
1207 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | 1207 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1208 | 1208 | ||
1209 | m_log.WarnFormat( | ||
1210 | "[ENTITY TRANSFER MODULE]: Region {0} would not accept update for agent {1} on cross attempt. Returning to original region.", | ||
1211 | neighbourRegion.RegionName, agent.Name); | ||
1212 | |||
1209 | ReInstantiateScripts(agent); | 1213 | ReInstantiateScripts(agent); |
1210 | agent.AddToPhysicalScene(isFlying); | 1214 | agent.AddToPhysicalScene(isFlying); |
1211 | 1215 | ||
@@ -1225,6 +1229,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1225 | neighbourRegion.RegionHandle); | 1229 | neighbourRegion.RegionHandle); |
1226 | return agent; | 1230 | return agent; |
1227 | } | 1231 | } |
1232 | |||
1228 | // No turning back | 1233 | // No turning back |
1229 | agent.IsChildAgent = true; | 1234 | agent.IsChildAgent = true; |
1230 | 1235 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index 4c9ee06..64feec1 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | |||
@@ -414,8 +414,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
414 | } | 414 | } |
415 | private void RegisterStatsManagerRegionStatistics() | 415 | private void RegisterStatsManagerRegionStatistics() |
416 | { | 416 | { |
417 | string regionName = m_scene.RegionInfo.RegionName; | ||
418 | |||
419 | MakeStat("RootAgents", "avatars", (s) => { s.Value = m_scene.SceneGraph.GetRootAgentCount(); }); | 417 | MakeStat("RootAgents", "avatars", (s) => { s.Value = m_scene.SceneGraph.GetRootAgentCount(); }); |
420 | MakeStat("ChildAgents", "avatars", (s) => { s.Value = m_scene.SceneGraph.GetChildAgentCount(); }); | 418 | MakeStat("ChildAgents", "avatars", (s) => { s.Value = m_scene.SceneGraph.GetChildAgentCount(); }); |
421 | MakeStat("TotalPrims", "objects", (s) => { s.Value = m_scene.SceneGraph.GetTotalObjectsCount(); }); | 419 | MakeStat("TotalPrims", "objects", (s) => { s.Value = m_scene.SceneGraph.GetTotalObjectsCount(); }); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 3c18074..a413546 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -219,12 +219,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
219 | { | 219 | { |
220 | // m_log.DebugFormat( | 220 | // m_log.DebugFormat( |
221 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | 221 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
222 | // s.RegionInfo.RegionName, destination.RegionHandle); | 222 | // destination.RegionName, destination.RegionID); |
223 | 223 | ||
224 | return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData); | 224 | return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData); |
225 | } | 225 | } |
226 | 226 | ||
227 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); | 227 | // m_log.DebugFormat( |
228 | // "[LOCAL COMMS]: Did not find region {0} {1} for ChildAgentUpdate", | ||
229 | // destination.RegionName, destination.RegionID); | ||
230 | |||
228 | return false; | 231 | return false; |
229 | } | 232 | } |
230 | 233 | ||
@@ -239,7 +242,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
239 | // note that we really don't need the GridRegion for this call | 242 | // note that we really don't need the GridRegion for this call |
240 | foreach (Scene s in m_scenes.Values) | 243 | foreach (Scene s in m_scenes.Values) |
241 | { | 244 | { |
242 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | 245 | // m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); |
243 | s.IncomingChildAgentDataUpdate(cAgentData); | 246 | s.IncomingChildAgentDataUpdate(cAgentData); |
244 | } | 247 | } |
245 | 248 | ||