aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs')
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs302
1 files changed, 0 insertions, 302 deletions
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
deleted file mode 100644
index 8520d23..0000000
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
+++ /dev/null
@@ -1,302 +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 OpenSim 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.Reflection;
30using System.Text;
31using Axiom.Math;
32using log4net;
33using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes;
35using Key = libsecondlife.LLUUID;
36using Rotation = libsecondlife.LLQuaternion;
37using Vector = libsecondlife.LLVector3;
38using LSLList = System.Collections.Generic.List<string>;
39
40namespace OpenSim.Region.ExtensionsScriptModule
41{
42 /// <summary>
43 /// A class inteded to act as an API for LSL-styled interpreted languages
44 /// </summary>
45 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
46 internal class ScriptInterpretedAPI
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 protected Key m_object;
51 protected Scene m_scene;
52
53 /// <summary>
54 /// The scene in which this script is acting
55 /// </summary>
56 public Scene Scene
57 {
58 get { return m_scene; }
59 }
60
61 /// <summary>
62 /// The id of the object our script is supposed to be acting in
63 /// </summary>
64 public Key ObjectID
65 {
66 get { return m_object; }
67 }
68
69 /// <summary>
70 /// The object our script is supposed to be in
71 /// </summary>
72 public SceneObjectGroup Task
73 {
74 // XXX Casting not ideal, but previous Scene.Objects propery wasn't actually populated, so
75 // wouldn't have worked anyway.
76 get { return (SceneObjectGroup)Scene.Entities[ObjectID]; }
77 }
78
79 /// <summary>
80 /// Creates a new ScriptInterpretedAPI for a specified object
81 /// </summary>
82 /// <param name="world">The scene the object is located in</param>
83 /// <param name="member">The specific member being 'occupied' by the script</param>
84 public ScriptInterpretedAPI(Scene world, Key member)
85 {
86 m_scene = world;
87 m_object = member;
88 }
89
90 /// <summary>
91 /// Returns the absolute number of a integer value.
92 /// </summary>
93 /// <param name="val">Input</param>
94 /// <returns>Absolute number of input</returns>
95 public int osAbs(int val)
96 {
97 return Math.Abs(val);
98 }
99
100 public float osAcos(float val)
101 {
102 return (float) Math.Acos(val);
103 }
104
105 [Obsolete("Unimplemented")]
106 public void osAddToLandPassList(Key avatar, float hours)
107 {
108 Vector myPosition = Task.AbsolutePosition;
109 ILandObject myParcel = Scene.LandChannel.GetLandObject(myPosition.X, myPosition.Y);
110 if (myParcel == null)
111 {
112 //Dont do anything!
113 }
114 m_log.Warn("[script]: " +
115 "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
116 return;
117 }
118
119 [Obsolete("Unimplemented")]
120 public void osAdjustSoundVolume(float volume)
121 {
122 m_log.Warn("[script]: Unimplemented function called by script: osAdjustSoundVolume(float volume)");
123 return;
124 }
125
126 [Obsolete("Unimplemented")]
127 public void osAllowInventoryDrop(int add)
128 {
129 return;
130 }
131
132 [Obsolete("Unimplemented")]
133 public float osAngleBetween(Rotation a, Rotation b)
134 {
135 Quaternion axA = new Quaternion(a.W, a.X, a.Y, a.Z);
136 Quaternion axB = new Quaternion(b.W, b.X, b.Y, b.Z);
137
138 return 0;
139 }
140
141 [Obsolete("Unimplemented")]
142 public void osApplyImpulse(Vector force, int local)
143 {
144 return;
145 }
146
147 [Obsolete("Unimplemented")]
148 public void osApplyRotationalImpulse(Vector force, int local)
149 {
150 return;
151 }
152
153 public float osAsin(float val)
154 {
155 return (float) Math.Asin(val);
156 }
157
158 public float osAtan2(float x, float y)
159 {
160 return (float) Math.Atan2(x, y);
161 }
162
163 [Obsolete("Unimplemented")]
164 public void osAttachToAvatar(Key avatar, int attachmentPoint)
165 {
166 return;
167 }
168
169 [Obsolete("Unimplemented")]
170 public Key osAvatarOnSitTarget()
171 {
172 //TODO: Follow this as Children is chanced to be of type entity to support ScenePresences
173 /*
174 foreach (KeyValuePair<Key, EntityBase> Child in Task.Children)
175 {
176 if (Child.Value is ScenePresence)
177 {
178 return Child.Value.uuid;
179 }
180 }
181 */
182
183 return Key.Zero;
184 }
185
186 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
187 {
188 Quaternion axQ = new Quaternion();
189 Vector3 axFwd = new Vector3(fwd.X, fwd.Y, fwd.Z);
190 Vector3 axLeft = new Vector3(left.X, left.Y, left.Z);
191 Vector3 axUp = new Vector3(up.X, up.Y, up.Z);
192
193 axQ.FromAxes(axFwd, axLeft, axUp);
194
195 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
196 }
197
198 public Rotation osAxisAngle2Rot(Vector axis, float angle)
199 {
200 Quaternion axQ = Quaternion.FromAngleAxis(angle, new Vector3(axis.X, axis.Y, axis.Z));
201
202 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
203 }
204
205 public string osBase64ToString(string str)
206 {
207 Encoding enc = Encoding.UTF8;
208 return enc.GetString(Convert.FromBase64String(str));
209 }
210
211 [Obsolete("Unimplemented")]
212 public void osBreakAllLinks()
213 {
214 return;
215 }
216
217 [Obsolete("Unimplemented")]
218 public void osBreakLink()
219 {
220 return;
221 }
222
223 public LSLList osCSV2List(string src)
224 {
225 LSLList retVal = new LSLList();
226 retVal.AddRange(src.Split(','));
227
228 return retVal;
229 }
230
231 public int osCeil(float val)
232 {
233 return (int) Math.Ceiling(val);
234 }
235
236 [Obsolete("Unimplemented")]
237 public void osCloseRemoteDataChannel(Key channel)
238 {
239 return;
240 }
241
242 [Obsolete("Unimplemented")]
243 public float osCloud(Vector offset)
244 {
245 return 0.0f;
246 }
247
248 [Obsolete("Unimplemented")]
249 public void osCollisionFilter(string name, Key id, int accept)
250 {
251 return;
252 }
253
254 [Obsolete("Unimplemented")]
255 public void osCollisionSprite(string impact_sprite)
256 {
257 return;
258 }
259
260 public float osCos(float theta)
261 {
262 return (float) Math.Cos(theta);
263 }
264
265 public void osCreateLink(Key target, int parent)
266 {
267 if (Scene.Entities[target] is SceneObjectGroup)
268 Task.LinkToGroup((SceneObjectGroup) Scene.Entities[target]);
269
270 return;
271 }
272
273 [Obsolete("Partially Unimplemented")]
274 public LSLList osDeleteSubList(LSLList src, int start, int end)
275 {
276 if (start < 0 || end < 0)
277 {
278 throw new Exception("Unsupported at this time.");
279 }
280
281 src.RemoveRange(start, start - end + 1);
282 return src;
283 }
284
285 [Obsolete("Partially Unimplemented")]
286 public string osDeleteSubString(string src, int start, int end)
287 {
288 if (start < 0 || end < 0)
289 {
290 throw new Exception("Unsupported at this time.");
291 }
292
293 return src.Remove(start, start - end + 1);
294 }
295
296 [Obsolete("Unimplemented")]
297 public void osDetachFromAvatar(Key avatar)
298 {
299 return;
300 }
301 }
302}