Implement STATUS_BLOCK_GRAB_OBJECT in llSetStatus()/llGetStatus() and correct effect of STATUS_BLOCK_GRAB

As per http://wiki.secondlife.com/wiki/LlSetStatus
Setting STATUS_BLOCK_GRAB_OBJECT prevents or allows move of a physical linkset by grab on any prim.
Setting STATUS_BLOCK_GRAB prevents or allows move of a physical linkset by grab on a particular prim.
Previously, setting STATUS_BLOCK_GRAB would prevent drag via all prims of the linkset.
bullet-2.82
Justin Clark-Casey (justincc) 2014-08-29 23:40:21 +01:00
parent 1b75ec5647
commit 099212167b
5 changed files with 26 additions and 30 deletions

View File

@ -1446,8 +1446,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
{ {
group.GrabMovement(offset, pos, remoteClient); group.GrabMovement(objectID, offset, pos, remoteClient);
} }
// This is outside the above permissions condition // This is outside the above permissions condition
// so that if the object is locked the client moving the object // so that if the object is locked the client moving the object
// get's it's position on the simulator even if it was the same as before // get's it's position on the simulator even if it was the same as before

View File

@ -827,6 +827,12 @@ namespace OpenSim.Region.Framework.Scenes
/// </remarks> /// </remarks>
public UUID FromFolderID { get; set; } public UUID FromFolderID { get; set; }
/// <summary>
/// If true then grabs are blocked no matter what the individual part BlockGrab setting.
/// </summary>
/// <value><c>true</c> if block grab override; otherwise, <c>false</c>.</value>
public bool BlockGrabOverride { get; set; }
/// <summary> /// <summary>
/// IDs of all avatars sat on this scene object. /// IDs of all avatars sat on this scene object.
/// </summary> /// </summary>
@ -2610,20 +2616,26 @@ namespace OpenSim.Region.Framework.Scenes
/// If object is physical, apply force to move it around /// If object is physical, apply force to move it around
/// If object is not physical, just put it at the resulting location /// If object is not physical, just put it at the resulting location
/// </summary> /// </summary>
/// <param name="partID">Part ID to check for grab</param>
/// <param name="offset">Always seems to be 0,0,0, so ignoring</param> /// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
/// <param name="pos">New position. We do the math here to turn it into a force</param> /// <param name="pos">New position. We do the math here to turn it into a force</param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void GrabMovement(Vector3 offset, Vector3 pos, IClientAPI remoteClient) public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClient)
{ {
if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{ {
SceneObjectPart part = GetPart(partID);
if (part == null)
return;
PhysicsActor pa = m_rootPart.PhysActor; PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null) if (pa != null)
{ {
if (pa.IsPhysical) if (pa.IsPhysical)
{ {
if (!m_rootPart.BlockGrab) if (!BlockGrabOverride && !part.BlockGrab)
{ {
Vector3 llmoveforce = pos - AbsolutePosition; Vector3 llmoveforce = pos - AbsolutePosition;
Vector3 grabforce = llmoveforce; Vector3 grabforce = llmoveforce;

View File

@ -186,7 +186,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool RETURN_AT_EDGE; public bool RETURN_AT_EDGE;
public bool BlockGrab; public bool BlockGrab { get; set; }
public bool StatusSandbox; public bool StatusSandbox;
@ -2079,22 +2079,6 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.RootPart.RETURN_AT_EDGE = p; ParentGroup.RootPart.RETURN_AT_EDGE = p;
} }
public bool GetBlockGrab()
{
if (ParentGroup.IsDeleted)
return false;
return ParentGroup.RootPart.BlockGrab;
}
public void SetBlockGrab(bool p)
{
if (ParentGroup.IsDeleted)
return;
ParentGroup.RootPart.BlockGrab = p;
}
public void SetStatusSandbox(bool p) public void SetStatusSandbox(bool p)
{ {
if (ParentGroup.IsDeleted) if (ParentGroup.IsDeleted)

View File

@ -1377,12 +1377,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB)
{ m_host.BlockGrab = value != 0;
if (value != 0)
m_host.SetBlockGrab(true); if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT) == ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT)
else m_host.ParentGroup.BlockGrabOverride = value != 0;
m_host.SetBlockGrab(false);
}
if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE)
{ {
@ -1443,10 +1441,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0; return 0;
case ScriptBaseClass.STATUS_BLOCK_GRAB: case ScriptBaseClass.STATUS_BLOCK_GRAB:
if (m_host.GetBlockGrab()) return m_host.BlockGrab ? 1 : 0;
return 1;
else case ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT:
return 0; return m_host.ParentGroup.BlockGrabOverride ? 1 : 0;
case ScriptBaseClass.STATUS_DIE_AT_EDGE: case ScriptBaseClass.STATUS_DIE_AT_EDGE:
if (m_host.GetDieAtEdge()) if (m_host.GetDieAtEdge())

View File

@ -48,6 +48,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int STATUS_DIE_AT_EDGE = 128; public const int STATUS_DIE_AT_EDGE = 128;
public const int STATUS_RETURN_AT_EDGE = 256; public const int STATUS_RETURN_AT_EDGE = 256;
public const int STATUS_CAST_SHADOWS = 512; public const int STATUS_CAST_SHADOWS = 512;
public const int STATUS_BLOCK_GRAB_OBJECT = 1024;
public const int AGENT = 1; public const int AGENT = 1;
public const int AGENT_BY_LEGACY_NAME = 1; public const int AGENT_BY_LEGACY_NAME = 1;