aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-27 22:53:58 +0000
committerMelanie Thielker2008-08-27 22:53:58 +0000
commit5525a3ecb424ce6180198b5f4e440d6d5f065346 (patch)
tree01526d143e42a05d97b5375e9cfbdc9280c7b243
parentRefactor XScriptInstance to IScriptInstance and move into Shared/. Now (diff)
downloadopensim-SC-5525a3ecb424ce6180198b5f4e440d6d5f065346.zip
opensim-SC-5525a3ecb424ce6180198b5f4e440d6d5f065346.tar.gz
opensim-SC-5525a3ecb424ce6180198b5f4e440d6d5f065346.tar.bz2
opensim-SC-5525a3ecb424ce6180198b5f4e440d6d5f065346.tar.xz
Thank you, salahazar, for a patch that corrects the behavior of
llDetectedLink(). Also a small refactor to remove an interface member from IScriptEngine.
-rw-r--r--OpenSim/Region/Environment/Scenes/EventManager.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs60
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs10
8 files changed, 64 insertions, 48 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs
index 1dd2273..d48ef0c 100644
--- a/OpenSim/Region/Environment/Scenes/EventManager.cs
+++ b/OpenSim/Region/Environment/Scenes/EventManager.cs
@@ -83,8 +83,8 @@ namespace OpenSim.Region.Environment.Scenes
83 83
84 public event OnShutdownDelegate OnShutdown; 84 public event OnShutdownDelegate OnShutdown;
85 85
86 public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); 86 public delegate void ObjectGrabDelegate(uint localID, uint originalID, LLVector3 offsetPos, IClientAPI remoteClient);
87 public delegate void ObjectDeGrabDelegate(uint localID, IClientAPI remoteClient); 87 public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient);
88 public delegate void ScriptResetDelegate(uint localID, LLUUID itemID); 88 public delegate void ScriptResetDelegate(uint localID, LLUUID itemID);
89 89
90 public delegate void OnPermissionErrorDelegate(LLUUID user, string reason); 90 public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
@@ -492,21 +492,21 @@ namespace OpenSim.Region.Environment.Scenes
492 handlerShutdown(); 492 handlerShutdown();
493 } 493 }
494 494
495 public void TriggerObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 495 public void TriggerObjectGrab(uint localID, uint originalID, LLVector3 offsetPos, IClientAPI remoteClient)
496 { 496 {
497 handlerObjectGrab = OnObjectGrab; 497 handlerObjectGrab = OnObjectGrab;
498 if (handlerObjectGrab != null) 498 if (handlerObjectGrab != null)
499 { 499 {
500 handlerObjectGrab(localID, offsetPos, remoteClient); 500 handlerObjectGrab(localID, originalID, offsetPos, remoteClient);
501 } 501 }
502 } 502 }
503 503
504 public void TriggerObjectDeGrab(uint localID, IClientAPI remoteClient) 504 public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient)
505 { 505 {
506 handlerObjectDeGrab = OnObjectDeGrab; 506 handlerObjectDeGrab = OnObjectDeGrab;
507 if (handlerObjectDeGrab != null) 507 if (handlerObjectDeGrab != null)
508 { 508 {
509 handlerObjectDeGrab(localID, remoteClient); 509 handlerObjectDeGrab(localID, originalID, remoteClient);
510 } 510 }
511 } 511 }
512 512
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index d534ffc..14d6826 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -243,9 +243,9 @@ namespace OpenSim.Region.Environment.Scenes
243 // If the touched prim handles touches, deliver it 243 // If the touched prim handles touches, deliver it
244 // If not, deliver to root prim 244 // If not, deliver to root prim
245 if ((part.ScriptEvents & scriptEvents.touch_start) != 0) 245 if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
246 EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient); 246 EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient);
247 else 247 else
248 EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.OffsetPosition, remoteClient); 248 EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient);
249 249
250 return; 250 return;
251 } 251 }
@@ -274,9 +274,9 @@ namespace OpenSim.Region.Environment.Scenes
274 // If the touched prim handles touches, deliver it 274 // If the touched prim handles touches, deliver it
275 // If not, deliver to root prim 275 // If not, deliver to root prim
276 if ((part.ScriptEvents & scriptEvents.touch_end) != 0) 276 if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
277 EventManager.TriggerObjectDeGrab(part.LocalId, remoteClient); 277 EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient);
278 else 278 else
279 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, remoteClient); 279 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient);
280 280
281 return; 281 return;
282 } 282 }
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
index a6bb405..3fdfd8a 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
117 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "state_entry", EventQueueManager.llDetectNull, new object[] { }); 117 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "state_entry", EventQueueManager.llDetectNull, new object[] { });
118 } 118 }
119 119
120 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 120 public void touch_start(uint localID, uint originalID, LLVector3 offsetPos, IClientAPI remoteClient)
121 { 121 {
122 // Add to queue for all scripts in ObjectID object 122 // Add to queue for all scripts in ObjectID object
123 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); 123 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct();
@@ -152,7 +152,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
152 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { new LSL_Types.LSLInteger(1) }); 152 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { new LSL_Types.LSLInteger(1) });
153 } 153 }
154 154
155 public void touch_end(uint localID, IClientAPI remoteClient) 155 public void touch_end(uint localID, uint originalID, IClientAPI remoteClient)
156 { 156 {
157 // Add to queue for all scripts in ObjectID object 157 // Add to queue for all scripts in ObjectID object
158 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); 158 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct();
@@ -220,12 +220,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
220 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "state_exit", EventQueueManager.llDetectNull, new object[] { }); 220 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "state_exit", EventQueueManager.llDetectNull, new object[] { });
221 } 221 }
222 222
223 public void touch(uint localID, LLUUID itemID) 223 public void touch(uint localID, uint originalID, LLUUID itemID)
224 { 224 {
225 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch", EventQueueManager.llDetectNull); 225 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch", EventQueueManager.llDetectNull);
226 } 226 }
227 227
228 public void touch_end(uint localID, LLUUID itemID) 228 public void touch_end(uint localID, uint originalID, LLUUID itemID)
229 { 229 {
230 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) }); 230 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) });
231 } 231 }
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
index 9a465f6..41fde02 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
@@ -38,12 +38,12 @@ namespace OpenSim.Region.ScriptEngine.Common
38 { 38 {
39 public interface RemoteEvents 39 public interface RemoteEvents
40 { 40 {
41 void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); 41 void touch_start(uint localID, uint originalID, LLVector3 offsetPos, IClientAPI remoteClient);
42 void OnRezScript(uint localID, LLUUID itemID, string script, int startParam, bool postOnRez); 42 void OnRezScript(uint localID, LLUUID itemID, string script, int startParam, bool postOnRez);
43 void OnRemoveScript(uint localID, LLUUID itemID); 43 void OnRemoveScript(uint localID, LLUUID itemID);
44 void state_exit(uint localID); 44 void state_exit(uint localID);
45 void touch(uint localID, LLUUID itemID); 45 void touch(uint localID, uint originalID, LLUUID itemID);
46 void touch_end(uint localID, LLUUID itemID); 46 void touch_end(uint localID, uint originalID, LLUUID itemID);
47 void collision_start(uint localID, ColliderArgs col); 47 void collision_start(uint localID, ColliderArgs col);
48 void collision(uint localID, ColliderArgs col); 48 void collision(uint localID, ColliderArgs col);
49 void collision_end(uint localID, ColliderArgs col); 49 void collision_end(uint localID, ColliderArgs col);
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
index 292858c..7c22eed 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
@@ -48,7 +48,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
48 Object AsyncCommands { get; } 48 Object AsyncCommands { get; }
49 ILog Log { get; } 49 ILog Log { get; }
50 string ScriptEngineName { get; } 50 string ScriptEngineName { get; }
51 int MaxScriptQueue { get; }
52 51
53 bool PostScriptEvent(LLUUID itemID, EventParams parms); 52 bool PostScriptEvent(LLUUID itemID, EventParams parms);
54 bool PostObjectEvent(uint localID, EventParams parms); 53 bool PostObjectEvent(uint localID, EventParams parms);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 30c0274..ff50396 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -72,6 +72,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
72 private int m_StartParam = 0; 72 private int m_StartParam = 0;
73 private string m_CurrentEvent = String.Empty; 73 private string m_CurrentEvent = String.Empty;
74 private bool m_InSelfDelete = false; 74 private bool m_InSelfDelete = false;
75 private int m_MaxScriptQueue;
75 76
76 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); 77 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
77 78
@@ -153,7 +154,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
153 public ScriptInstance(IScriptEngine engine, uint localID, 154 public ScriptInstance(IScriptEngine engine, uint localID,
154 LLUUID objectID, LLUUID itemID, LLUUID assetID, string assembly, 155 LLUUID objectID, LLUUID itemID, LLUUID assetID, string assembly,
155 AppDomain dom, string primName, string scriptName, 156 AppDomain dom, string primName, string scriptName,
156 int startParam, bool postOnRez, StateSource stateSource) 157 int startParam, bool postOnRez, StateSource stateSource,
158 int maxScriptQueue)
157 { 159 {
158 m_Engine = engine; 160 m_Engine = engine;
159 161
@@ -165,6 +167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
165 m_ScriptName = scriptName; 167 m_ScriptName = scriptName;
166 m_Assembly = assembly; 168 m_Assembly = assembly;
167 m_StartParam = startParam; 169 m_StartParam = startParam;
170 m_MaxScriptQueue = maxScriptQueue;
168 171
169 ApiManager am = new ApiManager(); 172 ApiManager am = new ApiManager();
170 173
@@ -411,7 +414,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
411 414
412 lock (m_EventQueue) 415 lock (m_EventQueue)
413 { 416 {
414 if (m_EventQueue.Count >= m_Engine.MaxScriptQueue) 417 if (m_EventQueue.Count >= m_MaxScriptQueue)
415 return; 418 return;
416 419
417 m_EventQueue.Enqueue(data); 420 m_EventQueue.Enqueue(data);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index a4b9d4c..3a01dc6 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
80 } 80 }
81 } 81 }
82 82
83 public void touch_start(uint localID, LLVector3 offsetPos, 83 public void touch_start(uint localID, uint originalID, LLVector3 offsetPos,
84 IClientAPI remoteClient) 84 IClientAPI remoteClient)
85 { 85 {
86 // Add to queue for all scripts in ObjectID object 86 // Add to queue for all scripts in ObjectID object
@@ -89,19 +89,27 @@ namespace OpenSim.Region.ScriptEngine.XEngine
89 det[0].Key = remoteClient.AgentId; 89 det[0].Key = remoteClient.AgentId;
90 det[0].Populate(myScriptEngine.World); 90 det[0].Populate(myScriptEngine.World);
91 91
92 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart( 92
93 localID); 93 if (originalID == 0)
94 if (part == null) 94 {
95 return; 95 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
96 96 if (part == null)
97 det[0].LinkNum = part.LinkNum; 97 return;
98 98
99 det[0].LinkNum = part.LinkNum;
100 }
101 else
102 {
103 SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
104 det[0].LinkNum = originalPart.LinkNum;
105 }
106
99 myScriptEngine.PostObjectEvent(localID, new EventParams( 107 myScriptEngine.PostObjectEvent(localID, new EventParams(
100 "touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, 108 "touch_start", new Object[] { new LSL_Types.LSLInteger(1) },
101 det)); 109 det));
102 } 110 }
103 111
104 public void touch(uint localID, LLVector3 offsetPos, 112 public void touch(uint localID, uint originalID, LLVector3 offsetPos,
105 IClientAPI remoteClient) 113 IClientAPI remoteClient)
106 { 114 {
107 // Add to queue for all scripts in ObjectID object 115 // Add to queue for all scripts in ObjectID object
@@ -113,19 +121,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
113 offsetPos.Y, 121 offsetPos.Y,
114 offsetPos.Z); 122 offsetPos.Z);
115 123
116 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart( 124 if (originalID == 0)
117 localID); 125 {
118 if (part == null) 126 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
119 return; 127 if (part == null)
128 return;
120 129
121 det[0].LinkNum = part.LinkNum; 130 det[0].LinkNum = part.LinkNum;
131 }
132 else
133 {
134 SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
135 det[0].LinkNum = originalPart.LinkNum;
136 }
122 137
123 myScriptEngine.PostObjectEvent(localID, new EventParams( 138 myScriptEngine.PostObjectEvent(localID, new EventParams(
124 "touch", new Object[] { new LSL_Types.LSLInteger(1) }, 139 "touch", new Object[] { new LSL_Types.LSLInteger(1) },
125 det)); 140 det));
126 } 141 }
127 142
128 public void touch_end(uint localID, IClientAPI remoteClient) 143 public void touch_end(uint localID, uint originalID, IClientAPI remoteClient)
129 { 144 {
130 // Add to queue for all scripts in ObjectID object 145 // Add to queue for all scripts in ObjectID object
131 DetectParams[] det = new DetectParams[1]; 146 DetectParams[] det = new DetectParams[1];
@@ -133,12 +148,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
133 det[0].Key = remoteClient.AgentId; 148 det[0].Key = remoteClient.AgentId;
134 det[0].Populate(myScriptEngine.World); 149 det[0].Populate(myScriptEngine.World);
135 150
136 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart( 151 if (originalID == 0)
137 localID); 152 {
138 if (part == null) 153 SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
139 return; 154 if (part == null)
155 return;
140 156
141 det[0].LinkNum = part.LinkNum; 157 det[0].LinkNum = part.LinkNum;
158 }
159 else
160 {
161 SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
162 det[0].LinkNum = originalPart.LinkNum;
163 }
142 164
143 myScriptEngine.PostObjectEvent(localID, new EventParams( 165 myScriptEngine.PostObjectEvent(localID, new EventParams(
144 "touch_end", new Object[] { new LSL_Types.LSLInteger(1) }, 166 "touch_end", new Object[] { new LSL_Types.LSLInteger(1) },
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index c5bcfd5..8fd8a1c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -319,14 +319,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
319 get { return false; } 319 get { return false; }
320 } 320 }
321 321
322 //
323 // XEngine functions
324 //
325 public int MaxScriptQueue
326 {
327 get { return m_MaxScriptQueue; }
328 }
329
330 public void OnRezScript(uint localID, LLUUID itemID, string script, int startParam, bool postOnRez) 322 public void OnRezScript(uint localID, LLUUID itemID, string script, int startParam, bool postOnRez)
331 { 323 {
332 Object[] parms = new Object[] 324 Object[] parms = new Object[]
@@ -508,7 +500,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
508 m_AppDomains[appDomain], 500 m_AppDomains[appDomain],
509 part.ParentGroup.RootPart.Name, 501 part.ParentGroup.RootPart.Name,
510 item.Name, startParam, postOnRez, 502 item.Name, startParam, postOnRez,
511 StateSource.NewRez); 503 StateSource.NewRez, m_MaxScriptQueue);
512 504
513 m_log.DebugFormat("[XEngine] Loaded script {0}.{1}", 505 m_log.DebugFormat("[XEngine] Loaded script {0}.{1}",
514 part.ParentGroup.RootPart.Name, item.Name); 506 part.ParentGroup.RootPart.Name, item.Name);