mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
mantis8569: do aggregate script events when a script is deleted; block nonphysical drag if a touch event is triggered, add a time guard on that
This commit is contained in:
@@ -2086,13 +2086,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void ObjectGrabHandler(uint localId, Vector3 offsetPos, IClientAPI remoteClient)
|
||||
{
|
||||
|
||||
if (m_rootPart.LocalId == localId)
|
||||
{
|
||||
if((RootPart.ScriptEvents & scriptEvents.anytouch) != 0)
|
||||
lastTouchTime = Util.GetTimeStampMS();
|
||||
OnGrabGroup(offsetPos, remoteClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = GetPart(localId);
|
||||
|
||||
if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
|
||||
(part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
|
||||
lastTouchTime = Util.GetTimeStampMS();
|
||||
OnGrabPart(part, offsetPos, remoteClient);
|
||||
}
|
||||
}
|
||||
@@ -3615,6 +3622,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
|
||||
}
|
||||
|
||||
double lastTouchTime = 0;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If object is physical, apply force to move it around
|
||||
/// If object is not physical, just put it at the resulting location
|
||||
@@ -3623,7 +3634,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <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="remoteClient"></param>
|
||||
public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClient)
|
||||
public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClienth)
|
||||
{
|
||||
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
||||
{
|
||||
@@ -3650,24 +3661,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
NonPhysicalGrabMovement(pos);
|
||||
if(IsAttachment)
|
||||
return;
|
||||
|
||||
// block movement if there was a touch at start
|
||||
double now = Util.GetTimeStampMS();
|
||||
if (now - lastTouchTime < 250)
|
||||
{
|
||||
lastTouchTime = now;
|
||||
return;
|
||||
}
|
||||
|
||||
// a touch or pass may had become active ??
|
||||
if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
|
||||
(part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
|
||||
{
|
||||
lastTouchTime = now;
|
||||
return;
|
||||
}
|
||||
|
||||
lastTouchTime = 0;
|
||||
UpdateGroupPosition(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply possition for grabbing non-physical linksets (Ctrl+Drag)
|
||||
/// This MUST be blocked for linksets that contain touch scripts because the viewer triggers grab on the touch
|
||||
/// event (Viewer Bug?) This would allow anyone to drag a linkset with a touch script. SL behaviour is also to
|
||||
/// block grab on prims with touch events.
|
||||
/// </summary>
|
||||
/// <param name="pos">New Position</param>
|
||||
public void NonPhysicalGrabMovement(Vector3 pos)
|
||||
{
|
||||
if(!IsAttachment && ScriptCount() == 0)
|
||||
UpdateGroupPosition(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If object is physical, prepare for spinning torques (set flag to save old orientation)
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user