Thank you, salahazar, for a patch that corrects the behavior of

llDetectedLink(). Also a small refactor to remove an interface member
from IScriptEngine.
0.6.0-stable
Melanie Thielker 2008-08-27 22:53:58 +00:00
parent 6e3367d68c
commit 5525a3ecb4
8 changed files with 64 additions and 48 deletions

View File

@ -83,8 +83,8 @@ namespace OpenSim.Region.Environment.Scenes
public event OnShutdownDelegate OnShutdown;
public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
public delegate void ObjectDeGrabDelegate(uint localID, IClientAPI remoteClient);
public delegate void ObjectGrabDelegate(uint localID, uint originalID, LLVector3 offsetPos, IClientAPI remoteClient);
public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient);
public delegate void ScriptResetDelegate(uint localID, LLUUID itemID);
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
@ -492,21 +492,21 @@ namespace OpenSim.Region.Environment.Scenes
handlerShutdown();
}
public void TriggerObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
public void TriggerObjectGrab(uint localID, uint originalID, LLVector3 offsetPos, IClientAPI remoteClient)
{
handlerObjectGrab = OnObjectGrab;
if (handlerObjectGrab != null)
{
handlerObjectGrab(localID, offsetPos, remoteClient);
handlerObjectGrab(localID, originalID, offsetPos, remoteClient);
}
}
public void TriggerObjectDeGrab(uint localID, IClientAPI remoteClient)
public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient)
{
handlerObjectDeGrab = OnObjectDeGrab;
if (handlerObjectDeGrab != null)
{
handlerObjectDeGrab(localID, remoteClient);
handlerObjectDeGrab(localID, originalID, remoteClient);
}
}

View File

@ -243,9 +243,9 @@ namespace OpenSim.Region.Environment.Scenes
// If the touched prim handles touches, deliver it
// If not, deliver to root prim
if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient);
EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient);
else
EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.OffsetPosition, remoteClient);
EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient);
return;
}
@ -274,9 +274,9 @@ namespace OpenSim.Region.Environment.Scenes
// If the touched prim handles touches, deliver it
// If not, deliver to root prim
if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
EventManager.TriggerObjectDeGrab(part.LocalId, remoteClient);
EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient);
else
EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, remoteClient);
EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient);
return;
}

View File

@ -117,7 +117,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "state_entry", EventQueueManager.llDetectNull, new object[] { });
}
public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
public void touch_start(uint localID, uint originalID, LLVector3 offsetPos, IClientAPI remoteClient)
{
// Add to queue for all scripts in ObjectID object
EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct();
@ -152,7 +152,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { new LSL_Types.LSLInteger(1) });
}
public void touch_end(uint localID, IClientAPI remoteClient)
public void touch_end(uint localID, uint originalID, IClientAPI remoteClient)
{
// Add to queue for all scripts in ObjectID object
EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct();
@ -220,12 +220,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "state_exit", EventQueueManager.llDetectNull, new object[] { });
}
public void touch(uint localID, LLUUID itemID)
public void touch(uint localID, uint originalID, LLUUID itemID)
{
myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch", EventQueueManager.llDetectNull);
}
public void touch_end(uint localID, LLUUID itemID)
public void touch_end(uint localID, uint originalID, LLUUID itemID)
{
myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) });
}

View File

