aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting
diff options
context:
space:
mode:
authorAdam Frisby2009-04-03 09:22:34 +0000
committerAdam Frisby2009-04-03 09:22:34 +0000
commit7e91f41535e27d992cf85a46bed25b781367dcf1 (patch)
treedf10571e25be88239637d08efad9ea552e543997 /OpenSim/Region/OptionalModules/Scripting
parentfix an error in hollow cylinder face number calculation (diff)
downloadopensim-SC_OLD-7e91f41535e27d992cf85a46bed25b781367dcf1.zip
opensim-SC_OLD-7e91f41535e27d992cf85a46bed25b781367dcf1.tar.gz
opensim-SC_OLD-7e91f41535e27d992cf85a46bed25b781367dcf1.tar.bz2
opensim-SC_OLD-7e91f41535e27d992cf85a46bed25b781367dcf1.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs3
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs31
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs11
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs5
5 files changed, 45 insertions, 7 deletions
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 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections.Generic;
30using System.Reflection; 28using System.Reflection;
31using System.Text;
32using log4net; 29using log4net;
33 30
34namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 31namespace 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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
6{
7 interface IPersistence
8 {
9 Object Get(MRMBase state, Guid storageID);
10 Object Get(MRMBase state);
11
12 /// <summary>
13 /// Stores 'data' into the persistence system
14 /// associated with this object, however saved
15 /// under the ID 'storageID'. This data may
16 /// be accessed by other scripts however.
17 /// </summary>
18 /// <param name="state"></param>
19 /// <param name="storageID"></param>
20 /// <param name="data"></param>
21 void Put(MRMBase state, Guid storageID, Object data);
22
23 /// <summary>
24 /// Stores 'data' into the persistence system
25 /// using the default ID for this script.
26 /// </summary>
27 /// <param name="state"></param>
28 /// <param name="data"></param>
29 void Put(MRMBase state, Object data);
30 }
31}
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 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using OpenMetaverse;
29
28namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 30namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
29{ 31{
30 public abstract class MRMBase 32 public abstract class MRMBase
31 { 33 {
32 private IWorld m_world; 34 private IWorld m_world;
33 private IHost m_host; 35 private IHost m_host;
36 private UUID m_id;
34 37
35 public void InitMiniModule(IWorld world, IHost host) 38 public void InitMiniModule(IWorld world, IHost host, UUID uniqueID)
36 { 39 {
37 m_world = world; 40 m_world = world;
38 m_host = host; 41 m_host = host;
42 m_id = uniqueID;
39 } 43 }
40 44
41 protected IWorld World 45 protected IWorld World
@@ -48,6 +52,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
48 get { return m_host; } 52 get { return m_host; }
49 } 53 }
50 54
55 public UUID ID
56 {
57 get { return m_id; }
58 }
59
51 public abstract void Start(); 60 public abstract void Start();
52 public abstract void Stop(); 61 public abstract void Stop();
53 } 62 }
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
82 CompileFromDotNetText(script, itemID.ToString()), 82 CompileFromDotNetText(script, itemID.ToString()),
83 "OpenSim.MiniModule"); 83 "OpenSim.MiniModule");
84 m_log.Info("[MRM] Created MRM Instance"); 84 m_log.Info("[MRM] Created MRM Instance");
85 mmb.InitMiniModule(m_world, m_host); 85 mmb.InitMiniModule(m_world, m_host, itemID);
86 m_scripts[itemID] = mmb; 86 m_scripts[itemID] = mmb;
87 87
88 m_log.Info("[MRM] Starting MRM"); 88 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 @@
1using System.Collections.Generic; 1using System;
2using System.Collections.Generic;
2using OpenMetaverse; 3using OpenMetaverse;
3using OpenSim.Framework; 4using OpenSim.Framework;
4using OpenSim.Region.Framework.Scenes; 5using OpenSim.Region.Framework.Scenes;
5 6
6namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 7namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
7{ 8{
8 class SOPObject : IObject 9 class SOPObject : MarshalByRefObject, IObject
9 { 10 {
10 private readonly Scene m_rootScene; 11 private readonly Scene m_rootScene;
11 private readonly uint m_localID; 12 private readonly uint m_localID;