Merge branch 'avination' into careminster

Conflicts:
	OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
avinationmerge
Melanie 2012-06-06 14:16:19 +01:00
commit c0b21d92c2
9 changed files with 87 additions and 35 deletions

View File

@ -258,10 +258,25 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
m_log.Info("[RADMIN]: Request to restart Region."); m_log.Info("[RADMIN]: Request to restart Region.");
Scene rebootedScene = null;
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); CheckRegionParams(requestData, responseData);
Scene rebootedScene = null;
GetSceneFromRegionParams(requestData, responseData, out rebootedScene); GetSceneFromRegionParams(requestData, responseData, out rebootedScene);
}
IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>(); IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
@ -324,11 +339,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController
notice = false; notice = false;
} }
if (restartModule != null) List<Scene> restartList;
if (restartAll)
restartList = m_application.SceneManager.Scenes;
else
restartList = new List<Scene>() { rebootedScene };
foreach (Scene s in m_application.SceneManager.Scenes)
{ {
restartModule = s.RequestModuleInterface<IRestartModule>();
if (restartModule != null)
restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice); restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice);
responseData["success"] = true;
} }
responseData["success"] = true;
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -231,7 +231,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
sp.ClearAttachments(); 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) lock (sp.AttachmentsSyncLock)
{ {
@ -277,6 +277,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
attachPos = Vector3.Zero; 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.AttachmentPoint = attachmentPt;
group.AbsolutePosition = attachPos; group.AbsolutePosition = attachPos;
@ -774,9 +792,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, sp.UUID, true); false, false, sp.UUID, true);
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
// objatt.Name, remoteClient.Name, AttachmentPt); // objatt.Name, remoteClient.Name, AttachmentPt);
if (objatt != null) if (objatt != null)
{ {
@ -789,7 +807,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// This will throw if the attachment fails // This will throw if the attachment fails
try try
{ {
AttachObject(sp, objatt, attachmentPt, false); AttachObject(sp, objatt, attachmentPt, false, false);
} }
catch (Exception e) catch (Exception e)
{ {
@ -803,15 +821,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return null; return null;
} }
if (tainted)
objatt.HasGroupChanged = true;
if (doc != null) if (doc != null)
{ {
objatt.LoadScriptState(doc); objatt.LoadScriptState(doc);
objatt.ResetOwnerChangeFlag(); objatt.ResetOwnerChangeFlag();
} }
if (tainted)
objatt.HasGroupChanged = true;
// Fire after attach, so we don't get messy perms dialogs // Fire after attach, so we don't get messy perms dialogs
// 4 == AttachedRez // 4 == AttachedRez
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
@ -943,7 +961,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
AttachmentPt &= 0x7f; AttachmentPt &= 0x7f;
// Calls attach with a Zero position // Calls attach with a Zero position
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true))
{ {
// m_log.Debug( // m_log.Debug(
// "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId // "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId

View File

@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; 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 // Check status on scene presence
Assert.That(m_presence.HasAttachments(), Is.True); Assert.That(m_presence.HasAttachments(), Is.True);

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="AttachmentPt"></param> /// <param name="AttachmentPt"></param>
/// <param name="silent"></param> /// <param name="silent"></param>
/// <returns>true if the object was successfully attached, false otherwise</returns> /// <returns>true if the object was successfully attached, false otherwise</returns>
bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent); bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent, bool useAttachmentInfo);
/// <summary> /// <summary>
/// Rez an attachment from user inventory and change inventory status to match. /// Rez an attachment from user inventory and change inventory status to match.

View File

@ -2701,7 +2701,7 @@ namespace OpenSim.Region.Framework.Scenes
RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
if (AttachmentsModule != null) if (AttachmentsModule != null)
AttachmentsModule.AttachObject(sp, grp, 0, false); AttachmentsModule.AttachObject(sp, grp, 0, false, false);
} }
else else
{ {

View File

@ -359,7 +359,6 @@ namespace OpenSim.Region.Framework.Scenes
if (pa != null && pa.IsPhysical && vel != Vector3.Zero) if (pa != null && pa.IsPhysical && vel != Vector3.Zero)
{ {
sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
sceneObject.Velocity = vel;
} }
return true; return true;

View File

@ -2640,15 +2640,25 @@ namespace OpenSim.Region.Framework.Scenes
private void SendLandCollisionEvent(scriptEvents ev, ScriptCollidingNotification notify) private void SendLandCollisionEvent(scriptEvents ev, ScriptCollidingNotification notify)
{ {
if ((ParentGroup.RootPart.ScriptEvents & ev) != 0) bool sendToRoot = true;
{
ColliderArgs LandCollidingMessage = new ColliderArgs(); ColliderArgs LandCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>(); List<DetectedObject> colliding = new List<DetectedObject>();
colliding.Add(CreateDetObjectForGround()); colliding.Add(CreateDetObjectForGround());
LandCollidingMessage.Colliders = colliding; LandCollidingMessage.Colliders = colliding;
if (Inventory.ContainsScripts())
{
if (!PassCollisions)
sendToRoot = false;
}
if ((ScriptEvents & ev) != 0)
notify(LocalId, LandCollidingMessage); notify(LocalId, LandCollidingMessage);
if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot)
{
notify(ParentGroup.RootPart.LocalId, LandCollidingMessage);
} }
} }

View File

@ -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) if (!m_isSelected)
{ {
lock (this) lock (this)
@ -3960,7 +3960,7 @@ namespace OpenSim.Region.Physics.OdePlugin
break; break;
case changes.AddForce: case changes.AddForce:
changeAddImpulse((Vector3)arg); changeAddForce((Vector3)arg);
break; break;
case changes.AddAngForce: case changes.AddAngForce:

View File

@ -3056,8 +3056,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) if (pa != null && pa.IsPhysical && llvel != Vector3.Zero)
{ {
//Recoil. // recoil
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); llvel *= -groupmass;
llApplyImpulse(new LSL_Vector(llvel.X, llvel.Y,llvel.Z), 0);
} }
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
return; return;
@ -3249,7 +3250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
if (attachmentsModule != null) if (attachmentsModule != null)
return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false); return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false, true);
else else
return false; return false;
} }