aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs55
1 files changed, 33 insertions, 22 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index 1cab01e..c62e862 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -226,6 +226,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
226 } 226 }
227 } 227 }
228 228
229
229 /// <summary> 230 /// <summary>
230 /// Add event to event execution queue 231 /// Add event to event execution queue
231 /// </summary> 232 /// </summary>
@@ -237,34 +238,44 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
237 // Determine all scripts in Object and add to their queue 238 // Determine all scripts in Object and add to their queue
238 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); 239 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName);
239 240
240 lock (QueueLock)
241 {
242 241
243 // Do we have any scripts in this object at all? If not, return 242 // Do we have any scripts in this object at all? If not, return
244 if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false) 243 if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false)
245 { 244 {
246 //Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID."); 245 //Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID.");
247 return; 246 return;
248 } 247 }
249 248
250 foreach (LLUUID itemID in myScriptEngine.myScriptManager.GetScriptKeys(localID)) 249 foreach (LLUUID itemID in new System.Collections.ArrayList(myScriptEngine.myScriptManager.GetScriptKeys(localID)))
251 { 250 {
252 // Add to each script in that object 251 // Add to each script in that object
253 // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? 252 // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter?
253 AddToScriptQueue(localID, itemID, FunctionName, param);
254 }
254 255
255 // Create a structure and add data 256 }
256 QueueItemStruct QIS = new QueueItemStruct();
257 QIS.localID = localID;
258 QIS.itemID = itemID;
259 QIS.FunctionName = FunctionName;
260 QIS.param = param;
261 257
262 // Add it to queue 258 /// <summary>
263 EventQueue.Enqueue(QIS); 259 /// Add event to event execution queue
260 /// </summary>
261 /// <param name="localID"></param>
262 /// <param name="itemID"></param>
263 /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param>
264 /// <param name="param">Array of parameters to match event mask</param>
265 public void AddToScriptQueue(uint localID, LLUUID itemID, string FunctionName, object[] param)
266 {
267 lock (QueueLock)
268 {
269 // Create a structure and add data
270 QueueItemStruct QIS = new QueueItemStruct();
271 QIS.localID = localID;
272 QIS.itemID = itemID;
273 QIS.FunctionName = FunctionName;
274 QIS.param = param;
264 275
265 } 276 // Add it to queue
277 EventQueue.Enqueue(QIS);
266 } 278 }
267
268 } 279 }
269 280
270 } 281 }