diff options
author | Melanie Thielker | 2008-09-25 17:26:32 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-25 17:26:32 +0000 |
commit | f11107821e259d544dc42648f4cdba2b123cd71e (patch) | |
tree | 5d288d96a2eb07788ae40130736215599eb9bcec /OpenSim/Region/ScriptEngine/Common | |
parent | Mantis#2017. Thank you kindly, Tyre, for a patch that solves: (diff) | |
download | opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.zip opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.gz opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.bz2 opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.xz |
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
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
3 files changed, 17 insertions, 6 deletions
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 | |||
215 | 215 | ||
216 | public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) | 216 | public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) |
217 | { | 217 | { |
218 | List<IScriptModule> engines = new List<IScriptModule>(myScriptEngine.World.RequestModuleInterfaces<IScriptModule>()); | ||
219 | |||
220 | List<string> names = new List<string>(); | ||
221 | foreach (IScriptModule m in engines) | ||
222 | names.Add(m.ScriptEngineName); | ||
223 | |||
218 | int lineEnd = script.IndexOf('\n'); | 224 | int lineEnd = script.IndexOf('\n'); |
219 | 225 | ||
220 | if (lineEnd != 1) | 226 | if (lineEnd != 1) |
@@ -224,8 +230,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
224 | int colon = firstline.IndexOf(':'); | 230 | int colon = firstline.IndexOf(':'); |
225 | if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1) | 231 | if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1) |
226 | { | 232 | { |
227 | engine = firstline.Substring(2, colon-2); | 233 | string engineName = firstline.Substring(2, colon-2); |
228 | script = "//" + script.Substring(script.IndexOf(':')+1); | 234 | |
235 | if (names.Contains(engineName)) | ||
236 | { | ||
237 | engine = engineName; | ||
238 | script = "//" + script.Substring(script.IndexOf(':')+1); | ||
239 | } | ||
229 | } | 240 | } |
230 | } | 241 | } |
231 | 242 | ||
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 | |||
282 | // QIS.functionName); | 282 | // QIS.functionName); |
283 | #endif | 283 | #endif |
284 | // Only pipe event if land supports it. | 284 | // Only pipe event if land supports it. |
285 | if (m_ScriptEngine.World.pipeEventsForScript(QIS.localID)) | 285 | if (m_ScriptEngine.World.PipeEventsForScript(QIS.localID)) |
286 | { | 286 | { |
287 | LastExecutionStarted = DateTime.Now.Ticks; | 287 | LastExecutionStarted = DateTime.Now.Ticks; |
288 | KillCurrentScript = false; | 288 | 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; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Region.Interfaces; | ||
33 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
34 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
35 | using OpenSim.Region.ScriptEngine.Interfaces; | 36 | using OpenSim.Region.ScriptEngine.Interfaces; |
@@ -43,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
43 | /// </summary> | 44 | /// </summary> |
44 | /// | 45 | /// |
45 | [Serializable] | 46 | [Serializable] |
46 | public abstract class ScriptEngine : IRegionModule, ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule, IEventReceiver | 47 | public abstract class ScriptEngine : IRegionModule, IScriptModule, ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule, IEventReceiver |
47 | { | 48 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 50 | ||
@@ -126,8 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
126 | m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\""); | 127 | m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\""); |
127 | ReadConfig(); | 128 | ReadConfig(); |
128 | 129 | ||
129 | // Should we iterate the region for scripts that needs starting? | 130 | m_Scene.StackModuleInterface<IScriptModule>(this); |
130 | // Or can we assume we are loaded before anything else so we can use proper events? | ||
131 | } | 131 | } |
132 | 132 | ||
133 | public void PostInitialise() | 133 | public void PostInitialise() |