From f3c8963c86dbc969541ede80ae37eb59d26b7809 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 25 Sep 2008 05:13:44 +0000 Subject: Convergence is almost complete. This brings the diff between the API to < 10k and makes it use a common set of types in both engine. Fixes the issues with running both engines and HTTP requests / listens / timers etc.. Also fixes a couple of minor Scene issues and a CTB by nullref. --- .../Common/ScriptEngineBase/ScriptManager.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs') diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index ff8e16f..095e11f 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs @@ -33,6 +33,7 @@ using System.Runtime.Serialization.Formatters.Binary; using System.Threading; using OpenMetaverse; using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.ScriptEngine.Shared; namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { @@ -65,6 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase private int LoadUnloadMaxQueueSize; private Object scriptLock = new Object(); private bool m_started = false; + private Dictionary detparms = new Dictionary(); // Load/Unload structure private struct LUStruct @@ -228,6 +230,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase if (item.Action == LUType.Unload) { _StopScript(item.localID, item.itemID); + RemoveScript(item.localID, item.itemID); } else if (item.Action == LUType.Load) { @@ -318,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase /// Script ID /// Name of function /// Arguments to pass to function - internal void ExecuteEvent(uint localID, UUID itemID, string FunctionName, EventQueueManager.Queue_llDetectParams_Struct qParams, object[] args) + internal void ExecuteEvent(uint localID, UUID itemID, string FunctionName, DetectParams[] qParams, object[] args) { //cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined ///#if DEBUG @@ -337,8 +340,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase /// Console.WriteLine("ScriptEngine: Executing event: " + FunctionName); ///#endif // Must be done in correct AppDomain, so leaving it up to the script itself - Script.llDetectParams = qParams; + detparms[Script] = qParams; Script.Exec.ExecuteEvent(FunctionName, args); + detparms.Remove(Script); } public uint GetLocalID(UUID itemID) @@ -430,6 +434,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public void RemoveScript(uint localID, UUID itemID) { + if (localID == 0) + localID = GetLocalID(itemID); + // Don't have that object? if (Scripts.ContainsKey(localID) == false) return; @@ -486,5 +493,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase // set { _PleaseShutdown = value; } //} //private bool _PleaseShutdown = false; + + public DetectParams[] GetDetectParams(IScript script) + { + if (detparms.ContainsKey(script)) + return detparms[script]; + + return null; + } } } -- cgit v1.1