diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f74fd5d..998d598 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -222,6 +222,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
222 | protected internal bool AddRestoredSceneObject( | 222 | protected internal bool AddRestoredSceneObject( |
223 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) | 223 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) |
224 | { | 224 | { |
225 | // KF: Check for out-of-region, move inside and make static. | ||
226 | Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, | ||
227 | sceneObject.RootPart.GroupPosition.Y, | ||
228 | sceneObject.RootPart.GroupPosition.Z); | ||
229 | if (npos.X < 0.0 || npos.Y < 0.0 || npos.Z < 0.0 || | ||
230 | npos.X > Constants.RegionSize || | ||
231 | npos.Y > Constants.RegionSize) | ||
232 | { | ||
233 | if (npos.X < 0.0) npos.X = 1.0f; | ||
234 | if (npos.Y < 0.0) npos.Y = 1.0f; | ||
235 | if (npos.Z < 0.0) npos.Z = 0.0f; | ||
236 | if (npos.X > Constants.RegionSize) npos.X = Constants.RegionSize - 1.0f; | ||
237 | if (npos.Y > Constants.RegionSize) npos.Y = Constants.RegionSize - 1.0f; | ||
238 | |||
239 | foreach (SceneObjectPart part in sceneObject.Children.Values) | ||
240 | { | ||
241 | part.GroupPosition = npos; | ||
242 | } | ||
243 | sceneObject.RootPart.Velocity = Vector3.Zero; | ||
244 | sceneObject.RootPart.AngularVelocity = Vector3.Zero; | ||
245 | sceneObject.RootPart.Acceleration = Vector3.Zero; | ||
246 | sceneObject.RootPart.Velocity = Vector3.Zero; | ||
247 | } | ||
248 | |||
225 | if (!alreadyPersisted) | 249 | if (!alreadyPersisted) |
226 | { | 250 | { |
227 | sceneObject.ForceInventoryPersistence(); | 251 | sceneObject.ForceInventoryPersistence(); |
@@ -542,6 +566,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
542 | if (group.GetFromItemID() == itemID) | 566 | if (group.GetFromItemID() == itemID) |
543 | { | 567 | { |
544 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); | 568 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); |
569 | bool hasScripts = false; | ||
570 | foreach (SceneObjectPart part in group.Children.Values) | ||
571 | { | ||
572 | if (part.Inventory.ContainsScripts()) | ||
573 | { | ||
574 | hasScripts = true; | ||
575 | break; | ||
576 | } | ||
577 | } | ||
578 | |||
579 | if (hasScripts) // Allow the object to execute the attach(NULL_KEY) event | ||
580 | System.Threading.Thread.Sleep(100); | ||
545 | group.DetachToInventoryPrep(); | 581 | group.DetachToInventoryPrep(); |
546 | m_log.Debug("[DETACH]: Saving attachpoint: " + | 582 | m_log.Debug("[DETACH]: Saving attachpoint: " + |
547 | ((uint)group.GetAttachmentPoint()).ToString()); | 583 | ((uint)group.GetAttachmentPoint()).ToString()); |