diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index c521d47..20300c0 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -221,7 +221,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
221 | 221 | ||
222 | } | 222 | } |
223 | #endregion | 223 | #endregion |
224 | #region Start/Stop script | 224 | #region Start/Stop/Reset script |
225 | /// <summary> | 225 | /// <summary> |
226 | /// Fetches, loads and hooks up a script to an objects events | 226 | /// Fetches, loads and hooks up a script to an objects events |
227 | /// </summary> | 227 | /// </summary> |
@@ -246,6 +246,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
246 | ls.localID = localID; | 246 | ls.localID = localID; |
247 | ls.itemID = itemID; | 247 | ls.itemID = itemID; |
248 | unloadQueue.Enqueue(ls); | 248 | unloadQueue.Enqueue(ls); |
249 | } | ||
250 | public void ResetScript(uint localID, LLUUID itemID) | ||
251 | { | ||
252 | string script = GetScript(localID, itemID).SourceCode; | ||
253 | StopScript(localID, itemID); | ||
254 | StartScript(localID, itemID, script); | ||
249 | } | 255 | } |
250 | 256 | ||
251 | private void _StartScript(uint localID, LLUUID itemID, string Script) | 257 | private void _StartScript(uint localID, LLUUID itemID, string Script) |
@@ -255,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
255 | 261 | ||
256 | // We will initialize and start the script. | 262 | // We will initialize and start the script. |
257 | // It will be up to the script itself to hook up the correct events. | 263 | // It will be up to the script itself to hook up the correct events. |
258 | string FileName = ""; | 264 | string ScriptSource = ""; |
259 | 265 | ||
260 | SceneObjectPart m_host = World.GetSceneObjectPart(localID); | 266 | SceneObjectPart m_host = World.GetSceneObjectPart(localID); |
261 | 267 | ||
@@ -268,10 +274,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
268 | // Create a new instance of the compiler (currently we don't want reuse) | 274 | // Create a new instance of the compiler (currently we don't want reuse) |
269 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); | 275 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); |
270 | // Compile (We assume LSL) | 276 | // Compile (We assume LSL) |
271 | FileName = LSLCompiler.CompileFromLSLText(Script); | 277 | ScriptSource = LSLCompiler.CompileFromLSLText(Script); |
272 | //Console.WriteLine("Compilation of " + FileName + " done"); | 278 | //Console.WriteLine("Compilation of " + FileName + " done"); |
273 | // * Insert yield into code | 279 | // * Insert yield into code |
274 | FileName = ProcessYield(FileName); | 280 | ScriptSource = ProcessYield(ScriptSource); |
275 | 281 | ||
276 | 282 | ||
277 | #if DEBUG | 283 | #if DEBUG |
@@ -279,11 +285,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
279 | before = GC.GetTotalMemory(true); | 285 | before = GC.GetTotalMemory(true); |
280 | #endif | 286 | #endif |
281 | LSL_BaseClass CompiledScript; | 287 | LSL_BaseClass CompiledScript; |
282 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(FileName); | 288 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); |
283 | #if DEBUG | 289 | #if DEBUG |
284 | Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); | 290 | Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); |
285 | #endif | 291 | #endif |
286 | 292 | ||
293 | CompiledScript.SourceCode = ScriptSource; | ||
287 | // Add it to our script memstruct | 294 | // Add it to our script memstruct |
288 | SetScript(localID, itemID, CompiledScript); | 295 | SetScript(localID, itemID, CompiledScript); |
289 | 296 | ||