@ -38,12 +38,12 @@ namespace OpenSim.Region.ScriptEngine.Common
{
public interface RemoteEvents
{
void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
void touch_start(uint localID, uint originalID, LLVector3 offsetPos, IClientAPI remoteClient);
void OnRezScript(uint localID, LLUUID itemID, string script, int startParam, bool postOnRez);
void OnRemoveScript(uint localID, LLUUID itemID);
void state_exit(uint localID);
void touch(uint localID, LLUUID itemID);
void touch_end(uint localID, LLUUID itemID);
void touch(uint localID, uint originalID, LLUUID itemID);
void touch_end(uint localID, uint originalID, LLUUID itemID);
void collision_start(uint localID, ColliderArgs col);
void collision(uint localID, ColliderArgs col);
void collision_end(uint localID, ColliderArgs col);

View File

@ -48,7 +48,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
Object AsyncCommands { get; }
ILog Log { get; }
string ScriptEngineName { get; }
int MaxScriptQueue { get; }
bool PostScriptEvent(LLUUID itemID, EventParams parms);
bool PostObjectEvent(uint localID, EventParams parms);

View File

@ -72,6 +72,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private int m_StartParam = 0;
private string m_CurrentEvent = String.Empty;
private bool m_InSelfDelete = false;
private int m_MaxScriptQueue;
private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
@ -153,7 +154,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public ScriptInstance(IScriptEngine engine, uint localID,
LLUUID objectID, LLUUID itemID, LLUUID assetID, string assembly,
AppDomain dom, string primName, string scriptName,
int startParam, bool postOnRez, StateSource stateSource)
int startParam, bool postOnRez, StateSource stateSource,
int maxScriptQueue)
{
m_Engine = engine;
@ -165,6 +167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_ScriptName = scriptName;
m_Assembly = assembly;
m_StartParam = startParam;
m_MaxScriptQueue = maxScriptQueue;
ApiManager am = new ApiManager();
@ -411,7 +414,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
lock (m_EventQueue)
{
if (m_EventQueue.Count >= m_Engine.MaxScriptQueue)
if (m_EventQueue.Count >= m_MaxScriptQueue)
return;
m_EventQueue.Enqueue(data);

View File

@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
}
public void touch_start(uint localID, LLVector3 offsetPos,
public void touch_start(uint localID, uint originalID, LLVector3 offsetPos,
IClientAPI remoteClient)
{
// Add to queue for all scripts in ObjectID object
@ -89,19 +89,27 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det[0].Key = remoteClient.AgentId;
det[0].Populate(myScriptEngine.World);
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(
localID);
if (part == null)
return;
det[0].LinkNum = part.LinkNum;
if (originalID == 0)
{
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
if (part == null)
return;
det[0].LinkNum = part.LinkNum;
}
else
{
SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum;
}
myScriptEngine.PostObjectEvent(localID, new EventParams(
"touch_start", new Object[] { new LSL_Types.LSLInteger(1) },
det));
}
public void touch(uint localID, LLVector3 offsetPos,
public void touch(uint localID, uint originalID, LLVector3 offsetPos,
IClientAPI remoteClient)
{
// Add to queue for all scripts in ObjectID object
@ -113,19 +121,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
offsetPos.Y,
offsetPos.Z);
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(
localID);
if (part == null)
return;
if (originalID == 0)
{
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
if (part == null)
return;
det[0].LinkNum = part.LinkNum;
det[0].LinkNum = part.LinkNum;
}
else
{
SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum;
}
myScriptEngine.PostObjectEvent(localID, new EventParams(
"touch", new Object[] { new LSL_Types.LSLInteger(1) },
det));
}
public void touch_end(uint localID, IClientAPI remoteClient)
public void touch_end(uint localID, uint originalID, IClientAPI remoteClient)
{
// Add to queue for all scripts in ObjectID object
DetectParams[] det = new DetectParams[1];
@ -133,12 +148,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det[0].Key = remoteClient.AgentId;
det[0].Populate(myScriptEngine.World);
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(
localID);
if (part == null)
return;
if (originalID == 0)
{
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
if (part == null)
return;
det[0].LinkNum = part.LinkNum;
det[0].LinkNum = part.LinkNum;
}
else
{
SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum;
}
myScriptEngine.PostObjectEvent(localID, new EventParams(
"touch_end", new Object[] { new LSL_Types.LSLInteger(1) },

View File

@ -319,14 +319,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
get { return false; }
}
//
// XEngine functions
//
public int MaxScriptQueue
{
get { return m_MaxScriptQueue; }
}
public void OnRezScript(uint localID, LLUUID itemID, string script, int startParam, bool postOnRez)
{
Object[] parms = new Object[]
@ -508,7 +500,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_AppDomains[appDomain],
part.ParentGroup.RootPart.Name,
item.Name, startParam, postOnRez,
StateSource.NewRez);
StateSource.NewRez, m_MaxScriptQueue);
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}",
part.ParentGroup.RootPart.Name, item.Name);