aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 369552f..928dc97 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();
@@ -567,6 +591,18 @@ namespace OpenSim.Region.Framework.Scenes
567 if (group.GetFromItemID() == itemID) 591 if (group.GetFromItemID() == itemID)
568 { 592 {
569 m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); 593 m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero);
594 bool hasScripts = false;
595 foreach (SceneObjectPart part in group.Children.Values)
596 {
597 if (part.Inventory.ContainsScripts())
598 {
599 hasScripts = true;
600 break;
601 }
602 }
603
604 if (hasScripts) // Allow the object to execute the attach(NULL_KEY) event
605 System.Threading.Thread.Sleep(100);
570 group.DetachToInventoryPrep(); 606 group.DetachToInventoryPrep();
571 m_log.Debug("[DETACH]: Saving attachpoint: " + 607 m_log.Debug("[DETACH]: Saving attachpoint: " +
572 ((uint)group.GetAttachmentPoint()).ToString()); 608 ((uint)group.GetAttachmentPoint()).ToString());