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 22613e9..cac768e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -223,6 +223,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
223 | protected internal bool AddRestoredSceneObject( | 223 | protected internal bool AddRestoredSceneObject( |
224 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) | 224 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) |
225 | { | 225 | { |
226 | // KF: Check for out-of-region, move inside and make static. | ||
227 | Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, | ||
228 | sceneObject.RootPart.GroupPosition.Y, | ||
229 | sceneObject.RootPart.GroupPosition.Z); | ||
230 | 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 || | ||
231 | npos.X > Constants.RegionSize || | ||
232 | npos.Y > Constants.RegionSize)) | ||
233 | { | ||
234 | if (npos.X < 0.0) npos.X = 1.0f; | ||
235 | if (npos.Y < 0.0) npos.Y = 1.0f; | ||
236 | if (npos.Z < 0.0) npos.Z = 0.0f; | ||
237 | if (npos.X > Constants.RegionSize) npos.X = Constants.RegionSize - 1.0f; | ||
238 | if (npos.Y > Constants.RegionSize) npos.Y = Constants.RegionSize - 1.0f; | ||
239 | |||
240 | foreach (SceneObjectPart part in sceneObject.Children.Values) | ||
241 | { | ||
242 | part.GroupPosition = npos; | ||
243 | } | ||
244 | sceneObject.RootPart.Velocity = Vector3.Zero; | ||
245 | sceneObject.RootPart.AngularVelocity = Vector3.Zero; | ||
246 | sceneObject.RootPart.Acceleration = Vector3.Zero; | ||
247 | sceneObject.RootPart.Velocity = Vector3.Zero; | ||
248 | } | ||
249 | |||
226 | if (!alreadyPersisted) | 250 | if (!alreadyPersisted) |
227 | { | 251 | { |
228 | sceneObject.ForceInventoryPersistence(); | 252 | sceneObject.ForceInventoryPersistence(); |
@@ -593,6 +617,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
593 | if (group.GetFromItemID() == itemID) | 617 | if (group.GetFromItemID() == itemID) |
594 | { | 618 | { |
595 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); | 619 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); |
620 | bool hasScripts = false; | ||
621 | foreach (SceneObjectPart part in group.Children.Values) | ||
622 | { | ||
623 | if (part.Inventory.ContainsScripts()) | ||
624 | { | ||
625 | hasScripts = true; | ||
626 | break; | ||
627 | } | ||
628 | } | ||
629 | |||
630 | if (hasScripts) // Allow the object to execute the attach(NULL_KEY) event | ||
631 | System.Threading.Thread.Sleep(100); | ||
596 | group.DetachToInventoryPrep(); | 632 | group.DetachToInventoryPrep(); |
597 | m_log.Debug("[DETACH]: Saving attachpoint: " + | 633 | m_log.Debug("[DETACH]: Saving attachpoint: " + |
598 | ((uint)group.GetAttachmentPoint()).ToString()); | 634 | ((uint)group.GetAttachmentPoint()).ToString()); |