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 59a2f41..730ec31 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 (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (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(); |
@@ -586,6 +610,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
586 | if (group.GetFromItemID() == itemID) | 610 | if (group.GetFromItemID() == itemID) |
587 | { | 611 | { |
588 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); | 612 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); |
613 | bool hasScripts = false; | ||
614 | foreach (SceneObjectPart part in group.Children.Values) | ||
615 | { | ||
616 | if (part.Inventory.ContainsScripts()) | ||
617 | { | ||
618 | hasScripts = true; | ||
619 | break; | ||
620 | } | ||
621 | } | ||
622 | |||
623 | if (hasScripts) // Allow the object to execute the attach(NULL_KEY) event | ||
624 | System.Threading.Thread.Sleep(100); | ||
589 | group.DetachToInventoryPrep(); | 625 | group.DetachToInventoryPrep(); |
590 | m_log.Debug("[DETACH]: Saving attachpoint: " + | 626 | m_log.Debug("[DETACH]: Saving attachpoint: " + |
591 | ((uint)group.GetAttachmentPoint()).ToString()); | 627 | ((uint)group.GetAttachmentPoint()).ToString()); |