diff options
author | Adam Frisby | 2009-04-01 06:55:39 +0000 |
---|---|---|
committer | Adam Frisby | 2009-04-01 06:55:39 +0000 |
commit | 7eccad05c9623d9fe80c29d3e30a6511caf00531 (patch) | |
tree | ef277c7c73cc9b9367f021924977fd2c09980c9d /OpenSim/Region/OptionalModules/Scripting/Minimodule | |
parent | * Added NUnit tested utility function GetHashGuid() for future use. (diff) | |
download | opensim-SC_OLD-7eccad05c9623d9fe80c29d3e30a6511caf00531.zip opensim-SC_OLD-7eccad05c9623d9fe80c29d3e30a6511caf00531.tar.gz opensim-SC_OLD-7eccad05c9623d9fe80c29d3e30a6511caf00531.tar.bz2 opensim-SC_OLD-7eccad05c9623d9fe80c29d3e30a6511caf00531.tar.xz |
* Adds World.Avatars[] to MRM Scripting. Contains an enumerable array containing IAvatar instances for each avatar in the region.
* Adds Test/TestModule.cs which demonstrates a very quick and simple MRM Test.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule')
5 files changed, 73 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs index e979378..a500154 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs | |||
@@ -32,7 +32,7 @@ using OpenMetaverse; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
34 | { | 34 | { |
35 | interface IAvatar | 35 | public interface IAvatar |
36 | { | 36 | { |
37 | string Name { get; } | 37 | string Name { get; } |
38 | UUID GlobalID { get; } | 38 | UUID GlobalID { get; } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs index 63fdc74..bfa6b65 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs | |||
@@ -34,6 +34,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
34 | public interface IWorld | 34 | public interface IWorld |
35 | { | 35 | { |
36 | IObject[] Objects { get; } | 36 | IObject[] Objects { get; } |
37 | IAvatar[] Avatars { get; } | ||
37 | IHeightmap Terrain { get; } | 38 | IHeightmap Terrain { get; } |
38 | } | 39 | } |
39 | } | 40 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs new file mode 100644 index 0000000..6011e0b --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | using OpenMetaverse; | ||
2 | using OpenSim.Region.Framework.Scenes; | ||
3 | |||
4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
5 | { | ||
6 | class SPAvatar : IAvatar | ||
7 | { | ||
8 | private readonly Scene m_rootScene; | ||
9 | private readonly UUID m_ID; | ||
10 | |||
11 | public SPAvatar(Scene scene, UUID ID) | ||
12 | { | ||
13 | m_rootScene = scene; | ||
14 | m_ID = ID; | ||
15 | } | ||
16 | |||
17 | private ScenePresence GetSP() | ||
18 | { | ||
19 | return m_rootScene.GetScenePresence(m_ID); | ||
20 | } | ||
21 | |||
22 | public string Name | ||
23 | { | ||
24 | get { return GetSP().Name; } | ||
25 | } | ||
26 | |||
27 | public UUID GlobalID | ||
28 | { | ||
29 | get { return m_ID; } | ||
30 | } | ||
31 | |||
32 | public Vector3 Position | ||
33 | { | ||
34 | get { return GetSP().AbsolutePosition; } | ||
35 | } | ||
36 | } | ||
37 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs new file mode 100644 index 0000000..abbef0b --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs | |||
@@ -0,0 +1,17 @@ | |||
1 | using OpenSim.Region.OptionalModules.Scripting.Minimodule; | ||
2 | |||
3 | namespace OpenSim | ||
4 | { | ||
5 | class MiniModule : MRMBase | ||
6 | { | ||
7 | public override void Start() | ||
8 | { | ||
9 | Host.Console.Info("Hello World!"); | ||
10 | } | ||
11 | |||
12 | public override void Stop() | ||
13 | { | ||
14 | |||
15 | } | ||
16 | } | ||
17 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index cdefe16..4ba6778 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | |||
@@ -58,6 +58,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | public IAvatar[] Avatars | ||
62 | { | ||
63 | get | ||
64 | { | ||
65 | List<EntityBase> ents = m_internalScene.Entities.GetAllByType<ScenePresence>(); | ||
66 | IAvatar[] rets = new IAvatar[ents.Count]; | ||
67 | |||
68 | for (int i = 0; i < ents.Count; i++) | ||
69 | { | ||
70 | EntityBase ent = ents[i]; | ||
71 | rets[i] = new SPAvatar(m_internalScene, ent.UUID); | ||
72 | } | ||
73 | |||
74 | return rets; | ||
75 | } | ||
76 | } | ||
77 | |||
61 | public IHeightmap Terrain | 78 | public IHeightmap Terrain |
62 | { | 79 | { |
63 | get { return m_heights; } | 80 | get { return m_heights; } |