diff options
author | Adam Frisby | 2009-03-04 02:29:51 +0000 |
---|---|---|
committer | Adam Frisby | 2009-03-04 02:29:51 +0000 |
commit | 915b0f2448e6785c4031f664b98ea67ef1a90380 (patch) | |
tree | 54621aec67c1df38e538da5821618f81599e609a /OpenSim/Region/OptionalModules | |
parent | * Implementing some interfaces for aformentioned script engine. Ignore this. (diff) | |
download | opensim-SC-915b0f2448e6785c4031f664b98ea67ef1a90380.zip opensim-SC-915b0f2448e6785c4031f664b98ea67ef1a90380.tar.gz opensim-SC-915b0f2448e6785c4031f664b98ea67ef1a90380.tar.bz2 opensim-SC-915b0f2448e6785c4031f664b98ea67ef1a90380.tar.xz |
* More work on MiniRegionModule module.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
6 files changed, 243 insertions, 3 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs new file mode 100644 index 0000000..c75c6e7 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs | |||
@@ -0,0 +1,34 @@ | |||
1 | using OpenSim.Region.Framework.Scenes; | ||
2 | |||
3 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
4 | { | ||
5 | public class Heightmap : IHeightmap | ||
6 | { | ||
7 | private Scene m_scene; | ||
8 | |||
9 | public Heightmap(Scene scene) | ||
10 | { | ||
11 | m_scene = scene; | ||
12 | } | ||
13 | |||
14 | public int Height | ||
15 | { | ||
16 | get { return m_scene.Heightmap.Height; } | ||
17 | } | ||
18 | |||
19 | public int Width | ||
20 | { | ||
21 | get { return m_scene.Heightmap.Width; } | ||
22 | } | ||
23 | |||
24 | public double Get(int x, int y) | ||
25 | { | ||
26 | return m_scene.Heightmap[x, y]; | ||
27 | } | ||
28 | |||
29 | public void Set(int x, int y, double val) | ||
30 | { | ||
31 | m_scene.Heightmap[x, y] = val; | ||
32 | } | ||
33 | } | ||
34 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs index fd1cc3d..b4502a4 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs | |||
@@ -4,7 +4,7 @@ using System.Text; | |||
4 | 4 | ||
5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
6 | { | 6 | { |
7 | interface IHeightmap | 7 | public interface IHeightmap |
8 | { | 8 | { |
9 | int Height { get; } | 9 | int Height { get; } |
10 | int Width { get; } | 10 | int Width { get; } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs index 04d36a5..30b08b0 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs | |||
@@ -4,7 +4,7 @@ using OpenMetaverse; | |||
4 | 4 | ||
5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
6 | { | 6 | { |
7 | interface IObject | 7 | public interface IObject |
8 | { | 8 | { |
9 | bool Exists { get; } | 9 | bool Exists { get; } |
10 | uint LocalID { get; } | 10 | uint LocalID { get; } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs index 3ce7020..087f94f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs | |||
@@ -6,6 +6,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
6 | { | 6 | { |
7 | interface IWorld | 7 | interface IWorld |
8 | { | 8 | { |
9 | 9 | IObject[] Objects { get; } | |
10 | IHeightmap Terrain { get; } | ||
10 | } | 11 | } |
11 | } | 12 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs new file mode 100644 index 0000000..55b9767 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | |||
@@ -0,0 +1,166 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenMetaverse; | ||
5 | using OpenSim.Region.Framework.Scenes; | ||
6 | |||
7 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
8 | { | ||
9 | class SOPObject : IObject | ||
10 | { | ||
11 | private readonly Scene m_rootScene; | ||
12 | private readonly uint m_localID; | ||
13 | |||
14 | public SOPObject(Scene rootScene, uint localID) | ||
15 | { | ||
16 | m_rootScene = rootScene; | ||
17 | m_localID = localID; | ||
18 | } | ||
19 | |||
20 | private SceneObjectPart GetSOP() | ||
21 | { | ||
22 | if (m_rootScene.Entities.ContainsKey(m_localID)) | ||
23 | return ((SceneObjectGroup) m_rootScene.Entities[m_localID]).RootPart; | ||
24 | |||
25 | return null; | ||
26 | } | ||
27 | |||
28 | public bool Exists | ||
29 | { | ||
30 | get { return GetSOP() != null; } | ||
31 | } | ||
32 | |||
33 | public uint LocalID | ||
34 | { | ||
35 | get { return m_localID; } | ||
36 | } | ||
37 | |||
38 | public UUID GlobalID | ||
39 | { | ||
40 | get { return GetSOP().UUID; } | ||
41 | } | ||
42 | |||
43 | public IObject[] Children | ||
44 | { | ||
45 | get { throw new System.NotImplementedException(); } | ||
46 | } | ||
47 | |||
48 | public IObject Root | ||
49 | { | ||
50 | get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId); } | ||
51 | } | ||
52 | |||
53 | public IObjectFace[] Faces | ||
54 | { | ||
55 | get { throw new System.NotImplementedException(); } | ||
56 | } | ||
57 | |||
58 | public Vector3 Scale | ||
59 | { | ||
60 | get { throw new System.NotImplementedException(); } | ||
61 | set { throw new System.NotImplementedException(); } | ||
62 | } | ||
63 | |||
64 | public Quaternion Rotation | ||
65 | { | ||
66 | get { throw new System.NotImplementedException(); } | ||
67 | set { throw new System.NotImplementedException(); } | ||
68 | } | ||
69 | |||
70 | public Vector3 SitTarget | ||
71 | { | ||
72 | get { throw new System.NotImplementedException(); } | ||
73 | set { throw new System.NotImplementedException(); } | ||
74 | } | ||
75 | |||
76 | public string SitTargetText | ||
77 | { | ||
78 | get { throw new System.NotImplementedException(); } | ||
79 | set { throw new System.NotImplementedException(); } | ||
80 | } | ||
81 | |||
82 | public string TouchText | ||
83 | { | ||
84 | get { throw new System.NotImplementedException(); } | ||
85 | set { throw new System.NotImplementedException(); } | ||
86 | } | ||
87 | |||
88 | public string Text | ||
89 | { | ||
90 | get { throw new System.NotImplementedException(); } | ||
91 | set { throw new System.NotImplementedException(); } | ||
92 | } | ||
93 | |||
94 | public bool IsPhysical | ||
95 | { | ||
96 | get { throw new System.NotImplementedException(); } | ||
97 | set { throw new System.NotImplementedException(); } | ||
98 | } | ||
99 | |||
100 | public bool IsPhantom | ||
101 | { | ||
102 | get { throw new System.NotImplementedException(); } | ||
103 | set { throw new System.NotImplementedException(); } | ||
104 | } | ||
105 | |||
106 | public bool IsRotationLockedX | ||
107 | { | ||
108 | get { throw new System.NotImplementedException(); } | ||
109 | set { throw new System.NotImplementedException(); } | ||
110 | } | ||
111 | |||
112 | public bool IsRotationLockedY | ||
113 | { | ||
114 | get { throw new System.NotImplementedException(); } | ||
115 | set { throw new System.NotImplementedException(); } | ||
116 | } | ||
117 | |||
118 | public bool IsRotationLockedZ | ||
119 | { | ||
120 | get { throw new System.NotImplementedException(); } | ||
121 | set { throw new System.NotImplementedException(); } | ||
122 | } | ||
123 | |||
124 | public bool IsSandboxed | ||
125 | { | ||
126 | get { throw new System.NotImplementedException(); } | ||
127 | set { throw new System.NotImplementedException(); } | ||
128 | } | ||
129 | |||
130 | public bool IsImmotile | ||
131 | { | ||
132 | get { throw new System.NotImplementedException(); } | ||
133 | set { throw new System.NotImplementedException(); } | ||
134 | } | ||
135 | |||
136 | public bool IsAlwaysReturned | ||
137 | { | ||
138 | get { throw new System.NotImplementedException(); } | ||
139 | set { throw new System.NotImplementedException(); } | ||
140 | } | ||
141 | |||
142 | public bool IsTemporary | ||
143 | { | ||
144 | get { throw new System.NotImplementedException(); } | ||
145 | set { throw new System.NotImplementedException(); } | ||
146 | } | ||
147 | |||
148 | public bool IsFlexible | ||
149 | { | ||
150 | get { throw new System.NotImplementedException(); } | ||
151 | set { throw new System.NotImplementedException(); } | ||
152 | } | ||
153 | |||
154 | public PrimType PrimShape | ||
155 | { | ||
156 | get { throw new System.NotImplementedException(); } | ||
157 | set { throw new System.NotImplementedException(); } | ||
158 | } | ||
159 | |||
160 | public Material Material | ||
161 | { | ||
162 | get { throw new System.NotImplementedException(); } | ||
163 | set { throw new System.NotImplementedException(); } | ||
164 | } | ||
165 | } | ||
166 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs new file mode 100644 index 0000000..6c7f854 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | |||
@@ -0,0 +1,39 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using OpenSim.Region.Framework.Scenes; | ||
3 | |||
4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
5 | { | ||
6 | public class World : IWorld | ||
7 | { | ||
8 | private readonly Scene m_internalScene; | ||
9 | private readonly Heightmap m_heights; | ||
10 | |||
11 | public World(Scene internalScene) | ||
12 | { | ||
13 | m_internalScene = internalScene; | ||
14 | m_heights = new Heightmap(m_internalScene); | ||
15 | } | ||
16 | |||
17 | public IObject[] Objects | ||
18 | { | ||
19 | get | ||
20 | { | ||
21 | List<EntityBase> ents = m_internalScene.Entities.GetAllByType<SceneObjectGroup>(); | ||
22 | IObject[] rets = new IObject[ents.Count]; | ||
23 | |||
24 | for (int i = 0; i < ents.Count; i++) | ||
25 | { | ||
26 | EntityBase ent = ents[i]; | ||
27 | rets[i] = new SOPObject(m_internalScene, ent.LocalId); | ||
28 | } | ||
29 | |||
30 | return rets; | ||
31 | } | ||
32 | } | ||
33 | |||
34 | public IHeightmap Terrain | ||
35 | { | ||
36 | get { return m_heights; } | ||
37 | } | ||
38 | } | ||
39 | } | ||