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