diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
4 files changed, 197 insertions, 197 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObjectAccessor.cs index feddf67..9ad042e 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObjectAccessor.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObjectAccessor.cs | |||
@@ -1,12 +1,12 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using OpenMetaverse; | 2 | using OpenMetaverse; |
3 | 3 | ||
4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
5 | { | 5 | { |
6 | public interface IObjectAccessor : ICollection<IObject> | 6 | public interface IObjectAccessor : ICollection<IObject> |
7 | { | 7 | { |
8 | IObject this[int index] { get; } | 8 | IObject this[int index] { get; } |
9 | IObject this[uint index] { get; } | 9 | IObject this[uint index] { get; } |
10 | IObject this[UUID index] { get; } | 10 | IObject this[UUID index] { get; } |
11 | } | 11 | } |
12 | } \ No newline at end of file | 12 | } \ No newline at end of file |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs index ad7182e..832050e 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs | |||
@@ -1,132 +1,132 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using OpenMetaverse; | 4 | using OpenMetaverse; |
5 | using OpenSim.Region.Framework.Scenes; | 5 | using OpenSim.Region.Framework.Scenes; |
6 | using IEnumerable=System.Collections.IEnumerable; | 6 | using IEnumerable=System.Collections.IEnumerable; |
7 | 7 | ||
8 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 8 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
9 | { | 9 | { |
10 | 10 | ||
11 | internal class IObjEnum : IEnumerator<IObject> | 11 | internal class IObjEnum : IEnumerator<IObject> |
12 | { | 12 | { |
13 | private readonly Scene m_scene; | 13 | private readonly Scene m_scene; |
14 | private readonly IEnumerator<EntityBase> m_sogEnum; | 14 | private readonly IEnumerator<EntityBase> m_sogEnum; |
15 | 15 | ||
16 | public IObjEnum(Scene scene) | 16 | public IObjEnum(Scene scene) |
17 | { | 17 | { |
18 | m_scene = scene; | 18 | m_scene = scene; |
19 | m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator(); | 19 | m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator(); |
20 | } | 20 | } |
21 | 21 | ||
22 | public void Dispose() | 22 | public void Dispose() |
23 | { | 23 | { |
24 | m_sogEnum.Dispose(); | 24 | m_sogEnum.Dispose(); |
25 | } | 25 | } |
26 | 26 | ||
27 | public bool MoveNext() | 27 | public bool MoveNext() |
28 | { | 28 | { |
29 | return m_sogEnum.MoveNext(); | 29 | return m_sogEnum.MoveNext(); |
30 | } | 30 | } |
31 | 31 | ||
32 | public void Reset() | 32 | public void Reset() |
33 | { | 33 | { |
34 | m_sogEnum.Reset(); | 34 | m_sogEnum.Reset(); |
35 | } | 35 | } |
36 | 36 | ||
37 | public IObject Current | 37 | public IObject Current |
38 | { | 38 | { |
39 | get | 39 | get |
40 | { | 40 | { |
41 | return new SOPObject(m_scene, m_sogEnum.Current.LocalId); | 41 | return new SOPObject(m_scene, m_sogEnum.Current.LocalId); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | 44 | ||
45 | object IEnumerator.Current | 45 | object IEnumerator.Current |
46 | { | 46 | { |
47 | get { return Current; } | 47 | get { return Current; } |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | public class ObjectAccessor : IObjectAccessor | 51 | public class ObjectAccessor : IObjectAccessor |
52 | { | 52 | { |
53 | private readonly Scene m_scene; | 53 | private readonly Scene m_scene; |
54 | 54 | ||
55 | public ObjectAccessor(Scene scene) | 55 | public ObjectAccessor(Scene scene) |
56 | { | 56 | { |
57 | m_scene = scene; | 57 | m_scene = scene; |
58 | } | 58 | } |
59 | 59 | ||
60 | public IObject this[int index] | 60 | public IObject this[int index] |
61 | { | 61 | { |
62 | get | 62 | get |
63 | { | 63 | { |
64 | return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId); | 64 | return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | public IObject this[uint index] | 68 | public IObject this[uint index] |
69 | { | 69 | { |
70 | get | 70 | get |
71 | { | 71 | { |
72 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId); | 72 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId); |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | public IObject this[UUID index] | 76 | public IObject this[UUID index] |
77 | { | 77 | { |
78 | get | 78 | get |
79 | { | 79 | { |
80 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId); | 80 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId); |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | public IEnumerator<IObject> GetEnumerator() | 84 | public IEnumerator<IObject> GetEnumerator() |
85 | { | 85 | { |
86 | return new IObjEnum(m_scene); | 86 | return new IObjEnum(m_scene); |
87 | } | 87 | } |
88 | 88 | ||
89 | IEnumerator IEnumerable.GetEnumerator() | 89 | IEnumerator IEnumerable.GetEnumerator() |
90 | { | 90 | { |
91 | return GetEnumerator(); | 91 | return GetEnumerator(); |
92 | } | 92 | } |
93 | 93 | ||
94 | public void Add(IObject item) | 94 | public void Add(IObject item) |
95 | { | 95 | { |
96 | throw new NotSupportedException("Collection is read-only. This is an API TODO FIX, creation of objects is presently impossible."); | 96 | throw new NotSupportedException("Collection is read-only. This is an API TODO FIX, creation of objects is presently impossible."); |
97 | } | 97 | } |
98 | 98 | ||
99 | public void Clear() | 99 | public void Clear() |
100 | { | 100 | { |
101 | throw new NotSupportedException("Collection is read-only. TODO FIX."); | 101 | throw new NotSupportedException("Collection is read-only. TODO FIX."); |
102 | } | 102 | } |
103 | 103 | ||
104 | public bool Contains(IObject item) | 104 | public bool Contains(IObject item) |
105 | { | 105 | { |
106 | return m_scene.Entities.ContainsKey(item.LocalID); | 106 | return m_scene.Entities.ContainsKey(item.LocalID); |
107 | } | 107 | } |
108 | 108 | ||
109 | public void CopyTo(IObject[] array, int arrayIndex) | 109 | public void CopyTo(IObject[] array, int arrayIndex) |
110 | { | 110 | { |
111 | for (int i = arrayIndex; i < Count + arrayIndex; i++) | 111 | for (int i = arrayIndex; i < Count + arrayIndex; i++) |
112 | { | 112 | { |
113 | array[i] = this[i - arrayIndex]; | 113 | array[i] = this[i - arrayIndex]; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | public bool Remove(IObject item) | 117 | public bool Remove(IObject item) |
118 | { | 118 | { |
119 | throw new NotSupportedException("Collection is read-only. TODO FIX."); | 119 | throw new NotSupportedException("Collection is read-only. TODO FIX."); |
120 | } | 120 | } |
121 | 121 | ||
122 | public int Count | 122 | public int Count |
123 | { | 123 | { |
124 | get { return m_scene.Entities.Count; } | 124 | get { return m_scene.Entities.Count; } |
125 | } | 125 | } |
126 | 126 | ||
127 | public bool IsReadOnly | 127 | public bool IsReadOnly |
128 | { | 128 | { |
129 | get { return true; } | 129 | get { return true; } |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index 6011e0b..03432bc 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs | |||
@@ -1,37 +1,37 @@ | |||
1 | using OpenMetaverse; | 1 | using OpenMetaverse; |
2 | using OpenSim.Region.Framework.Scenes; | 2 | using OpenSim.Region.Framework.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
5 | { | 5 | { |
6 | class SPAvatar : IAvatar | 6 | class SPAvatar : IAvatar |
7 | { | 7 | { |
8 | private readonly Scene m_rootScene; | 8 | private readonly Scene m_rootScene; |
9 | private readonly UUID m_ID; | 9 | private readonly UUID m_ID; |
10 | 10 | ||
11 | public SPAvatar(Scene scene, UUID ID) | 11 | public SPAvatar(Scene scene, UUID ID) |
12 | { | 12 | { |
13 | m_rootScene = scene; | 13 | m_rootScene = scene; |
14 | m_ID = ID; | 14 | m_ID = ID; |
15 | } | 15 | } |
16 | 16 | ||
17 | private ScenePresence GetSP() | 17 | private ScenePresence GetSP() |
18 | { | 18 | { |
19 | return m_rootScene.GetScenePresence(m_ID); | 19 | return m_rootScene.GetScenePresence(m_ID); |
20 | } | 20 | } |
21 | 21 | ||
22 | public string Name | 22 | public string Name |
23 | { | 23 | { |
24 | get { return GetSP().Name; } | 24 | get { return GetSP().Name; } |
25 | } | 25 | } |
26 | 26 | ||
27 | public UUID GlobalID | 27 | public UUID GlobalID |
28 | { | 28 | { |
29 | get { return m_ID; } | 29 | get { return m_ID; } |
30 | } | 30 | } |
31 | 31 | ||
32 | public Vector3 Position | 32 | public Vector3 Position |
33 | { | 33 | { |
34 | get { return GetSP().AbsolutePosition; } | 34 | get { return GetSP().AbsolutePosition; } |
35 | } | 35 | } |
36 | } | 36 | } |
37 | } | 37 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs index abbef0b..1e266ae 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs | |||
@@ -1,17 +1,17 @@ | |||
1 | using OpenSim.Region.OptionalModules.Scripting.Minimodule; | 1 | using OpenSim.Region.OptionalModules.Scripting.Minimodule; |
2 | 2 | ||
3 | namespace OpenSim | 3 | namespace OpenSim |
4 | { | 4 | { |
5 | class MiniModule : MRMBase | 5 | class MiniModule : MRMBase |
6 | { | 6 | { |
7 | public override void Start() | 7 | public override void Start() |
8 | { | 8 | { |
9 | Host.Console.Info("Hello World!"); | 9 | Host.Console.Info("Hello World!"); |
10 | } | 10 | } |
11 | 11 | ||
12 | public override void Stop() | 12 | public override void Stop() |
13 | { | 13 | { |
14 | 14 | ||
15 | } | 15 | } |
16 | } | 16 | } |
17 | } | 17 | } |