* Implements MRM's Stop() interface member.

* MRM Scripts should do appropriate cleanup within this event, to allow for clean shutdowns and script updates. This means unbinding from events you are listening to, and releasing any resources.
arthursv
Adam Frisby 2009-08-07 14:17:51 +10:00
parent e49abf446a
commit 270ae50d70
2 changed files with 10 additions and 0 deletions

View File

@ -81,6 +81,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
public int Type { get { return m_privateItem.Type; } } public int Type { get { return m_privateItem.Type; } }
public UUID AssetID { get { return m_privateItem.AssetID; } } public UUID AssetID { get { return m_privateItem.AssetID; } }
// This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM.
public T RetreiveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() public T RetreiveAsset<T>() where T : OpenMetaverse.Assets.Asset, new()
{ {
AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString()); AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString());

View File

@ -73,6 +73,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
if (!source.Configs["MRM"].GetBoolean("Hidden", false)) if (!source.Configs["MRM"].GetBoolean("Hidden", false))
{ {
scene.EventManager.OnRezScript += EventManager_OnRezScript; scene.EventManager.OnRezScript += EventManager_OnRezScript;
scene.EventManager.OnStopScript += EventManager_OnStopScript;
} }
scene.EventManager.OnFrame += EventManager_OnFrame; scene.EventManager.OnFrame += EventManager_OnFrame;
@ -90,6 +91,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
} }
} }
void EventManager_OnStopScript(uint localID, UUID itemID)
{
if(m_scripts.ContainsKey(itemID))
{
m_scripts[itemID].Stop();
}
}
void EventManager_OnFrame() void EventManager_OnFrame()
{ {
m_microthreads.Tick(1000); m_microthreads.Tick(1000);