diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 8fdac25..f17711c 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
53 | 53 | ||
54 | 54 | ||
55 | // Object<string, Script<string, script>> | 55 | // Object<string, Script<string, script>> |
56 | internal Dictionary<string, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>> Scripts = new Dictionary<string, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>>(); | 56 | internal Dictionary<IScriptHost, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>> Scripts = new Dictionary<IScriptHost, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>>(); |
57 | public Scene World | 57 | public Scene World |
58 | { | 58 | { |
59 | get | 59 | get |
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | internal Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>.KeyCollection GetScriptKeys(string ObjectID) | 66 | internal Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>.KeyCollection GetScriptKeys(IScriptHost ObjectID) |
67 | { | 67 | { |
68 | if (Scripts.ContainsKey(ObjectID) == false) | 68 | if (Scripts.ContainsKey(ObjectID) == false) |
69 | return null; | 69 | return null; |
@@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
75 | 75 | ||
76 | } | 76 | } |
77 | 77 | ||
78 | internal OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass GetScript(string ObjectID, string ScriptID) | 78 | internal OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass GetScript(IScriptHost ObjectID, string ScriptID) |
79 | { | 79 | { |
80 | if (Scripts.ContainsKey(ObjectID) == false) | 80 | if (Scripts.ContainsKey(ObjectID) == false) |
81 | return null; | 81 | return null; |
@@ -92,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
92 | return Script; | 92 | return Script; |
93 | 93 | ||
94 | } | 94 | } |
95 | internal void SetScript(string ObjectID, string ScriptID, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script) | 95 | internal void SetScript(IScriptHost ObjectID, string ScriptID, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script) |
96 | { | 96 | { |
97 | // Create object if it doesn't exist | 97 | // Create object if it doesn't exist |
98 | if (Scripts.ContainsKey(ObjectID) == false) | 98 | if (Scripts.ContainsKey(ObjectID) == false) |
@@ -116,8 +116,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
116 | /// </summary> | 116 | /// </summary> |
117 | /// <param name="ScriptID"></param> | 117 | /// <param name="ScriptID"></param> |
118 | /// <param name="ObjectID"></param> | 118 | /// <param name="ObjectID"></param> |
119 | public void StartScript(string ScriptID, string ObjectID) | 119 | public void StartScript(string ScriptID, IScriptHost ObjectID) |
120 | { | 120 | { |
121 | //IScriptHost root = host.GetRoot(); | ||
121 | m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID); | 122 | m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID); |
122 | 123 | ||
123 | // We will initialize and start the script. | 124 | // We will initialize and start the script. |
@@ -162,11 +163,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
162 | // * Load and start script, for now with dummy host | 163 | // * Load and start script, for now with dummy host |
163 | 164 | ||
164 | //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); | 165 | //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); |
165 | IScriptHost host = new NullScriptHost(); | ||
166 | IScriptHost root = host; | ||
167 | 166 | ||
168 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, host, root ); | 167 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, ObjectID); |
169 | string FullScriptID = ScriptID + "." + ObjectID; | 168 | //string FullScriptID = ScriptID + "." + ObjectID; |
170 | // Add it to our temporary active script keeper | 169 | // Add it to our temporary active script keeper |
171 | //Scripts.Add(FullScriptID, Script); | 170 | //Scripts.Add(FullScriptID, Script); |
172 | SetScript(ObjectID, ScriptID, Script); | 171 | SetScript(ObjectID, ScriptID, Script); |
@@ -206,7 +205,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
206 | /// <param name="FreeAppDomain">AppDomain to load script into</param> | 205 | /// <param name="FreeAppDomain">AppDomain to load script into</param> |
207 | /// <param name="FileName">FileName of script assembly (.dll)</param> | 206 | /// <param name="FileName">FileName of script assembly (.dll)</param> |
208 | /// <returns></returns> | 207 | /// <returns></returns> |
209 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host, IScriptHost root) | 208 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host) |
210 | { | 209 | { |
211 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName); | 210 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName); |
212 | // Load .Net Assembly (.dll) | 211 | // Load .Net Assembly (.dll) |
@@ -249,8 +248,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
249 | object[] args = new object[] | 248 | object[] args = new object[] |
250 | { | 249 | { |
251 | this, | 250 | this, |
252 | host, | 251 | host |
253 | root | ||
254 | }; | 252 | }; |
255 | 253 | ||
256 | return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args ); | 254 | return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args ); |
@@ -258,7 +256,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
258 | 256 | ||
259 | } | 257 | } |
260 | 258 | ||
261 | internal void ExecuteFunction(string ObjectID, string ScriptID, string FunctionName, object[] args) | 259 | internal void ExecuteFunction(IScriptHost ObjectID, string ScriptID, string FunctionName, object[] args) |
262 | { | 260 | { |
263 | m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); | 261 | m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); |
264 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); | 262 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); |