From e8d1235e91e336ebbb4f77cdffd9c19bb36eb078 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 26 Sep 2008 16:37:29 +0000 Subject: [PATCH] Adds support for the "Running" checkbox and the "Reset" button, as well as ResetScripts In Selection, Set Script to [not] Running In Selection from the tools menu. Allows DNE script reset without a full recompile. --- .../ScriptEngine/DotNetEngine/ScriptEngine.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index a2b5621150..71db4eede8 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -31,6 +31,7 @@ using System.Reflection; using log4net; using Nini.Config; using OpenSim.Region.Interfaces; +using OpenSim.Framework; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.ScriptEngine.Interfaces; @@ -135,6 +136,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine m_EventManager.HookUpEvents(); + m_Scene.EventManager.OnScriptReset += OnScriptReset; + m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning; + m_Scene.EventManager.OnStartScript += OnStartScript; + m_Scene.EventManager.OnStopScript += OnStopScript; + m_ScriptManager.Start(); } @@ -310,5 +316,43 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine m_ScriptManager.ResetScript(localID, itemID); } + + public void OnScriptReset(uint localID, UUID itemID) + { + ResetScript(itemID); + } + + public void OnStartScript(uint localID, UUID itemID) + { + InstanceData id = m_ScriptManager.GetScript(localID, itemID); + if (id == null) + return; + + if (!id.Disabled) + id.Running = true; + } + + public void OnStopScript(uint localID, UUID itemID) + { + InstanceData id = m_ScriptManager.GetScript(localID, itemID); + if (id == null) + return; + + id.Running = false; + } + + public void OnGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) + { + uint localID = m_ScriptManager.GetLocalID(itemID); + if (localID == 0) + return; + + InstanceData id = m_ScriptManager.GetScript(localID, itemID); + if (id == null) + return; + + controllingClient.SendScriptRunningReply(objectID, itemID, + id.Running); + } } }