aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
diff options
context:
space:
mode:
authorUbitUmarov2019-01-31 12:14:29 +0000
committerUbitUmarov2019-01-31 12:14:29 +0000
commit76b777b1fb385cba345b0f6d5454689fb68ce428 (patch)
treec5f898c2d7aaa8b17781550abeff4d203cdc108d /OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
parentcosmetics (diff)
downloadopensim-SC-76b777b1fb385cba345b0f6d5454689fb68ce428.zip
opensim-SC-76b777b1fb385cba345b0f6d5454689fb68ce428.tar.gz
opensim-SC-76b777b1fb385cba345b0f6d5454689fb68ce428.tar.bz2
opensim-SC-76b777b1fb385cba345b0f6d5454689fb68ce428.tar.xz
remove MRM module (minimodule). Its outdated and we have no maintainers. Thanks to all that worked on it. You should either use scripts or a full region module. Or revert this commit and update its code ;)
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs185
1 files changed, 0 insertions, 185 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
deleted file mode 100644
index 140264b..0000000
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
+++ /dev/null
@@ -1,185 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.Framework.Scenes;
34using IEnumerable=System.Collections.IEnumerable;
35
36namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
37{
38
39 internal class IObjEnum : System.MarshalByRefObject, IEnumerator<IObject>
40 {
41 private readonly Scene m_scene;
42 private readonly IEnumerator<EntityBase> m_sogEnum;
43 private readonly ISecurityCredential m_security;
44 private readonly List<EntityBase> m_entities;
45
46 public IObjEnum(Scene scene, ISecurityCredential security)
47 {
48 m_scene = scene;
49 m_security = security;
50 m_entities = new List<EntityBase>(m_scene.Entities.GetEntities());
51 m_sogEnum = m_entities.GetEnumerator();
52 }
53
54 public void Dispose()
55 {
56 m_sogEnum.Dispose();
57 }
58
59 public bool MoveNext()
60 {
61 return m_sogEnum.MoveNext();
62 }
63
64 public void Reset()
65 {
66 m_sogEnum.Reset();
67 }
68
69 public IObject Current
70 {
71 get
72 {
73 return new SOPObject(m_scene, m_sogEnum.Current.LocalId, m_security);
74 }
75 }
76
77 object IEnumerator.Current
78 {
79 get { return Current; }
80 }
81 }
82
83 public class ObjectAccessor : System.MarshalByRefObject, IObjectAccessor
84 {
85 private readonly Scene m_scene;
86 private readonly ISecurityCredential m_security;
87
88 public ObjectAccessor(Scene scene, ISecurityCredential security)
89 {
90 m_scene = scene;
91 m_security = security;
92 }
93
94 public IObject this[int index]
95 {
96 get
97 {
98 return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId, m_security);
99 }
100 }
101
102 public IObject this[uint index]
103 {
104 get
105 {
106 return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
107 }
108 }
109
110 public IObject this[UUID index]
111 {
112 get
113 {
114 return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
115 }
116 }
117
118 public IObject Create(Vector3 position)
119 {
120 return Create(position, Quaternion.Identity);
121 }
122
123 public IObject Create(Vector3 position, Quaternion rotation)
124 {
125
126 SceneObjectGroup sog = m_scene.AddNewPrim(m_security.owner.GlobalID,
127 UUID.Zero,
128 position,
129 rotation,
130 PrimitiveBaseShape.CreateBox());
131
132 IObject ret = new SOPObject(m_scene, sog.LocalId, m_security);
133
134 return ret;
135 }
136
137 public IEnumerator<IObject> GetEnumerator()
138 {
139 return new IObjEnum(m_scene, m_security);
140 }
141
142 IEnumerator IEnumerable.GetEnumerator()
143 {
144 return GetEnumerator();
145 }
146
147 public void Add(IObject item)
148 {
149 throw new NotSupportedException("Collection is read-only. This is an API TODO FIX, creation of objects is presently impossible.");
150 }
151
152 public void Clear()
153 {
154 throw new NotSupportedException("Collection is read-only. TODO FIX.");
155 }
156
157 public bool Contains(IObject item)
158 {
159 return m_scene.Entities.ContainsKey(item.LocalID);
160 }
161
162 public void CopyTo(IObject[] array, int arrayIndex)
163 {
164 for (int i = arrayIndex; i < Count + arrayIndex; i++)
165 {
166 array[i] = this[i - arrayIndex];
167 }
168 }
169
170 public bool Remove(IObject item)
171 {
172 throw new NotSupportedException("Collection is read-only. TODO FIX.");
173 }
174
175 public int Count
176 {
177 get { return m_scene.Entities.Count; }
178 }
179
180 public bool IsReadOnly
181 {
182 get { return true; }
183 }
184 }
185}