From f11107821e259d544dc42648f4cdba2b123cd71e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 25 Sep 2008 17:26:32 +0000 Subject: Add an extension to allow registering multiple interfaces of a type with Scene. Make the script engines check that the engine name in the //Engine:language comment is a valid engine and treat it as a normal comment if it's not. //DotNetEngine: needs to be written as //ScriptEngine.DotNetEngine: now, since that is it's real internal name. //XEngine: still works --- .../ScriptEngine/Common/ScriptEngineBase/EventManager.cs | 15 +++++++++++++-- .../Common/ScriptEngineBase/EventQueueThreadClass.cs | 2 +- .../ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | 6 +++--- 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common') diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index c8c9cd8..0308169 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs @@ -215,6 +215,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) { + List engines = new List(myScriptEngine.World.RequestModuleInterfaces()); + + List names = new List(); + foreach (IScriptModule m in engines) + names.Add(m.ScriptEngineName); + int lineEnd = script.IndexOf('\n'); if (lineEnd != 1) @@ -224,8 +230,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase int colon = firstline.IndexOf(':'); if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1) { - engine = firstline.Substring(2, colon-2); - script = "//" + script.Substring(script.IndexOf(':')+1); + string engineName = firstline.Substring(2, colon-2); + + if (names.Contains(engineName)) + { + engine = engineName; + script = "//" + script.Substring(script.IndexOf(':')+1); + } } } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index 1e71ae5..7f52793 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs @@ -282,7 +282,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase // QIS.functionName); #endif // Only pipe event if land supports it. - if (m_ScriptEngine.World.pipeEventsForScript(QIS.localID)) + if (m_ScriptEngine.World.PipeEventsForScript(QIS.localID)) { LastExecutionStarted = DateTime.Now.Ticks; KillCurrentScript = false; diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs index d423311..2bcd949 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Reflection; using log4net; using Nini.Config; +using OpenSim.Region.Interfaces; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.ScriptEngine.Interfaces; @@ -43,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase /// /// [Serializable] - public abstract class ScriptEngine : IRegionModule, ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule, IEventReceiver + public abstract class ScriptEngine : IRegionModule, IScriptModule, ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule, IEventReceiver { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -126,8 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\""); ReadConfig(); - // Should we iterate the region for scripts that needs starting? - // Or can we assume we are loaded before anything else so we can use proper events? + m_Scene.StackModuleInterface(this); } public void PostInitialise() -- cgit v1.1