diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index cc70210..cf24c73 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1972,7 +1972,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1972 | LLVector3 vel = m_velocity; | 1972 | LLVector3 vel = m_velocity; |
1973 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 1973 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); |
1974 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); | 1974 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); |
1975 | if (neighbourRegion != null) | 1975 | if (neighbourRegion != null && ValidateAttachments()) |
1976 | { | 1976 | { |
1977 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar | 1977 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar |
1978 | // This means we need to remove the current caps handler here and possibly compensate later, | 1978 | // This means we need to remove the current caps handler here and possibly compensate later, |
@@ -2343,15 +2343,41 @@ namespace OpenSim.Region.Environment.Scenes | |||
2343 | } | 2343 | } |
2344 | } | 2344 | } |
2345 | 2345 | ||
2346 | public void CrossAttachmentsIntoNewRegion(ulong regionHandle) | 2346 | public bool ValidateAttachments() |
2347 | { | ||
2348 | lock (m_attachments) | ||
2349 | { | ||
2350 | // Validate | ||
2351 | foreach (SceneObjectGroup gobj in m_attachments) | ||
2352 | { | ||
2353 | if(gobj == null) | ||
2354 | return false; | ||
2355 | |||
2356 | if(gobj.RootPart == null) | ||
2357 | { | ||
2358 | return false; | ||
2359 | } | ||
2360 | } | ||
2361 | } | ||
2362 | return true; | ||
2363 | } | ||
2364 | |||
2365 | public bool CrossAttachmentsIntoNewRegion(ulong regionHandle) | ||
2347 | { | 2366 | { |
2348 | m_attachmentsTransported = true; | 2367 | m_attachmentsTransported = true; |
2349 | lock (m_attachments) | 2368 | lock (m_attachments) |
2350 | { | 2369 | { |
2370 | // Validate | ||
2371 | foreach (SceneObjectGroup gobj in m_attachments) | ||
2372 | { | ||
2373 | if(gobj == null || gobj.RootPart == null) | ||
2374 | return false; | ||
2375 | } | ||
2376 | |||
2351 | foreach (SceneObjectGroup gobj in m_attachments) | 2377 | foreach (SceneObjectGroup gobj in m_attachments) |
2352 | { | 2378 | { |
2353 | // If the prim group is null then something must have happened to it! | 2379 | // If the prim group is null then something must have happened to it! |
2354 | if (gobj != null) | 2380 | if (gobj != null && gobj.RootPart != null) |
2355 | { | 2381 | { |
2356 | // Set the parent localID to 0 so it transfers over properly. | 2382 | // Set the parent localID to 0 so it transfers over properly. |
2357 | gobj.RootPart.SetParentLocalId(0); | 2383 | gobj.RootPart.SetParentLocalId(0); |
@@ -2362,6 +2388,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2362 | } | 2388 | } |
2363 | } | 2389 | } |
2364 | m_attachments.Clear(); | 2390 | m_attachments.Clear(); |
2391 | |||
2392 | return true; | ||
2365 | } | 2393 | } |
2366 | } | 2394 | } |
2367 | 2395 | ||
@@ -2903,10 +2931,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2903 | m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}", | 2931 | m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}", |
2904 | itemID.ToString()); | 2932 | itemID.ToString()); |
2905 | 2933 | ||
2906 | // Attach from world | 2934 | // Attach from world, if not already attached |
2907 | if (att.ParentGroup != null) | 2935 | if (att.ParentGroup != null && !att.IsAttachment) |
2908 | m_scene.RezSingleAttachment(att.ParentGroup, | 2936 | m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, (uint)0, att.ParentGroup.GroupRotation, LLVector3.Zero); |
2909 | ControllingClient, itemID, (uint)attachpoint, 0, 0); | ||
2910 | } | 2937 | } |
2911 | } | 2938 | } |
2912 | } | 2939 | } |