diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 9e72a98a76..437d150097 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -258,10 +258,25 @@ namespace OpenSim.ApplicationPlugins.RemoteController { m_log.Info("[RADMIN]: Request to restart Region."); - CheckRegionParams(requestData, responseData); - Scene rebootedScene = null; - GetSceneFromRegionParams(requestData, responseData, out rebootedScene); + bool restartAll = false; + + IConfig startupConfig = m_configSource.Configs["Startup"]; + if (startupConfig != null) + { + if (startupConfig.GetBoolean("InworldRestartShutsDown", false)) + { + rebootedScene = m_application.SceneManager.CurrentOrFirstScene; + restartAll = true; + } + } + + if (rebootedScene == null) + { + CheckRegionParams(requestData, responseData); + + GetSceneFromRegionParams(requestData, responseData, out rebootedScene); + } IRestartModule restartModule = rebootedScene.RequestModuleInterface(); @@ -324,11 +339,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController notice = false; } - if (restartModule != null) + List restartList; + + if (restartAll) + restartList = m_application.SceneManager.Scenes; + else + restartList = new List() { rebootedScene }; + + foreach (Scene s in m_application.SceneManager.Scenes) { - restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice); - responseData["success"] = true; + restartModule = s.RequestModuleInterface(); + if (restartModule != null) + restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice); } + responseData["success"] = true; } catch (Exception e) { diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index de40e5969a..f1deaa8068 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -231,7 +231,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sp.ClearAttachments(); } - public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent) + public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData) { lock (sp.AttachmentsSyncLock) { @@ -277,9 +277,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments attachPos = Vector3.Zero; } + if (useAttachData) + { + group.RootPart.RotationOffset = group.RootPart.AttachRotation; + attachPos = group.RootPart.AttachOffset; + if (attachmentPt == 0) + { + attachmentPt = group.RootPart.AttachPoint; + if (attachmentPt == 0) + { + attachmentPt = (uint)AttachmentPoint.LeftHand; + attachPos = Vector3.Zero; + } + } + else if (group.RootPart.AttachPoint != attachmentPt) + { + attachPos = Vector3.Zero; + } + } group.AttachmentPoint = attachmentPt; group.AbsolutePosition = attachPos; - + // We also don't want to do any of the inventory operations for an NPC. if (sp.PresenceType != PresenceType.Npc) { @@ -774,10 +792,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, false, false, sp.UUID, true); - // m_log.DebugFormat( - // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", - // objatt.Name, remoteClient.Name, AttachmentPt); - +// m_log.DebugFormat( +// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", +// objatt.Name, remoteClient.Name, AttachmentPt); + if (objatt != null) { // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. @@ -789,7 +807,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // This will throw if the attachment fails try { - AttachObject(sp, objatt, attachmentPt, false); + AttachObject(sp, objatt, attachmentPt, false, false); } catch (Exception e) { @@ -802,6 +820,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments m_scene.DeleteSceneObject(objatt, false); return null; } + + if (tainted) + objatt.HasGroupChanged = true; if (doc != null) { @@ -809,9 +830,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments objatt.ResetOwnerChangeFlag(); } - if (tainted) - objatt.HasGroupChanged = true; - // Fire after attach, so we don't get messy perms dialogs // 4 == AttachedRez objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); @@ -943,7 +961,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments AttachmentPt &= 0x7f; // Calls attach with a Zero position - if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) + if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true)) { // m_log.Debug( // "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 5e89eec25d..acf0089848 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; - m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); + m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false, false); // Check status on scene presence Assert.That(m_presence.HasAttachments(), Is.True); @@ -326,4 +326,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); // } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 69ce967f52..0516cb134a 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// true if the object was successfully attached, false otherwise - bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent); + bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent, bool useAttachmentInfo); /// /// Rez an attachment from user inventory and change inventory status to match. diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 315b340acf..9c80d3ec9a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2701,7 +2701,7 @@ namespace OpenSim.Region.Framework.Scenes RootPrim.RemFlag(PrimFlags.TemporaryOnRez); if (AttachmentsModule != null) - AttachmentsModule.AttachObject(sp, grp, 0, false); + AttachmentsModule.AttachObject(sp, grp, 0, false, false); } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 23a0550e54..a62c1acc0b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -359,7 +359,6 @@ namespace OpenSim.Region.Framework.Scenes if (pa != null && pa.IsPhysical && vel != Vector3.Zero) { sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); - sceneObject.Velocity = vel; } return true; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index bb8d0650d3..61ef82727e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2640,15 +2640,25 @@ namespace OpenSim.Region.Framework.Scenes private void SendLandCollisionEvent(scriptEvents ev, ScriptCollidingNotification notify) { - if ((ParentGroup.RootPart.ScriptEvents & ev) != 0) - { - ColliderArgs LandCollidingMessage = new ColliderArgs(); - List colliding = new List(); - - colliding.Add(CreateDetObjectForGround()); - LandCollidingMessage.Colliders = colliding; + bool sendToRoot = true; + ColliderArgs LandCollidingMessage = new ColliderArgs(); + List colliding = new List(); + + colliding.Add(CreateDetObjectForGround()); + LandCollidingMessage.Colliders = colliding; + + if (Inventory.ContainsScripts()) + { + if (!PassCollisions) + sendToRoot = false; + } + if ((ScriptEvents & ev) != 0) notify(LocalId, LandCollidingMessage); + + if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot) + { + notify(ParentGroup.RootPart.LocalId, LandCollidingMessage); } } diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 9a40ab583d..9b3b51b8ba 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -3252,9 +3252,9 @@ namespace OpenSim.Region.Physics.OdePlugin } - private void changeAddImpulse(Vector3 impulse) + private void changeAddForce(Vector3 theforce) { - m_forceacc += impulse *m_invTimeStep; + m_forceacc += theforce; if (!m_isSelected) { lock (this) @@ -3960,7 +3960,7 @@ namespace OpenSim.Region.Physics.OdePlugin break; case changes.AddForce: - changeAddImpulse((Vector3)arg); + changeAddForce((Vector3)arg); break; case changes.AddAngForce: diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9595d4872d..5905958a87 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3056,8 +3056,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) { - //Recoil. - llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); + // recoil + llvel *= -groupmass; + llApplyImpulse(new LSL_Vector(llvel.X, llvel.Y,llvel.Z), 0); } // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) return; @@ -3249,7 +3250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; if (attachmentsModule != null) - return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false); + return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false, true); else return false; }