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 bdab696..5a1922a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -226,6 +226,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | protected internal bool AddRestoredSceneObject( | 226 | protected internal bool AddRestoredSceneObject( |
227 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 227 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
228 | { | 228 | { |
229 | // KF: Check for out-of-region, move inside and make static. | ||
230 | Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, | ||
231 | sceneObject.RootPart.GroupPosition.Y, | ||
232 | sceneObject.RootPart.GroupPosition.Z); | ||
233 | if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || npos.Z < 0.0 || | ||
234 | npos.X > Constants.RegionSize || | ||
235 | npos.Y > Constants.RegionSize)) | ||
236 | { | ||
237 | if (npos.X < 0.0) npos.X = 1.0f; | ||
238 | if (npos.Y < 0.0) npos.Y = 1.0f; | ||
239 | if (npos.Z < 0.0) npos.Z = 0.0f; | ||
240 | if (npos.X > Constants.RegionSize) npos.X = Constants.RegionSize - 1.0f; | ||
241 | if (npos.Y > Constants.RegionSize) npos.Y = Constants.RegionSize - 1.0f; | ||
242 | |||
243 | foreach (SceneObjectPart part in sceneObject.Children.Values) | ||
244 | { | ||
245 | part.GroupPosition = npos; | ||
246 | } | ||
247 | sceneObject.RootPart.Velocity = Vector3.Zero; | ||
248 | sceneObject.RootPart.AngularVelocity = Vector3.Zero; | ||
249 | sceneObject.RootPart.Acceleration = Vector3.Zero; | ||
250 | sceneObject.RootPart.Velocity = Vector3.Zero; | ||
251 | } | ||
252 | |||
229 | if (!alreadyPersisted) | 253 | if (!alreadyPersisted) |
230 | { | 254 | { |
231 | sceneObject.ForceInventoryPersistence(); | 255 | sceneObject.ForceInventoryPersistence(); |
@@ -611,6 +635,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
611 | if (group.GetFromItemID() == itemID) | 635 | if (group.GetFromItemID() == itemID) |
612 | { | 636 | { |
613 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); | 637 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); |
638 | bool hasScripts = false; | ||
639 | foreach (SceneObjectPart part in group.Children.Values) | ||
640 | { | ||
641 | if (part.Inventory.ContainsScripts()) | ||
642 | { | ||
643 | hasScripts = true; | ||
644 | break; | ||
645 | } | ||
646 | } | ||
647 | |||
648 | if (hasScripts) // Allow the object to execute the attach(NULL_KEY) event | ||
649 | System.Threading.Thread.Sleep(100); | ||
614 | group.DetachToInventoryPrep(); | 650 | group.DetachToInventoryPrep(); |
615 | m_log.Debug("[DETACH]: Saving attachpoint: " + | 651 | m_log.Debug("[DETACH]: Saving attachpoint: " + |
616 | ((uint)group.GetAttachmentPoint()).ToString()); | 652 | ((uint)group.GetAttachmentPoint()).ToString()); |