* Implements "ID" semi-global within MRM scripts. This is tied to the 'state ID' for MRMs.

* Implements IPersistence interface, allows simple KeyValue access for MRM scripts to a more permanent datastore.
0.6.5-rc1
Adam Frisby 2009-04-03 09:22:34 +00:00
parent 5f4cab6ed3
commit 7e91f41535
5 changed files with 45 additions and 7 deletions

View File

@ -25,10 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Text;
using log4net; using log4net;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule namespace OpenSim.Region.OptionalModules.Scripting.Minimodule

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
interface IPersistence
{
Object Get(MRMBase state, Guid storageID);
Object Get(MRMBase state);
/// <summary>
/// Stores 'data' into the persistence system
/// associated with this object, however saved
/// under the ID 'storageID'. This data may
/// be accessed by other scripts however.
/// </summary>
/// <param name="state"></param>
/// <param name="storageID"></param>
/// <param name="data"></param>
void Put(MRMBase state, Guid storageID, Object data);
/// <summary>
/// Stores 'data' into the persistence system
/// using the default ID for this script.
/// </summary>
/// <param name="state"></param>
/// <param name="data"></param>
void Put(MRMBase state, Object data);
}
}

View File

@ -25,17 +25,21 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{ {
public abstract class MRMBase public abstract class MRMBase
{ {
private IWorld m_world; private IWorld m_world;
private IHost m_host; private IHost m_host;
private UUID m_id;
public void InitMiniModule(IWorld world, IHost host) public void InitMiniModule(IWorld world, IHost host, UUID uniqueID)
{ {
m_world = world; m_world = world;
m_host = host; m_host = host;
m_id = uniqueID;
} }
protected IWorld World protected IWorld World
@ -48,6 +52,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
get { return m_host; } get { return m_host; }
} }
public UUID ID
{
get { return m_id; }
}
public abstract void Start(); public abstract void Start();
public abstract void Stop(); public abstract void Stop();
} }

View File

@ -82,7 +82,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
CompileFromDotNetText(script, itemID.ToString()), CompileFromDotNetText(script, itemID.ToString()),
"OpenSim.MiniModule"); "OpenSim.MiniModule");
m_log.Info("[MRM] Created MRM Instance"); m_log.Info("[MRM] Created MRM Instance");
mmb.InitMiniModule(m_world, m_host); mmb.InitMiniModule(m_world, m_host, itemID);
m_scripts[itemID] = mmb; m_scripts[itemID] = mmb;
m_log.Info("[MRM] Starting MRM"); m_log.Info("[MRM] Starting MRM");

View File

@ -1,11 +1,12 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{ {
class SOPObject : IObject class SOPObject : MarshalByRefObject, IObject
{ {
private readonly Scene m_rootScene; private readonly Scene m_rootScene;
private readonly uint m_localID; private readonly uint m_localID;