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.");
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);
Scene rebootedScene = null;
GetSceneFromRegionParams(requestData, responseData, out rebootedScene);
}
IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
@ -324,11 +339,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController
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);
responseData["success"] = true;
}
responseData["success"] = true;
}
catch (Exception e)
{

View File

@ -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,6 +277,24 @@ 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;
@ -774,9 +792,9 @@ 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)
{
@ -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)
{
@ -803,15 +821,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return null;
}
if (tainted)
objatt.HasGroupChanged = true;
if (doc != null)
{
objatt.LoadScriptState(doc);
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

View File

@ -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);

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="AttachmentPt"></param>
/// <param name="silent"></param>
/// <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>
/// 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);
if (AttachmentsModule != null)
AttachmentsModule.AttachObject(sp, grp, 0, false);
AttachmentsModule.AttachObject(sp, grp, 0, false, false);
}
else
{

View File

@ -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;

View File

@ -2640,15 +2640,25 @@ namespace OpenSim.Region.Framework.Scenes
private void SendLandCollisionEvent(scriptEvents ev, ScriptCollidingNotification notify)
{
if ((ParentGroup.RootPart.ScriptEvents & ev) != 0)
{
bool sendToRoot = true;
ColliderArgs LandCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
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);
}
}

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)
{
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:

View File

@ -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;
}