From 7e91f41535e27d992cf85a46bed25b781367dcf1 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Fri, 3 Apr 2009 09:22:34 +0000
Subject: * 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.
---
.../OptionalModules/Scripting/Minimodule/Host.cs | 3 ---
.../Scripting/Minimodule/IPersistence.cs | 31 ++++++++++++++++++++++
.../Scripting/Minimodule/MRMBase.cs | 11 +++++++-
.../Scripting/Minimodule/MRMModule.cs | 2 +-
.../Scripting/Minimodule/SOPObject.cs | 5 ++--
5 files changed, 45 insertions(+), 7 deletions(-)
create mode 100644 OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs
(limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule')
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs
index 5a3690f..394e024 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs
@@ -25,10 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-using System;
-using System.Collections.Generic;
using System.Reflection;
-using System.Text;
using log4net;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs
new file mode 100644
index 0000000..6020a7a
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs
@@ -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);
+
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ void Put(MRMBase state, Guid storageID, Object data);
+
+ ///
+ /// Stores 'data' into the persistence system
+ /// using the default ID for this script.
+ ///
+ ///
+ ///
+ void Put(MRMBase state, Object data);
+ }
+}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs
index b98bb95..c47e592 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs
@@ -25,17 +25,21 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+using OpenMetaverse;
+
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public abstract class MRMBase
{
private IWorld m_world;
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_host = host;
+ m_id = uniqueID;
}
protected IWorld World
@@ -48,6 +52,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
get { return m_host; }
}
+ public UUID ID
+ {
+ get { return m_id; }
+ }
+
public abstract void Start();
public abstract void Stop();
}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 7c87756..3e53bc5 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
CompileFromDotNetText(script, itemID.ToString()),
"OpenSim.MiniModule");
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_log.Info("[MRM] Starting MRM");
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 8b7b470..5010a34 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -1,11 +1,12 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
- class SOPObject : IObject
+ class SOPObject : MarshalByRefObject, IObject
{
private readonly Scene m_rootScene;
private readonly uint m_localID;
--
cgit v1.1