diff options
author | Melanie Thielker | 2008-09-23 17:33:00 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-23 17:33:00 +0000 |
commit | 6425680cff72e728045a698e84a17dcb85272f9a (patch) | |
tree | c262f679661d4ee657768ff0c7bcb466faab5d6d /OpenSim/Region/ScriptEngine | |
parent | Remove Common/LSL_Types.cs. Both script engines now use a single version (diff) | |
download | opensim-SC_OLD-6425680cff72e728045a698e84a17dcb85272f9a.zip opensim-SC_OLD-6425680cff72e728045a698e84a17dcb85272f9a.tar.gz opensim-SC_OLD-6425680cff72e728045a698e84a17dcb85272f9a.tar.bz2 opensim-SC_OLD-6425680cff72e728045a698e84a17dcb85272f9a.tar.xz |
Add IEventReceiver to DNE - a consolidation series patch
Diffstat (limited to '')
3 files changed, 38 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index d0af720..ac0ab7e 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs | |||
@@ -322,7 +322,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
322 | /// <param name="localID">Region object ID</param> | 322 | /// <param name="localID">Region object ID</param> |
323 | /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param> | 323 | /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param> |
324 | /// <param name="param">Array of parameters to match event mask</param> | 324 | /// <param name="param">Array of parameters to match event mask</param> |
325 | public void AddToObjectQueue(uint localID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param) | 325 | public bool AddToObjectQueue(uint localID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param) |
326 | { | 326 | { |
327 | // Determine all scripts in Object and add to their queue | 327 | // Determine all scripts in Object and add to their queue |
328 | //myScriptEngine.log.Info("[" + ScriptEngineName + "]: EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); | 328 | //myScriptEngine.log.Info("[" + ScriptEngineName + "]: EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); |
@@ -331,10 +331,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
331 | if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false) | 331 | if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false) |
332 | { | 332 | { |
333 | //Console.WriteLine("Event \String.Empty + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID."); | 333 | //Console.WriteLine("Event \String.Empty + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID."); |
334 | return; | 334 | return false; |
335 | } | 335 | } |
336 | 336 | ||
337 | Dictionary<UUID, IScript>.KeyCollection scriptKeys = | 337 | List<UUID> scriptKeys = |
338 | m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); | 338 | m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); |
339 | 339 | ||
340 | foreach (UUID itemID in scriptKeys) | 340 | foreach (UUID itemID in scriptKeys) |
@@ -343,6 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
343 | // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? | 343 | // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? |
344 | AddToScriptQueue(localID, itemID, FunctionName, qParams, param); | 344 | AddToScriptQueue(localID, itemID, FunctionName, qParams, param); |
345 | } | 345 | } |
346 | return true; | ||
346 | } | 347 | } |
347 | 348 | ||
348 | /// <summary> | 349 | /// <summary> |
@@ -352,12 +353,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
352 | /// <param name="itemID">Region script ID</param> | 353 | /// <param name="itemID">Region script ID</param> |
353 | /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param> | 354 | /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param> |
354 | /// <param name="param">Array of parameters to match event mask</param> | 355 | /// <param name="param">Array of parameters to match event mask</param> |
355 | public void AddToScriptQueue(uint localID, UUID itemID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param) | 356 | public bool AddToScriptQueue(uint localID, UUID itemID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param) |
356 | { | 357 | { |
357 | List<UUID> keylist = new List<UUID>(m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID)); | 358 | List<UUID> keylist = new List<UUID>(m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID)); |
358 | 359 | ||
359 | if (!keylist.Contains(itemID)) // We don't manage that script | 360 | if (!keylist.Contains(itemID)) // We don't manage that script |
360 | return; | 361 | return false; |
361 | 362 | ||
362 | lock (eventQueue) | 363 | lock (eventQueue) |
363 | { | 364 | { |
@@ -365,7 +366,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
365 | { | 366 | { |
366 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event."); | 367 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event."); |
367 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); | 368 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); |
368 | return; | 369 | return false; |
369 | } | 370 | } |
370 | 371 | ||
371 | // Create a structure and add data | 372 | // Create a structure and add data |
@@ -379,6 +380,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
379 | // Add it to queue | 380 | // Add it to queue |
380 | eventQueue.Enqueue(QIS); | 381 | eventQueue.Enqueue(QIS); |
381 | } | 382 | } |
383 | return true; | ||
382 | } | 384 | } |
383 | #endregion | 385 | #endregion |
384 | 386 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs index af29dc8..79f521d 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | |||
@@ -32,6 +32,9 @@ using log4net; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Region.Environment.Interfaces; | 33 | using OpenSim.Region.Environment.Interfaces; |
34 | using OpenSim.Region.Environment.Scenes; | 34 | using OpenSim.Region.Environment.Scenes; |
35 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Region.ScriptEngine.Shared; | ||
35 | 38 | ||
36 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | 39 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase |
37 | { | 40 | { |
@@ -40,7 +43,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
40 | /// </summary> | 43 | /// </summary> |
41 | /// | 44 | /// |
42 | [Serializable] | 45 | [Serializable] |
43 | public abstract class ScriptEngine : IRegionModule, ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule | 46 | public abstract class ScriptEngine : IRegionModule, ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule, IEventReceiver |
44 | { | 47 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 49 | ||
@@ -187,6 +190,16 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
187 | get { return false; } | 190 | get { return false; } |
188 | } | 191 | } |
189 | 192 | ||
193 | public bool PostObjectEvent(uint localID, EventParams p) | ||
194 | { | ||
195 | return m_EventQueueManager.AddToObjectQueue(localID, p.EventName, EventQueueManager.llDetectNull, p.Params); | ||
196 | } | ||
197 | |||
198 | public bool PostScriptEvent(UUID itemID, EventParams p) | ||
199 | { | ||
200 | return m_EventQueueManager.AddToScriptQueue(0, itemID, p.EventName, EventQueueManager.llDetectNull, p.Params); | ||
201 | } | ||
202 | |||
190 | #endregion | 203 | #endregion |
191 | } | 204 | } |
192 | } | 205 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 47cb2fd..8d4dc56 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | |||
@@ -366,15 +366,29 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
366 | 366 | ||
367 | #region Internal functions to keep track of script | 367 | #region Internal functions to keep track of script |
368 | 368 | ||
369 | public Dictionary<UUID, IScript>.KeyCollection GetScriptKeys(uint localID) | 369 | public List<UUID> GetScriptKeys(uint localID) |
370 | { | 370 | { |
371 | if (localID == 0) // Find it | ||
372 | { | ||
373 | List<UUID> keylist = new List<UUID>(); | ||
374 | |||
375 | foreach (Dictionary<UUID, IScript> d in Scripts.Values) | ||
376 | { | ||
377 | foreach (UUID id in d.Keys) | ||
378 | { | ||
379 | if (!keylist.Contains(id)) | ||
380 | keylist.Add(id); | ||
381 | } | ||
382 | } | ||
383 | } | ||
384 | |||
371 | if (Scripts.ContainsKey(localID) == false) | 385 | if (Scripts.ContainsKey(localID) == false) |
372 | return null; | 386 | return null; |
373 | 387 | ||
374 | Dictionary<UUID, IScript> Obj; | 388 | Dictionary<UUID, IScript> Obj; |
375 | Scripts.TryGetValue(localID, out Obj); | 389 | Scripts.TryGetValue(localID, out Obj); |
376 | 390 | ||
377 | return Obj.Keys; | 391 | return new List<UUID>(Obj.Keys); |
378 | } | 392 | } |
379 | 393 | ||
380 | public IScript GetScript(uint localID, UUID itemID) | 394 | public IScript GetScript(uint localID, UUID itemID) |