diff options
author | Tedd Hansen | 2008-09-17 16:46:23 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-09-17 16:46:23 +0000 |
commit | e94d6f12eeb3bd84a752fc401847b4c25d39cdac (patch) | |
tree | a4d4f1d91df2f2dd2d6fc715c7b8e9bb241f5784 /OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API | |
parent | * SSL Documentation update from Lexa (diff) | |
download | opensim-SC-e94d6f12eeb3bd84a752fc401847b4c25d39cdac.zip opensim-SC-e94d6f12eeb3bd84a752fc401847b4c25d39cdac.tar.gz opensim-SC-e94d6f12eeb3bd84a752fc401847b4c25d39cdac.tar.bz2 opensim-SC-e94d6f12eeb3bd84a752fc401847b4c25d39cdac.tar.xz |
More ScriptEngine cleanup
Diffstat (limited to 'OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API')
-rw-r--r-- | OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | 2290 |
1 files changed, 0 insertions, 2290 deletions
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs deleted file mode 100644 index 9cd3fb1..0000000 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ /dev/null | |||
@@ -1,2290 +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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Runtime.Remoting.Lifetime; | ||
31 | using System.Text; | ||
32 | using System.Threading; | ||
33 | using Axiom.Math; | ||
34 | using libsecondlife; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; | ||
37 | using OpenSim.Region.Environment.Interfaces; | ||
38 | using OpenSim.Region.Environment.Scenes; | ||
39 | using OpenSim.Region.ScriptEngine.Common; | ||
40 | |||
41 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler | ||
42 | { | ||
43 | // | ||
44 | // !!!IMPORTANT!!! | ||
45 | // | ||
46 | // REMEMBER TO UPDATE http://opensimulator.org/wiki/LSL_Status | ||
47 | // | ||
48 | |||
49 | /// <summary> | ||
50 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. | ||
51 | /// </summary> | ||
52 | public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface | ||
53 | { | ||
54 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | |||
56 | private ASCIIEncoding enc = new ASCIIEncoding(); | ||
57 | private ScriptEngine m_ScriptEngine; | ||
58 | private SceneObjectPart m_host; | ||
59 | private uint m_localID; | ||
60 | private LLUUID m_itemID; | ||
61 | private bool throwErrorOnNotImplemented = true; | ||
62 | |||
63 | |||
64 | public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) | ||
65 | { | ||
66 | m_ScriptEngine = ScriptEngine; | ||
67 | m_host = host; | ||
68 | m_localID = localID; | ||
69 | m_itemID = itemID; | ||
70 | |||
71 | |||
72 | //m_log.Info("[ScriptEngine]: LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); | ||
73 | } | ||
74 | |||
75 | |||
76 | private string m_state = "default"; | ||
77 | |||
78 | public string State() | ||
79 | { | ||
80 | return m_state; | ||
81 | } | ||
82 | |||
83 | // Object never expires | ||
84 | public override Object InitializeLifetimeService() | ||
85 | { | ||
86 | //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); | ||
87 | // return null; | ||
88 | ILease lease = (ILease) base.InitializeLifetimeService(); | ||
89 | |||
90 | if (lease.CurrentState == LeaseState.Initial) | ||
91 | { | ||
92 | lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); | ||
93 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); | ||
94 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(2); | ||
95 | } | ||
96 | return lease; | ||
97 | } | ||
98 | |||
99 | |||
100 | public Scene World | ||
101 | { | ||
102 | get { return m_ScriptEngine.World; } | ||
103 | } | ||
104 | |||
105 | //These are the implementations of the various ll-functions used by the LSL scripts. | ||
106 | //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 | ||
107 | public double llSin(double f) | ||
108 | { | ||
109 | return (double) Math.Sin(f); | ||
110 | } | ||
111 | |||
112 | public double llCos(double f) | ||
113 | { | ||
114 | return (double) Math.Cos(f); | ||
115 | } | ||
116 | |||
117 | public double llTan(double f) | ||
118 | { | ||
119 | return (double) Math.Tan(f); | ||
120 | } | ||
121 | |||
122 | public double llAtan2(double x, double y) | ||
123 | { | ||
124 | return (double) Math.Atan2(y, x); | ||
125 | } | ||
126 | |||
127 | public double llSqrt(double f) | ||
128 | { | ||
129 | return (double) Math.Sqrt(f); | ||
130 | } | ||
131 | |||
132 | public double llPow(double fbase, double fexponent) | ||
133 | { | ||
134 | return (double) Math.Pow(fbase, fexponent); | ||
135 | } | ||
136 | |||
137 | public int llAbs(int i) | ||
138 | { | ||
139 | return (int) Math.Abs(i); | ||
140 | } | ||
141 | |||
142 | public double llFabs(double f) | ||
143 | { | ||
144 | return (double) Math.Abs(f); | ||
145 | } | ||
146 | |||
147 | public double llFrand(double mag) | ||
148 | { | ||
149 | lock (Util.RandomClass) | ||
150 | { | ||
151 | return Util.RandomClass.Next((int) mag); | ||
152 | } | ||
153 | } | ||
154 | |||
155 | public int llFloor(double f) | ||
156 | { | ||
157 | return (int) Math.Floor(f); | ||
158 | } | ||
159 | |||
160 | public int llCeil(double f) | ||
161 | { | ||
162 | return (int) Math.Ceiling(f); | ||
163 | } | ||
164 | |||
165 | public int llRound(double f) | ||
166 | { | ||
167 | return (int) Math.Round(f, 3); | ||
168 | } | ||
169 | |||
170 | //This next group are vector operations involving squaring and square root. ckrinke | ||
171 | public double llVecMag(LSL_Types.Vector3 v) | ||
172 | { | ||
173 | return (v.X*v.X + v.Y*v.Y + v.Z*v.Z); | ||
174 | } | ||
175 | |||
176 | public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) | ||
177 | { | ||
178 | double mag = v.X*v.X + v.Y*v.Y + v.Z*v.Z; | ||
179 | LSL_Types.Vector3 nor = new LSL_Types.Vector3(); | ||
180 | nor.X = v.X/mag; | ||
181 | nor.Y = v.Y/mag; | ||
182 | nor.Z = v.Z/mag; | ||
183 | return nor; | ||
184 | } | ||
185 | |||
186 | public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) | ||
187 | { | ||
188 | double dx = a.X - b.X; | ||
189 | double dy = a.Y - b.Y; | ||
190 | double dz = a.Z - b.Z; | ||
191 | return Math.Sqrt(dx*dx + dy*dy + dz*dz); | ||
192 | } | ||
193 | |||
194 | //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke | ||
195 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) | ||
196 | { | ||
197 | //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke | ||
198 | LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X*r.X, r.Y*r.Y, r.Z*r.Z, r.R*r.R); | ||
199 | double m = (t.X + t.Y + t.Z + t.R); | ||
200 | if (m == 0) return new LSL_Types.Vector3(); | ||
201 | double n = 2*(r.Y*r.R + r.X*r.Z); | ||
202 | double p = m*m - n*n; | ||
203 | if (p > 0) | ||
204 | return new LSL_Types.Vector3(Math.Atan2(2.0*(r.X*r.R - r.Y*r.Z), (-t.X - t.Y + t.Z + t.R)), | ||
205 | Math.Atan2(n, Math.Sqrt(p)), | ||
206 | Math.Atan2(2.0*(r.Z*r.R - r.X*r.Y), (t.X - t.Y - t.Z + t.R))); | ||
207 | else if (n > 0) | ||
208 | return new LSL_Types.Vector3(0.0, Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z)); | ||
209 | else | ||
210 | return new LSL_Types.Vector3(0.0, -Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z)); | ||
211 | } | ||
212 | |||
213 | public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) | ||
214 | { | ||
215 | //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 | ||
216 | float err = 0.00001f; | ||
217 | double ax = Math.Sin(v.X/2); | ||
218 | double aw = Math.Cos(v.X/2); | ||
219 | double by = Math.Sin(v.Y/2); | ||
220 | double bw = Math.Cos(v.Y/2); | ||
221 | double cz = Math.Sin(v.Z/2); | ||
222 | double cw = Math.Cos(v.Z/2); | ||
223 | LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); | ||
224 | LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); | ||
225 | LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); | ||
226 | LSL_Types.Quaternion a = new LSL_Types.Quaternion(); | ||
227 | //This multiplication doesn't compile, yet. a = a1 * a2 * a3; | ||
228 | LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz, | ||
229 | aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw, | ||
230 | aw*bw*cw - ax*by*cz); | ||
231 | LSL_Types.Quaternion c = new LSL_Types.Quaternion(); | ||
232 | //This addition doesn't compile yet c = a + b; | ||
233 | LSL_Types.Quaternion d = new LSL_Types.Quaternion(); | ||
234 | //This addition doesn't compile yet d = a - b; | ||
235 | if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) || | ||
236 | (Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) || | ||
237 | (Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) || | ||
238 | (Math.Abs(c.R) > err && Math.Abs(d.R) > err)) | ||
239 | { | ||
240 | //return a new Quaternion that is null until I figure this out | ||
241 | // return b; | ||
242 | // return a; | ||
243 | } | ||
244 | return new LSL_Types.Quaternion(); | ||
245 | } | ||
246 | |||
247 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) | ||
248 | { | ||
249 | return new LSL_Types.Quaternion(); | ||
250 | } | ||
251 | |||
252 | public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) | ||
253 | { | ||
254 | return new LSL_Types.Vector3(); | ||
255 | } | ||
256 | |||
257 | public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) | ||
258 | { | ||
259 | return new LSL_Types.Vector3(); | ||
260 | } | ||
261 | |||
262 | public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) | ||
263 | { | ||
264 | return new LSL_Types.Vector3(); | ||
265 | } | ||
266 | |||
267 | public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) | ||
268 | { | ||
269 | return new LSL_Types.Quaternion(); | ||
270 | } | ||
271 | |||
272 | public void llWhisper(int channelID, string text) | ||
273 | { | ||
274 | World.SimChat(Helpers.StringToField(text), | ||
275 | ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, | ||
276 | m_host.Name, m_host.UUID, false); | ||
277 | } | ||
278 | |||
279 | public void llSay(int channelID, string text) | ||
280 | { | ||
281 | World.SimChat(Helpers.StringToField(text), | ||
282 | ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, | ||
283 | m_host.Name, m_host.UUID, false); | ||
284 | } | ||
285 | |||
286 | public void llShout(int channelID, string text) | ||
287 | { | ||
288 | World.SimChat(Helpers.StringToField(text), | ||
289 | ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, | ||
290 | m_host.Name, m_host.UUID, false); | ||
291 | } | ||
292 | |||
293 | public void llOwnerSay(string msg) | ||
294 | { | ||
295 | World.SimChatBroadcast(Helpers.StringToField(text), | ||
296 | ChatTypeEnum.Owner, 0, m_host.AbsolutePosition, | ||
297 | m_host.Name, m_host.UUID, false); | ||
298 | } | ||
299 | |||
300 | public int llListen(int channelID, string name, string ID, string msg) | ||
301 | { | ||
302 | NotImplemented("llListen"); | ||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | public void llListenControl(int number, int active) | ||
307 | { | ||
308 | NotImplemented("llListenControl"); | ||
309 | return; | ||
310 | } | ||
311 | |||
312 | public void llListenRemove(int number) | ||
313 | { | ||
314 | NotImplemented("llListenRemove"); | ||
315 | return; | ||
316 | } | ||
317 | |||
318 | public void llSensor(string name, string id, int type, double range, double arc) | ||
319 | { | ||
320 | NotImplemented("llSensor"); | ||
321 | return; | ||
322 | } | ||
323 | |||
324 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) | ||
325 | { | ||
326 | NotImplemented("llSensorRepeat"); | ||
327 | return; | ||
328 | } | ||
329 | |||
330 | public void llSensorRemove() | ||
331 | { | ||
332 | NotImplemented("llSensorRemove"); | ||
333 | return; | ||
334 | } | ||
335 | |||
336 | public string llDetectedName(int number) | ||
337 | { | ||
338 | NotImplemented("llDetectedName"); | ||
339 | return ""; | ||
340 | } | ||
341 | |||
342 | public string llDetectedKey(int number) | ||
343 | { | ||
344 | NotImplemented("llDetectedKey"); | ||
345 | return ""; | ||
346 | } | ||
347 | |||
348 | public string llDetectedOwner(int number) | ||
349 | { | ||
350 | NotImplemented("llDetectedOwner"); | ||
351 | return ""; | ||
352 | } | ||
353 | |||
354 | public int llDetectedType(int number) | ||
355 | { | ||
356 | NotImplemented("llDetectedType"); | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | public LSL_Types.Vector3 llDetectedPos(int number) | ||
361 | { | ||
362 | NotImplemented("llDetectedPos"); | ||
363 | return new LSL_Types.Vector3(); | ||
364 | } | ||
365 | |||
366 | public LSL_Types.Vector3 llDetectedVel(int number) | ||
367 | { | ||
368 | NotImplemented("llDetectedVel"); | ||
369 | return new LSL_Types.Vector3(); | ||
370 | } | ||
371 | |||
372 | public LSL_Types.Vector3 llDetectedGrab(int number) | ||
373 | { | ||
374 | NotImplemented("llDetectedGrab"); | ||
375 | return new LSL_Types.Vector3(); | ||
376 | } | ||
377 | |||
378 | public LSL_Types.Quaternion llDetectedRot(int number) | ||
379 | { | ||
380 | NotImplemented("llDetectedRot"); | ||
381 | return new LSL_Types.Quaternion(); | ||
382 | } | ||
383 | |||
384 | public int llDetectedGroup(int number) | ||
385 | { | ||
386 | NotImplemented("llDetectedGroup"); | ||
387 | return 0; | ||
388 | } | ||
389 | |||
390 | public int llDetectedLinkNumber(int number) | ||
391 | { | ||
392 | NotImplemented("llDetectedLinkNumber"); | ||
393 | return 0; | ||
394 | } | ||
395 | |||
396 | public void llDie() | ||
397 | { | ||
398 | NotImplemented("llDie"); | ||
399 | return; | ||
400 | } | ||
401 | |||
402 | public double llGround(LSL_Types.Vector3 offset) | ||
403 | { | ||
404 | NotImplemented("llGround"); | ||
405 | return 0; | ||
406 | } | ||
407 | |||
408 | public double llCloud(LSL_Types.Vector3 offset) | ||
409 | { | ||
410 | NotImplemented("llCloud"); | ||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) | ||
415 | { | ||
416 | NotImplemented("llWind"); | ||
417 | return new LSL_Types.Vector3(); | ||
418 | } | ||
419 | |||
420 | public void llSetStatus(int status, int value) | ||
421 | { | ||
422 | NotImplemented("llSetStatus"); | ||
423 | return; | ||
424 | } | ||
425 | |||
426 | public int llGetStatus(int status) | ||
427 | { | ||
428 | NotImplemented("llGetStatus"); | ||
429 | return 0; | ||
430 | } | ||
431 | |||
432 | public void llSetScale(LSL_Types.Vector3 scale) | ||
433 | { | ||
434 | // TODO: this needs to trigger a persistance save as well | ||
435 | LLVector3 tmp = m_host.Scale; | ||
436 | tmp.X = (float) scale.X; | ||
437 | tmp.Y = (float) scale.Y; | ||
438 | tmp.Z = (float) scale.Z; | ||
439 | m_host.Scale = tmp; | ||
440 | return; | ||
441 | } | ||
442 | |||
443 | public LSL_Types.Vector3 llGetScale() | ||
444 | { | ||
445 | return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); | ||
446 | } | ||
447 | |||
448 | public void llSetColor(LSL_Types.Vector3 color, int face) | ||
449 | { | ||
450 | NotImplemented("llSetColor"); | ||
451 | return; | ||
452 | } | ||
453 | |||
454 | public double llGetAlpha(int face) | ||
455 | { | ||
456 | NotImplemented("llGetAlpha"); | ||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | public void llSetAlpha(double alpha, int face) | ||
461 | { | ||
462 | NotImplemented("llSetAlpha"); | ||
463 | return; | ||
464 | } | ||
465 | |||
466 | public LSL_Types.Vector3 llGetColor(int face) | ||
467 | { | ||
468 | NotImplemented("llGetColor"); | ||
469 | return new LSL_Types.Vector3(); | ||
470 | } | ||
471 | |||
472 | public void llSetTexture(string texture, int face) | ||
473 | { | ||
474 | NotImplemented("llSetTexture"); | ||
475 | return; | ||
476 | } | ||
477 | |||
478 | public void llScaleTexture(double u, double v, int face) | ||
479 | { | ||
480 | NotImplemented("llScaleTexture"); | ||
481 | return; | ||
482 | } | ||
483 | |||
484 | public void llOffsetTexture(double u, double v, int face) | ||
485 | { | ||
486 | NotImplemented("llOffsetTexture"); | ||
487 | return; | ||
488 | } | ||
489 | |||
490 | public void llRotateTexture(double rotation, int face) | ||
491 | { | ||
492 | NotImplemented("llRotateTexture"); | ||
493 | return; | ||
494 | } | ||
495 | |||
496 | public string llGetTexture(int face) | ||
497 | { | ||
498 | NotImplemented("llGetTexture"); | ||
499 | return ""; | ||
500 | } | ||
501 | |||
502 | public void llSetPos(LSL_Types.Vector3 pos) | ||
503 | { | ||
504 | if (m_host.ParentID != 0) | ||
505 | { | ||
506 | m_host.UpdateOffSet(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z)); | ||
507 | } | ||
508 | else | ||
509 | { | ||
510 | m_host.UpdateGroupPosition(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z)); | ||
511 | } | ||
512 | } | ||
513 | |||
514 | public LSL_Types.Vector3 llGetPos() | ||
515 | { | ||
516 | return new LSL_Types.Vector3(m_host.AbsolutePosition.X, | ||
517 | m_host.AbsolutePosition.Y, | ||
518 | m_host.AbsolutePosition.Z); | ||
519 | } | ||
520 | |||
521 | public LSL_Types.Vector3 llGetLocalPos() | ||
522 | { | ||
523 | if (m_host.ParentID != 0) | ||
524 | { | ||
525 | return new LSL_Types.Vector3(m_host.OffsetPosition.X, | ||
526 | m_host.OffsetPosition.Y, | ||
527 | m_host.OffsetPosition.Z); | ||
528 | } | ||
529 | else | ||
530 | { | ||
531 | return new LSL_Types.Vector3(m_host.AbsolutePosition.X, | ||
532 | m_host.AbsolutePosition.Y, | ||
533 | m_host.AbsolutePosition.Z); | ||
534 | } | ||
535 | } | ||
536 | |||
537 | public void llSetRot(LSL_Types.Quaternion rot) | ||
538 | { | ||
539 | m_host.UpdateRotation(new LLQuaternion((float) rot.X, (float) rot.Y, (float) rot.Z, (float) rot.R)); | ||
540 | } | ||
541 | |||
542 | public LSL_Types.Quaternion llGetRot() | ||
543 | { | ||
544 | LLQuaternion q = m_host.RotationOffset; | ||
545 | return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); | ||
546 | } | ||
547 | |||
548 | public LSL_Types.Quaternion llGetLocalRot() | ||
549 | { | ||
550 | NotImplemented("llGetLocalRot"); | ||
551 | return new LSL_Types.Quaternion(); | ||
552 | } | ||
553 | |||
554 | public void llSetForce(LSL_Types.Vector3 force, int local) | ||
555 | { | ||
556 | NotImplemented("llSetForce"); | ||
557 | } | ||
558 | |||
559 | public LSL_Types.Vector3 llGetForce() | ||
560 | { | ||
561 | NotImplemented("llGetForce"); | ||
562 | return new LSL_Types.Vector3(); | ||
563 | } | ||
564 | |||
565 | public int llTarget(LSL_Types.Vector3 position, double range) | ||
566 | { | ||
567 | NotImplemented("llTarget"); | ||
568 | return 0; | ||
569 | } | ||
570 | |||
571 | public void llTargetRemove(int number) | ||
572 | { | ||
573 | NotImplemented("llTargetRemove"); | ||
574 | } | ||
575 | |||
576 | public int llRotTarget(LSL_Types.Quaternion rot, double error) | ||
577 | { | ||
578 | NotImplemented("llRotTarget"); | ||
579 | return 0; | ||
580 | } | ||
581 | |||
582 | public void llRotTargetRemove(int number) | ||
583 | { | ||
584 | NotImplemented("llRotTargetRemove"); | ||
585 | } | ||
586 | |||
587 | public void llMoveToTarget(LSL_Types.Vector3 target, double tau) | ||
588 | { | ||
589 | NotImplemented("llMoveToTarget"); | ||
590 | } | ||
591 | |||
592 | public void llStopMoveToTarget() | ||
593 | { | ||
594 | NotImplemented("llStopMoveToTarget"); | ||
595 | } | ||
596 | |||
597 | public void llApplyImpulse(LSL_Types.Vector3 force, int local) | ||
598 | { | ||
599 | NotImplemented("llApplyImpulse"); | ||
600 | } | ||
601 | |||
602 | public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) | ||
603 | { | ||
604 | NotImplemented("llApplyRotationalImpulse"); | ||
605 | } | ||
606 | |||
607 | public void llSetTorque(LSL_Types.Vector3 torque, int local) | ||
608 | { | ||
609 | NotImplemented("llSetTorque"); | ||
610 | } | ||
611 | |||
612 | public LSL_Types.Vector3 llGetTorque() | ||
613 | { | ||
614 | NotImplemented("llGetTorque"); | ||
615 | return new LSL_Types.Vector3(); | ||
616 | } | ||
617 | |||
618 | public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) | ||
619 | { | ||
620 | NotImplemented("llSetForceAndTorque"); | ||
621 | } | ||
622 | |||
623 | public LSL_Types.Vector3 llGetVel() | ||
624 | { | ||
625 | NotImplemented("llGetVel"); | ||
626 | return new LSL_Types.Vector3(); | ||
627 | } | ||
628 | |||
629 | public LSL_Types.Vector3 llGetAccel() | ||
630 | { | ||
631 | NotImplemented("llGetAccel"); | ||
632 | return new LSL_Types.Vector3(); | ||
633 | } | ||
634 | |||
635 | public LSL_Types.Vector3 llGetOmega() | ||
636 | { | ||
637 | NotImplemented("llGetOmega"); | ||
638 | return new LSL_Types.Vector3(); | ||
639 | } | ||
640 | |||
641 | public double llGetTimeOfDay() | ||
642 | { | ||
643 | NotImplemented("llGetTimeOfDay"); | ||
644 | return 0; | ||
645 | } | ||
646 | |||
647 | public double llGetWallclock() | ||
648 | { | ||
649 | return DateTime.Now.TimeOfDay.TotalSeconds; | ||
650 | } | ||
651 | |||
652 | public double llGetTime() | ||
653 | { | ||
654 | NotImplemented("llGetTime"); | ||
655 | return 0; | ||
656 | } | ||
657 | |||
658 | public void llResetTime() | ||
659 | { | ||
660 | NotImplemented("llResetTime"); | ||
661 | } | ||
662 | |||
663 | public double llGetAndResetTime() | ||
664 | { | ||
665 | NotImplemented("llGetAndResetTime"); | ||
666 | return 0; | ||
667 | } | ||
668 | |||
669 | public void llSound() | ||
670 | { | ||
671 | NotImplemented("llSound"); | ||
672 | } | ||
673 | |||
674 | public void llPlaySound(string sound, double volume) | ||
675 | { | ||
676 | NotImplemented("llPlaySound"); | ||
677 | } | ||
678 | |||
679 | public void llLoopSound(string sound, double volume) | ||
680 | { | ||
681 | NotImplemented("llLoopSound"); | ||
682 | } | ||
683 | |||
684 | public void llLoopSoundMaster(string sound, double volume) | ||
685 | { | ||
686 | NotImplemented("llLoopSoundMaster"); | ||
687 | } | ||
688 | |||
689 | public void llLoopSoundSlave(string sound, double volume) | ||
690 | { | ||
691 | NotImplemented("llLoopSoundSlave"); | ||
692 | } | ||
693 | |||
694 | public void llPlaySoundSlave(string sound, double volume) | ||
695 | { | ||
696 | NotImplemented("llPlaySoundSlave"); | ||
697 | } | ||
698 | |||
699 | public void llTriggerSound(string sound, double volume) | ||
700 | { | ||
701 | NotImplemented("llTriggerSound"); | ||
702 | } | ||
703 | |||
704 | public void llStopSound() | ||
705 | { | ||
706 | NotImplemented("llStopSound"); | ||
707 | } | ||
708 | |||
709 | public void llPreloadSound(string sound) | ||
710 | { | ||
711 | NotImplemented("llPreloadSound"); | ||
712 | } | ||
713 | |||
714 | public string llGetSubString(string src, int start, int end) | ||
715 | { | ||
716 | return src.Substring(start, end); | ||
717 | } | ||
718 | |||
719 | public string llDeleteSubString(string src, int start, int end) | ||
720 | { | ||
721 | return src.Remove(start, end - start); | ||
722 | } | ||
723 | |||
724 | public string llInsertString(string dst, int position, string src) | ||
725 | { | ||
726 | return dst.Insert(position, src); | ||
727 | } | ||
728 | |||
729 | public string llToUpper(string src) | ||
730 | { | ||
731 | return src.ToUpper(); | ||
732 | } | ||
733 | |||
734 | public string llToLower(string src) | ||
735 | { | ||
736 | return src.ToLower(); | ||
737 | } | ||
738 | |||
739 | public int llGiveMoney(string destination, int amount) | ||
740 | { | ||
741 | NotImplemented("llGiveMoney"); | ||
742 | return 0; | ||
743 | } | ||
744 | |||
745 | public void llMakeExplosion() | ||
746 | { | ||
747 | NotImplemented("llMakeExplosion"); | ||
748 | } | ||
749 | |||
750 | public void llMakeFountain() | ||
751 | { | ||
752 | NotImplemented("llMakeFountain"); | ||
753 | } | ||
754 | |||
755 | public void llMakeSmoke() | ||
756 | { | ||
757 | NotImplemented("llMakeSmoke"); | ||
758 | } | ||
759 | |||
760 | public void llMakeFire() | ||
761 | { | ||
762 | NotImplemented("llMakeFire"); | ||
763 | } | ||
764 | |||
765 | public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) | ||
766 | { | ||
767 | NotImplemented("llRezObject"); | ||
768 | } | ||
769 | |||
770 | public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) | ||
771 | { | ||
772 | NotImplemented("llLookAt"); | ||
773 | } | ||
774 | |||
775 | public void llStopLookAt() | ||
776 | { | ||
777 | NotImplemented("llStopLookAt"); | ||
778 | } | ||
779 | |||
780 | public void llSetTimerEvent(double sec) | ||
781 | { | ||
782 | // Setting timer repeat | ||
783 | m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); | ||
784 | } | ||
785 | |||
786 | public void llSleep(double sec) | ||
787 | { | ||
788 | Thread.Sleep((int) (sec*1000)); | ||
789 | } | ||
790 | |||
791 | public double llGetMass() | ||
792 | { | ||
793 | NotImplemented("llGetMass"); | ||
794 | return 0; | ||
795 | } | ||
796 | |||
797 | public void llCollisionFilter(string name, string id, int accept) | ||
798 | { | ||
799 | NotImplemented("llCollisionFilter"); | ||
800 | } | ||
801 | |||
802 | public void llTakeControls(int controls, int accept, int pass_on) | ||
803 | { | ||
804 | NotImplemented("llTakeControls"); | ||
805 | } | ||
806 | |||
807 | public void llReleaseControls() | ||
808 | { | ||
809 | NotImplemented("llReleaseControls"); | ||
810 | } | ||
811 | |||
812 | public void llAttachToAvatar(int attachment) | ||
813 | { | ||
814 | NotImplemented("llAttachToAvatar"); | ||
815 | } | ||
816 | |||
817 | public void llDetachFromAvatar() | ||
818 | { | ||
819 | NotImplemented("llDetachFromAvatar"); | ||
820 | } | ||
821 | |||
822 | public void llTakeCamera() | ||
823 | { | ||
824 | NotImplemented("llTakeCamera"); | ||
825 | } | ||
826 | |||
827 | public void llReleaseCamera() | ||
828 | { | ||
829 | NotImplemented("llReleaseCamera"); | ||
830 | } | ||
831 | |||
832 | public string llGetOwner() | ||
833 | { | ||
834 | return m_host.ObjectOwner.ToString(); | ||
835 | } | ||
836 | |||
837 | public void llInstantMessage(string user, string message) | ||
838 | { | ||
839 | NotImplemented("llInstantMessage"); | ||
840 | } | ||
841 | |||
842 | public void llEmail(string address, string subject, string message) | ||
843 | { | ||
844 | NotImplemented("llEmail"); | ||
845 | } | ||
846 | |||
847 | public void llGetNextEmail(string address, string subject) | ||
848 | { | ||
849 | NotImplemented("llGetNextEmail"); | ||
850 | } | ||
851 | |||
852 | public string llGetKey() | ||
853 | { | ||
854 | return m_host.UUID.ToString(); | ||
855 | } | ||
856 | |||
857 | public void llSetBuoyancy(double buoyancy) | ||
858 | { | ||
859 | NotImplemented("llSetBuoyancy"); | ||
860 | } | ||
861 | |||
862 | public void llSetHoverHeight(double height, int water, double tau) | ||
863 | { | ||
864 | NotImplemented("llSetHoverHeight"); | ||
865 | } | ||
866 | |||
867 | public void llStopHover() | ||
868 | { | ||
869 | NotImplemented("llStopHover"); | ||
870 | } | ||
871 | |||
872 | public void llMinEventDelay(double delay) | ||
873 | { | ||
874 | NotImplemented("llMinEventDelay"); | ||
875 | } | ||
876 | |||
877 | public void llSoundPreload() | ||
878 | { | ||
879 | NotImplemented("llSoundPreload"); | ||
880 | } | ||
881 | |||
882 | public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) | ||
883 | { | ||
884 | NotImplemented("llRotLookAt"); | ||
885 | } | ||
886 | |||
887 | public int llStringLength(string str) | ||
888 | { | ||
889 | if (str.Length > 0) | ||
890 | { | ||
891 | return str.Length; | ||
892 | } | ||
893 | else | ||
894 | { | ||
895 | return 0; | ||
896 | } | ||
897 | } | ||
898 | |||
899 | public void llStartAnimation(string anim) | ||
900 | { | ||
901 | NotImplemented("llStartAnimation"); | ||
902 | } | ||
903 | |||
904 | public void llStopAnimation(string anim) | ||
905 | { | ||
906 | NotImplemented("llStopAnimation"); | ||
907 | } | ||
908 | |||
909 | public void llPointAt() | ||
910 | { | ||
911 | NotImplemented("llPointAt"); | ||
912 | } | ||
913 | |||
914 | public void llStopPointAt() | ||
915 | { | ||
916 | NotImplemented("llStopPointAt"); | ||
917 | } | ||
918 | |||
919 | public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) | ||
920 | { | ||
921 | NotImplemented("llTargetOmega"); | ||
922 | } | ||
923 | |||
924 | public int llGetStartParameter() | ||
925 | { | ||
926 | NotImplemented("llGetStartParameter"); | ||
927 | return 0; | ||
928 | } | ||
929 | |||
930 | public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) | ||
931 | { | ||
932 | NotImplemented("llGodLikeRezObject"); | ||
933 | } | ||
934 | |||
935 | public void llRequestPermissions(string agent, int perm) | ||
936 | { | ||
937 | NotImplemented("llRequestPermissions"); | ||
938 | } | ||
939 | |||
940 | public string llGetPermissionsKey() | ||
941 | { | ||
942 | NotImplemented("llGetPermissionsKey"); | ||
943 | return ""; | ||
944 | } | ||
945 | |||
946 | public int llGetPermissions() | ||
947 | { | ||
948 | NotImplemented("llGetPermissions"); | ||
949 | return 0; | ||
950 | } | ||
951 | |||
952 | public int llGetLinkNumber() | ||
953 | { | ||
954 | NotImplemented("llGetLinkNumber"); | ||
955 | return 0; | ||
956 | } | ||
957 | |||
958 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) | ||
959 | { | ||
960 | NotImplemented("llSetLinkColor"); | ||
961 | } | ||
962 | |||
963 | public void llCreateLink(string target, int parent) | ||
964 | { | ||
965 | NotImplemented("llCreateLink"); | ||
966 | } | ||
967 | |||
968 | public void llBreakLink(int linknum) | ||
969 | { | ||
970 | NotImplemented("llBreakLink"); | ||
971 | } | ||
972 | |||
973 | public void llBreakAllLinks() | ||
974 | { | ||
975 | NotImplemented("llBreakAllLinks"); | ||
976 | } | ||
977 | |||
978 | public string llGetLinkKey(int linknum) | ||
979 | { | ||
980 | NotImplemented("llGetLinkKey"); | ||
981 | return ""; | ||
982 | } | ||
983 | |||
984 | public void llGetLinkName(int linknum) | ||
985 | { | ||
986 | NotImplemented("llGetLinkName"); | ||
987 | } | ||
988 | |||
989 | public int llGetInventoryNumber(int type) | ||
990 | { | ||
991 | NotImplemented("llGetInventoryNumber"); | ||
992 | return 0; | ||
993 | } | ||
994 | |||
995 | public string llGetInventoryName(int type, int number) | ||
996 | { | ||
997 | NotImplemented("llGetInventoryName"); | ||
998 | return ""; | ||
999 | } | ||
1000 | |||
1001 | public void llSetScriptState(string name, int run) | ||
1002 | { | ||
1003 | NotImplemented("llSetScriptState"); | ||
1004 | } | ||
1005 | |||
1006 | public double llGetEnergy() | ||
1007 | { | ||
1008 | return 1.0f; | ||
1009 | } | ||
1010 | |||
1011 | public void llGiveInventory(string destination, string inventory) | ||
1012 | { | ||
1013 | NotImplemented("llGiveInventory"); | ||
1014 | } | ||
1015 | |||
1016 | public void llRemoveInventory(string item) | ||
1017 | { | ||
1018 | NotImplemented("llRemoveInventory"); | ||
1019 | } | ||
1020 | |||
1021 | public void llSetText(string text, LSL_Types.Vector3 color, double alpha) | ||
1022 | { | ||
1023 | Vector3 av3 = new Vector3((float) color.X, (float) color.Y, (float) color.Z); | ||
1024 | m_host.SetText(text, av3, alpha); | ||
1025 | } | ||
1026 | |||
1027 | |||
1028 | public double llWater(LSL_Types.Vector3 offset) | ||
1029 | { | ||
1030 | NotImplemented("llWater"); | ||
1031 | return 0; | ||
1032 | } | ||
1033 | |||
1034 | public void llPassTouches(int pass) | ||
1035 | { | ||
1036 | NotImplemented("llPassTouches"); | ||
1037 | } | ||
1038 | |||
1039 | public string llRequestAgentData(string id, int data) | ||
1040 | { | ||
1041 | NotImplemented("llRequestAgentData"); | ||
1042 | return ""; | ||
1043 | } | ||
1044 | |||
1045 | public string llRequestInventoryData(string name) | ||
1046 | { | ||
1047 | NotImplemented("llRequestInventoryData"); | ||
1048 | return ""; | ||
1049 | } | ||
1050 | |||
1051 | public void llSetDamage(double damage) | ||
1052 | { | ||
1053 | NotImplemented("llSetDamage"); | ||
1054 | } | ||
1055 | |||
1056 | public void llTeleportAgentHome(string agent) | ||
1057 | { | ||
1058 | NotImplemented("llTeleportAgentHome"); | ||
1059 | } | ||
1060 | |||
1061 | public void llModifyLand(int action, int brush) | ||
1062 | { | ||
1063 | } | ||
1064 | |||
1065 | public void llCollisionSound(string impact_sound, double impact_volume) | ||
1066 | { | ||
1067 | NotImplemented("llCollisionSound"); | ||
1068 | } | ||
1069 | |||
1070 | public void llCollisionSprite(string impact_sprite) | ||
1071 | { | ||
1072 | NotImplemented("llCollisionSprite"); | ||
1073 | } | ||
1074 | |||
1075 | public string llGetAnimation(string id) | ||
1076 | { | ||
1077 | NotImplemented("llGetAnimation"); | ||
1078 | return ""; | ||
1079 | } | ||
1080 | |||
1081 | public void llResetScript() | ||
1082 | { | ||
1083 | m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); | ||
1084 | } | ||
1085 | |||
1086 | public void llMessageLinked(int linknum, int num, string str, string id) | ||
1087 | { | ||
1088 | } | ||
1089 | |||
1090 | public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) | ||
1091 | { | ||
1092 | } | ||
1093 | |||
1094 | public void llPassCollisions(int pass) | ||
1095 | { | ||
1096 | } | ||
1097 | |||
1098 | public string llGetScriptName() | ||
1099 | { | ||
1100 | return ""; | ||
1101 | } | ||
1102 | |||
1103 | public int llGetNumberOfSides() | ||
1104 | { | ||
1105 | return 0; | ||
1106 | } | ||
1107 | |||
1108 | public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) | ||
1109 | { | ||
1110 | return new LSL_Types.Quaternion(); | ||
1111 | } | ||
1112 | |||
1113 | public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) | ||
1114 | { | ||
1115 | return new LSL_Types.Vector3(); | ||
1116 | } | ||
1117 | |||
1118 | public void llRot2Angle() | ||
1119 | { | ||
1120 | } | ||
1121 | |||
1122 | public double llAcos(double val) | ||
1123 | { | ||
1124 | return (double) Math.Acos(val); | ||
1125 | } | ||
1126 | |||
1127 | public double llAsin(double val) | ||
1128 | { | ||
1129 | return (double) Math.Asin(val); | ||
1130 | } | ||
1131 | |||
1132 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) | ||
1133 | { | ||
1134 | return 0; | ||
1135 | } | ||
1136 | |||
1137 | public string llGetInventoryKey(string name) | ||
1138 | { | ||
1139 | return ""; | ||
1140 | } | ||
1141 | |||
1142 | public void llAllowInventoryDrop(int add) | ||
1143 | { | ||
1144 | } | ||
1145 | |||
1146 | public LSL_Types.Vector3 llGetSunDirection() | ||
1147 | { | ||
1148 | return new LSL_Types.Vector3(); | ||
1149 | } | ||
1150 | |||
1151 | public LSL_Types.Vector3 llGetTextureOffset(int face) | ||
1152 | { | ||
1153 | return new LSL_Types.Vector3(); | ||
1154 | } | ||
1155 | |||
1156 | public LSL_Types.Vector3 llGetTextureScale(int side) | ||
1157 | { | ||
1158 | return new LSL_Types.Vector3(); | ||
1159 | } | ||
1160 | |||
1161 | public double llGetTextureRot(int side) | ||
1162 | { | ||
1163 | return 0; | ||
1164 | } | ||
1165 | |||
1166 | public int llSubStringIndex(string source, string pattern) | ||
1167 | { | ||
1168 | return source.IndexOf(pattern); | ||
1169 | } | ||
1170 | |||
1171 | public string llGetOwnerKey(string id) | ||
1172 | { | ||
1173 | NotImplemented("llGetOwnerKey"); | ||
1174 | return ""; | ||
1175 | } | ||
1176 | |||
1177 | public LSL_Types.Vector3 llGetCenterOfMass() | ||
1178 | { | ||
1179 | NotImplemented("llGetCenterOfMass"); | ||
1180 | return new LSL_Types.Vector3(); | ||
1181 | } | ||
1182 | |||
1183 | public List<string> llListSort(List<string> src, int stride, int ascending) | ||
1184 | { | ||
1185 | SortedList<string, List<string>> sorted = new SortedList<string, List<string>>(); | ||
1186 | // Add chunks to an array | ||
1187 | int s = stride; | ||
1188 | if (s < 1) | ||
1189 | s = 1; | ||
1190 | int c = 0; | ||
1191 | List<string> chunk = new List<string>(); | ||
1192 | string chunkString = ""; | ||
1193 | foreach (string element in src) | ||
1194 | { | ||
1195 | c++; | ||
1196 | if (c > s) | ||
1197 | { | ||
1198 | sorted.Add(chunkString, chunk); | ||
1199 | chunkString = ""; | ||
1200 | chunk = new List<string>(); | ||
1201 | c = 0; | ||
1202 | } | ||
1203 | chunk.Add(element); | ||
1204 | chunkString += element.ToString(); | ||
1205 | } | ||
1206 | if (chunk.Count > 0) | ||
1207 | sorted.Add(chunkString, chunk); | ||
1208 | |||
1209 | List<string> ret = new List<string>(); | ||
1210 | foreach (List<string> ls in sorted.Values) | ||
1211 | { | ||
1212 | ret.AddRange(ls); | ||
1213 | } | ||
1214 | |||
1215 | if (ascending == LSL_BaseClass.TRUE) | ||
1216 | return ret; | ||
1217 | ret.Reverse(); | ||
1218 | return ret; | ||
1219 | } | ||
1220 | |||
1221 | public int llGetListLength(List<string> src) | ||
1222 | { | ||
1223 | return src.Count; | ||
1224 | } | ||
1225 | |||
1226 | public int llList2Integer(List<string> src, int index) | ||
1227 | { | ||
1228 | return Convert.ToInt32(src[index]); | ||
1229 | } | ||
1230 | |||
1231 | public double llList2double(List<string> src, int index) | ||
1232 | { | ||
1233 | return Convert.ToDouble(src[index]); | ||
1234 | } | ||
1235 | |||
1236 | public float llList2Float(List<string> src, int index) | ||
1237 | { | ||
1238 | return Convert.ToSingle(src[index]); | ||
1239 | } | ||
1240 | |||
1241 | public string llList2String(List<string> src, int index) | ||
1242 | { | ||
1243 | return src[index]; | ||
1244 | } | ||
1245 | |||
1246 | public string llList2Key(List<string> src, int index) | ||
1247 | { | ||
1248 | //return OpenSim.Framework.ToString(src[index]); | ||
1249 | return src[index].ToString(); | ||
1250 | } | ||
1251 | |||
1252 | public LSL_Types.Vector3 llList2Vector(List<string> src, int index) | ||
1253 | { | ||
1254 | return | ||
1255 | new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), | ||
1256 | double.Parse(src[index + 2])); | ||
1257 | } | ||
1258 | |||
1259 | public LSL_Types.Quaternion llList2Rot(List<string> src, int index) | ||
1260 | { | ||
1261 | return | ||
1262 | new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), | ||
1263 | double.Parse(src[index + 2]), double.Parse(src[index + 3])); | ||
1264 | } | ||
1265 | |||
1266 | public List<string> llList2List(List<string> src, int start, int end) | ||
1267 | { | ||
1268 | if (end > start) | ||
1269 | { | ||
1270 | // Simple straight forward chunk | ||
1271 | return src.GetRange(start, end - start); | ||
1272 | } | ||
1273 | else | ||
1274 | { | ||
1275 | // Some of the end + some of the beginning | ||
1276 | // First chunk | ||
1277 | List<string> ret = new List<string>(); | ||
1278 | ret.AddRange(src.GetRange(start, src.Count - start)); | ||
1279 | ret.AddRange(src.GetRange(0, end)); | ||
1280 | return ret; | ||
1281 | } | ||
1282 | } | ||
1283 | |||
1284 | public List<string> llDeleteSubList(List<string> src, int start, int end) | ||
1285 | { | ||
1286 | List<string> ret = new List<string>(src); | ||
1287 | ret.RemoveRange(start, end - start); | ||
1288 | return ret; | ||
1289 | } | ||
1290 | |||
1291 | public int llGetListEntryType(List<string> src, int index) | ||
1292 | { | ||
1293 | NotImplemented("llGetListEntryType"); | ||
1294 | return 0; | ||
1295 | } | ||
1296 | |||
1297 | public string llList2CSV(List<string> src) | ||
1298 | { | ||
1299 | string ret = ""; | ||
1300 | foreach (string s in src) | ||
1301 | { | ||
1302 | if (s.Length > 0) | ||
1303 | ret += ","; | ||
1304 | ret += s; | ||
1305 | } | ||
1306 | return ret; | ||
1307 | } | ||
1308 | |||
1309 | public List<string> llCSV2List(string src) | ||
1310 | { | ||
1311 | List<string> ret = new List<string>(); | ||
1312 | foreach (string s in src.Split(",".ToCharArray())) | ||
1313 | { | ||
1314 | ret.Add(s); | ||
1315 | } | ||
1316 | return ret; | ||
1317 | } | ||
1318 | |||
1319 | public List<string> llListRandomize(List<string> src, int stride) | ||
1320 | { | ||
1321 | int s = stride; | ||
1322 | if (s < 1) | ||
1323 | s = 1; | ||
1324 | |||
1325 | // This is a cowardly way of doing it ;) | ||
1326 | // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange | ||
1327 | List<List<string>> tmp = new List<List<string>>(); | ||
1328 | |||
1329 | // Add chunks to an array | ||
1330 | int c = 0; | ||
1331 | List<string> chunk = new List<string>(); | ||
1332 | foreach (string element in src) | ||
1333 | { | ||
1334 | c++; | ||
1335 | if (c > s) | ||
1336 | { | ||
1337 | tmp.Add(chunk); | ||
1338 | chunk = new List<string>(); | ||
1339 | c = 0; | ||
1340 | } | ||
1341 | chunk.Add(element); | ||
1342 | } | ||
1343 | if (chunk.Count > 0) | ||
1344 | tmp.Add(chunk); | ||
1345 | |||
1346 | // Decreate (<- what kind of word is that? :D) array back into a list | ||
1347 | int rnd; | ||
1348 | List<string> ret = new List<string>(); | ||
1349 | while (tmp.Count > 0) | ||
1350 | { | ||
1351 | rnd = Util.RandomClass.Next(tmp.Count); | ||
1352 | foreach (string str in tmp[rnd]) | ||
1353 | { | ||
1354 | ret.Add(str); | ||
1355 | } | ||
1356 | tmp.RemoveAt(rnd); | ||
1357 | } | ||
1358 | |||
1359 | return ret; | ||
1360 | } | ||
1361 | |||
1362 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) | ||
1363 | { | ||
1364 | List<string> ret = new List<string>(); | ||
1365 | int s = stride; | ||
1366 | if (s < 1) | ||
1367 | s = 1; | ||
1368 | |||
1369 | int sc = s; | ||
1370 | for (int i = start; i < src.Count; i++) | ||
1371 | { | ||
1372 | sc--; | ||
1373 | if (sc == 0) | ||
1374 | { | ||
1375 | sc = s; | ||
1376 | // Addthis | ||
1377 | ret.Add(src[i]); | ||
1378 | } | ||
1379 | if (i == end) | ||
1380 | break; | ||
1381 | } | ||
1382 | return ret; | ||
1383 | } | ||
1384 | |||
1385 | public LSL_Types.Vector3 llGetRegionCorner() | ||
1386 | { | ||
1387 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0); | ||
1388 | } | ||
1389 | |||
1390 | public List<string> llListInsertList(List<string> dest, List<string> src, int start) | ||
1391 | { | ||
1392 | List<string> ret = new List<string>(dest); | ||
1393 | //foreach (string s in src.Reverse()) | ||
1394 | for (int ci = src.Count - 1; ci > -1; ci--) | ||
1395 | { | ||
1396 | ret.Insert(start, src[ci]); | ||
1397 | } | ||
1398 | return ret; | ||
1399 | } | ||
1400 | |||
1401 | public int llListFindList(List<string> src, List<string> test) | ||
1402 | { | ||
1403 | foreach (string s in test) | ||
1404 | { | ||
1405 | for (int ci = 0; ci < src.Count; ci++) | ||
1406 | { | ||
1407 | if (s == src[ci]) | ||
1408 | return ci; | ||
1409 | } | ||
1410 | } | ||
1411 | return -1; | ||
1412 | } | ||
1413 | |||
1414 | public string llGetObjectName() | ||
1415 | { | ||
1416 | return m_host.Name; | ||
1417 | } | ||
1418 | |||
1419 | public void llSetObjectName(string name) | ||
1420 | { | ||
1421 | m_host.Name = name; | ||
1422 | } | ||
1423 | |||
1424 | public string llGetDate() | ||
1425 | { | ||
1426 | DateTime date = DateTime.Now.ToUniversalTime(); | ||
1427 | string result = date.ToString("yyyy-MM-dd"); | ||
1428 | return result; | ||
1429 | } | ||
1430 | |||
1431 | public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) | ||
1432 | { | ||
1433 | NotImplemented("llEdgeOfWorld"); | ||
1434 | return 0; | ||
1435 | } | ||
1436 | |||
1437 | public int llGetAgentInfo(string id) | ||
1438 | { | ||
1439 | NotImplemented("llGetAgentInfo"); | ||
1440 | return 0; | ||
1441 | } | ||
1442 | |||
1443 | public void llAdjustSoundVolume(double volume) | ||
1444 | { | ||
1445 | NotImplemented("llAdjustSoundVolume"); | ||
1446 | } | ||
1447 | |||
1448 | public void llSetSoundQueueing(int queue) | ||
1449 | { | ||
1450 | NotImplemented("llSetSoundQueueing"); | ||
1451 | } | ||
1452 | |||
1453 | public void llSetSoundRadius(double radius) | ||
1454 | { | ||
1455 | NotImplemented("llSetSoundRadius"); | ||
1456 | } | ||
1457 | |||
1458 | public string llKey2Name(string id) | ||
1459 | { | ||
1460 | NotImplemented("llKey2Name"); | ||
1461 | return ""; | ||
1462 | } | ||
1463 | |||
1464 | public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) | ||
1465 | { | ||
1466 | NotImplemented("llSetTextureAnim"); | ||
1467 | } | ||
1468 | |||
1469 | public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, | ||
1470 | LSL_Types.Vector3 bottom_south_west) | ||
1471 | { | ||
1472 | NotImplemented("llTriggerSoundLimited"); | ||
1473 | } | ||
1474 | |||
1475 | public void llEjectFromLand(string pest) | ||
1476 | { | ||
1477 | NotImplemented("llEjectFromLand"); | ||
1478 | } | ||
1479 | |||
1480 | public void llParseString2List() | ||
1481 | { | ||
1482 | NotImplemented("llParseString2List"); | ||
1483 | } | ||
1484 | |||
1485 | public int llOverMyLand(string id) | ||
1486 | { | ||
1487 | NotImplemented("llOverMyLand"); | ||
1488 | return 0; | ||
1489 | } | ||
1490 | |||
1491 | public string llGetLandOwnerAt(LSL_Types.Vector3 pos) | ||
1492 | { | ||
1493 | NotImplemented("llGetLandOwnerAt"); | ||
1494 | return ""; | ||
1495 | } | ||
1496 | |||
1497 | public string llGetNotecardLine(string name, int line) | ||
1498 | { | ||
1499 | NotImplemented("llGetNotecardLine"); | ||
1500 | return ""; | ||
1501 | } | ||
1502 | |||
1503 | public LSL_Types.Vector3 llGetAgentSize(string id) | ||
1504 | { | ||
1505 | NotImplemented("llGetAgentSize"); | ||
1506 | return new LSL_Types.Vector3(); | ||
1507 | } | ||
1508 | |||
1509 | public int llSameGroup(string agent) | ||
1510 | { | ||
1511 | NotImplemented("llSameGroup"); | ||
1512 | return 0; | ||
1513 | } | ||
1514 | |||
1515 | public void llUnSit(string id) | ||
1516 | { | ||
1517 | NotImplemented("llUnSit"); | ||
1518 | } | ||
1519 | |||
1520 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) | ||
1521 | { | ||
1522 | NotImplemented("llGroundSlope"); | ||
1523 | return new LSL_Types.Vector3(); | ||
1524 | } | ||
1525 | |||
1526 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) | ||
1527 | { | ||
1528 | NotImplemented("llGroundNormal"); | ||
1529 | return new LSL_Types.Vector3(); | ||
1530 | } | ||
1531 | |||
1532 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) | ||
1533 | { | ||
1534 | NotImplemented("llGroundContour"); | ||
1535 | return new LSL_Types.Vector3(); | ||
1536 | } | ||
1537 | |||
1538 | public int llGetAttached() | ||
1539 | { | ||
1540 | NotImplemented("llGetAttached"); | ||
1541 | return 0; | ||
1542 | } | ||
1543 | |||
1544 | public int llGetFreeMemory() | ||
1545 | { | ||
1546 | NotImplemented("llGetFreeMemory"); | ||
1547 | return 0; | ||
1548 | } | ||
1549 | |||
1550 | public string llGetRegionName() | ||
1551 | { | ||
1552 | return World.RegionInfo.RegionName; | ||
1553 | } | ||
1554 | |||
1555 | public double llGetRegionTimeDilation() | ||
1556 | { | ||
1557 | return 1.0f; | ||
1558 | } | ||
1559 | |||
1560 | public double llGetRegionFPS() | ||
1561 | { | ||
1562 | return 10.0f; | ||
1563 | } | ||
1564 | |||
1565 | /* particle system rules should be coming into this routine as doubles, that is | ||
1566 | rule[0] should be an integer from this list and rule[1] should be the arg | ||
1567 | for the same integer. wiki.secondlife.com has most of this mapping, but some | ||
1568 | came from http://www.caligari-designs.com/p4u2 | ||
1569 | |||
1570 | We iterate through the list for 'Count' elements, incrementing by two for each | ||
1571 | iteration and set the members of Primitive.ParticleSystem, one at a time. | ||
1572 | */ | ||
1573 | |||
1574 | public enum PrimitiveRule : int | ||
1575 | { | ||
1576 | PSYS_PART_FLAGS = 0, | ||
1577 | PSYS_PART_START_COLOR = 1, | ||
1578 | PSYS_PART_START_ALPHA = 2, | ||
1579 | PSYS_PART_END_COLOR = 3, | ||
1580 | PSYS_PART_END_ALPHA = 4, | ||
1581 | PSYS_PART_START_SCALE = 5, | ||
1582 | PSYS_PART_END_SCALE = 6, | ||
1583 | PSYS_PART_MAX_AGE = 7, | ||
1584 | PSYS_SRC_ACCEL = 8, | ||
1585 | PSYS_SRC_PATTERN = 9, | ||
1586 | PSYS_SRC_TEXTURE = 12, | ||
1587 | PSYS_SRC_BURST_RATE = 13, | ||
1588 | PSYS_SRC_BURST_PART_COUNT = 15, | ||
1589 | PSYS_SRC_BURST_RADIUS = 16, | ||
1590 | PSYS_SRC_BURST_SPEED_MIN = 17, | ||
1591 | PSYS_SRC_BURST_SPEED_MAX = 18, | ||
1592 | PSYS_SRC_MAX_AGE = 19, | ||
1593 | PSYS_SRC_TARGET_KEY = 20, | ||
1594 | PSYS_SRC_OMEGA = 21, | ||
1595 | PSYS_SRC_ANGLE_BEGIN = 22, | ||
1596 | PSYS_SRC_ANGLE_END = 23 | ||
1597 | } | ||
1598 | |||
1599 | public void llParticleSystem(List<Object> rules) | ||
1600 | { | ||
1601 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); | ||
1602 | for (int i = 0; i < rules.Count; i += 2) | ||
1603 | { | ||
1604 | switch ((int) rules[i]) | ||
1605 | { | ||
1606 | case (int) PrimitiveRule.PSYS_PART_FLAGS: | ||
1607 | prules.PartFlags = (uint) rules[i + 1]; | ||
1608 | break; | ||
1609 | |||
1610 | case (int) PrimitiveRule.PSYS_PART_START_COLOR: | ||
1611 | prules.PartStartColor = (LLColor) rules[i + 1]; | ||
1612 | break; | ||
1613 | |||
1614 | case (int) PrimitiveRule.PSYS_PART_START_ALPHA: | ||
1615 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
1616 | break; | ||
1617 | |||
1618 | case (int) PrimitiveRule.PSYS_PART_END_COLOR: | ||
1619 | prules.PartEndColor = (LLColor) rules[i + 1]; | ||
1620 | break; | ||
1621 | |||
1622 | case (int) PrimitiveRule.PSYS_PART_END_ALPHA: | ||
1623 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
1624 | break; | ||
1625 | |||
1626 | case (int) PrimitiveRule.PSYS_PART_START_SCALE: | ||
1627 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
1628 | break; | ||
1629 | |||
1630 | case (int) PrimitiveRule.PSYS_PART_END_SCALE: | ||
1631 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
1632 | break; | ||
1633 | |||
1634 | case (int) PrimitiveRule.PSYS_PART_MAX_AGE: | ||
1635 | prules.MaxAge = (float) rules[i + 1]; | ||
1636 | break; | ||
1637 | |||
1638 | case (int) PrimitiveRule.PSYS_SRC_ACCEL: | ||
1639 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
1640 | break; | ||
1641 | |||
1642 | case (int) PrimitiveRule.PSYS_SRC_PATTERN: | ||
1643 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | ||
1644 | break; | ||
1645 | |||
1646 | case (int) PrimitiveRule.PSYS_SRC_TEXTURE: | ||
1647 | prules.Texture = (LLUUID) rules[i + 1]; | ||
1648 | break; | ||
1649 | |||
1650 | case (int) PrimitiveRule.PSYS_SRC_BURST_RATE: | ||
1651 | prules.BurstRate = (float) rules[i + 1]; | ||
1652 | break; | ||
1653 | |||
1654 | case (int) PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: | ||
1655 | prules.BurstPartCount = (byte) rules[i + 1]; | ||
1656 | break; | ||
1657 | |||
1658 | case (int) PrimitiveRule.PSYS_SRC_BURST_RADIUS: | ||
1659 | prules.BurstRadius = (float) rules[i + 1]; | ||
1660 | break; | ||
1661 | |||
1662 | case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: | ||
1663 | prules.BurstSpeedMin = (float) rules[i + 1]; | ||
1664 | break; | ||
1665 | |||
1666 | case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: | ||
1667 | prules.BurstSpeedMax = (float) rules[i + 1]; | ||
1668 | break; | ||
1669 | |||
1670 | case (int) PrimitiveRule.PSYS_SRC_MAX_AGE: | ||
1671 | prules.MaxAge = (float) rules[i + 1]; | ||
1672 | break; | ||
1673 | |||
1674 | case (int) PrimitiveRule.PSYS_SRC_TARGET_KEY: | ||
1675 | prules.Target = (LLUUID) rules[i + 1]; | ||
1676 | break; | ||
1677 | |||
1678 | case (int) PrimitiveRule.PSYS_SRC_OMEGA: | ||
1679 | //cast?? prules.MaxAge = (float)rules[i + 1]; | ||
1680 | break; | ||
1681 | |||
1682 | case (int) PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: | ||
1683 | prules.InnerAngle = (float) rules[i + 1]; | ||
1684 | break; | ||
1685 | |||
1686 | case (int) PrimitiveRule.PSYS_SRC_ANGLE_END: | ||
1687 | prules.OuterAngle = (float) rules[i + 1]; | ||
1688 | break; | ||
1689 | } | ||
1690 | } | ||
1691 | |||
1692 | m_host.AddNewParticleSystem(prules); | ||
1693 | } | ||
1694 | |||
1695 | public void llGroundRepel(double height, int water, double tau) | ||
1696 | { | ||
1697 | NotImplemented("llGroundRepel"); | ||
1698 | } | ||
1699 | |||
1700 | public void llGiveInventoryList() | ||
1701 | { | ||
1702 | NotImplemented("llGiveInventoryList"); | ||
1703 | } | ||
1704 | |||
1705 | public void llSetVehicleType(int type) | ||
1706 | { | ||
1707 | NotImplemented("llSetVehicleType"); | ||
1708 | } | ||
1709 | |||
1710 | public void llSetVehicledoubleParam(int param, double value) | ||
1711 | { | ||
1712 | NotImplemented("llSetVehicledoubleParam"); | ||
1713 | } | ||
1714 | |||
1715 | public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) | ||
1716 | { | ||
1717 | NotImplemented("llSetVehicleVectorParam"); | ||
1718 | } | ||
1719 | |||
1720 | public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) | ||
1721 | { | ||
1722 | NotImplemented("llSetVehicleRotationParam"); | ||
1723 | } | ||
1724 | |||
1725 | public void llSetVehicleFlags(int flags) | ||
1726 | { | ||
1727 | NotImplemented("llSetVehicleFlags"); | ||
1728 | } | ||
1729 | |||
1730 | public void llRemoveVehicleFlags(int flags) | ||
1731 | { | ||
1732 | NotImplemented("llRemoveVehicleFlags"); | ||
1733 | } | ||
1734 | |||
1735 | public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) | ||
1736 | { | ||
1737 | NotImplemented("llSitTarget"); | ||
1738 | } | ||
1739 | |||
1740 | public string llAvatarOnSitTarget() | ||
1741 | { | ||
1742 | NotImplemented("llAvatarOnSitTarget"); | ||
1743 | return ""; | ||
1744 | } | ||
1745 | |||
1746 | public void llAddToLandPassList(string avatar, double hours) | ||
1747 | { | ||
1748 | NotImplemented("llAddToLandPassList"); | ||
1749 | } | ||
1750 | |||
1751 | public void llSetTouchText(string text) | ||
1752 | { | ||
1753 | m_host.TouchName = text; | ||
1754 | } | ||
1755 | |||
1756 | public void llSetSitText(string text) | ||
1757 | { | ||
1758 | m_host.SitName = text; | ||
1759 | } | ||
1760 | |||
1761 | public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) | ||
1762 | { | ||
1763 | NotImplemented("llSetCameraEyeOffset"); | ||
1764 | } | ||
1765 | |||
1766 | public void llSetCameraAtOffset(LSL_Types.Vector3 offset) | ||
1767 | { | ||
1768 | NotImplemented("llSetCameraAtOffset"); | ||
1769 | } | ||
1770 | |||
1771 | public void llDumpList2String() | ||
1772 | { | ||
1773 | NotImplemented("llDumpList2String"); | ||
1774 | } | ||
1775 | |||
1776 | public void llScriptDanger(LSL_Types.Vector3 pos) | ||
1777 | { | ||
1778 | NotImplemented("llScriptDanger"); | ||
1779 | } | ||
1780 | |||
1781 | public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) | ||
1782 | { | ||
1783 | NotImplemented("llDialog"); | ||
1784 | } | ||
1785 | |||
1786 | public void llVolumeDetect(int detect) | ||
1787 | { | ||
1788 | NotImplemented("llVolumeDetect"); | ||
1789 | } | ||
1790 | |||
1791 | public void llResetOtherScript(string name) | ||
1792 | { | ||
1793 | NotImplemented("llResetOtherScript"); | ||
1794 | } | ||
1795 | |||
1796 | public int llGetScriptState(string name) | ||
1797 | { | ||
1798 | NotImplemented("llGetScriptState"); | ||
1799 | return 0; | ||
1800 | } | ||
1801 | |||
1802 | public void llRemoteLoadScript() | ||
1803 | { | ||
1804 | NotImplemented("llRemoteLoadScript"); | ||
1805 | } | ||
1806 | |||
1807 | public void llSetRemoteScriptAccessPin(int pin) | ||
1808 | { | ||
1809 | NotImplemented("llSetRemoteScriptAccessPin"); | ||
1810 | } | ||
1811 | |||
1812 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) | ||
1813 | { | ||
1814 | NotImplemented("llRemoteLoadScriptPin"); | ||
1815 | } | ||
1816 | |||
1817 | public void llOpenRemoteDataChannel() | ||
1818 | { | ||
1819 | NotImplemented("llOpenRemoteDataChannel"); | ||
1820 | } | ||
1821 | |||
1822 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) | ||
1823 | { | ||
1824 | NotImplemented("llSendRemoteData"); | ||
1825 | return ""; | ||
1826 | } | ||
1827 | |||
1828 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) | ||
1829 | { | ||
1830 | NotImplemented("llRemoteDataReply"); | ||
1831 | } | ||
1832 | |||
1833 | public void llCloseRemoteDataChannel(string channel) | ||
1834 | { | ||
1835 | NotImplemented("llCloseRemoteDataChannel"); | ||
1836 | } | ||
1837 | |||
1838 | public string llMD5String(string src, int nonce) | ||
1839 | { | ||
1840 | return Util.Md5Hash(src + ":" + nonce.ToString()); | ||
1841 | } | ||
1842 | |||
1843 | public void llSetPrimitiveParams(List<string> rules) | ||
1844 | { | ||
1845 | NotImplemented("llSetPrimitiveParams"); | ||
1846 | } | ||
1847 | |||
1848 | public string llStringToBase64(string str) | ||
1849 | { | ||
1850 | try | ||
1851 | { | ||
1852 | byte[] encData_byte = new byte[str.Length]; | ||
1853 | encData_byte = Encoding.UTF8.GetBytes(str); | ||
1854 | string encodedData = Convert.ToBase64String(encData_byte); | ||
1855 | return encodedData; | ||
1856 | } | ||
1857 | catch (Exception e) | ||
1858 | { | ||
1859 | throw new Exception("Error in base64Encode" + e.Message); | ||
1860 | } | ||
1861 | } | ||
1862 | |||
1863 | public string llBase64ToString(string str) | ||
1864 | { | ||
1865 | UTF8Encoding encoder = new UTF8Encoding(); | ||
1866 | Decoder utf8Decode = encoder.GetDecoder(); | ||
1867 | try | ||
1868 | { | ||
1869 | byte[] todecode_byte = Convert.FromBase64String(str); | ||
1870 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | ||
1871 | char[] decoded_char = new char[charCount]; | ||
1872 | utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); | ||
1873 | string result = new String(decoded_char); | ||
1874 | return result; | ||
1875 | } | ||
1876 | catch (Exception e) | ||
1877 | { | ||
1878 | throw new Exception("Error in base64Decode" + e.Message); | ||
1879 | } | ||
1880 | } | ||
1881 | |||
1882 | public void llXorBase64Strings() | ||
1883 | { | ||
1884 | throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); | ||
1885 | } | ||
1886 | |||
1887 | public void llRemoteDataSetRegion() | ||
1888 | { | ||
1889 | NotImplemented("llRemoteDataSetRegion"); | ||
1890 | } | ||
1891 | |||
1892 | public double llLog10(double val) | ||
1893 | { | ||
1894 | return (double) Math.Log10(val); | ||
1895 | } | ||
1896 | |||
1897 | public double llLog(double val) | ||
1898 | { | ||
1899 | return (double) Math.Log(val); | ||
1900 | } | ||
1901 | |||
1902 | public List<string> llGetAnimationList(string id) | ||
1903 | { | ||
1904 | NotImplemented("llGetAnimationList"); | ||
1905 | return new List<string>(); | ||
1906 | } | ||
1907 | |||
1908 | public void llSetParcelMusicURL(string url) | ||
1909 | { | ||
1910 | NotImplemented("llSetParcelMusicURL"); | ||
1911 | } | ||
1912 | |||
1913 | public LSL_Types.Vector3 llGetRootPosition() | ||
1914 | { | ||
1915 | NotImplemented("llGetRootPosition"); | ||
1916 | return new LSL_Types.Vector3(); | ||
1917 | } | ||
1918 | |||
1919 | public LSL_Types.Quaternion llGetRootRotation() | ||
1920 | { | ||
1921 | NotImplemented("llGetRootRotation"); | ||
1922 | return new LSL_Types.Quaternion(); | ||
1923 | } | ||
1924 | |||
1925 | public string llGetObjectDesc() | ||
1926 | { | ||
1927 | return m_host.Description; | ||
1928 | } | ||
1929 | |||
1930 | public void llSetObjectDesc(string desc) | ||
1931 | { | ||
1932 | m_host.Description = desc; | ||
1933 | } | ||
1934 | |||
1935 | public string llGetCreator() | ||
1936 | { | ||
1937 | return m_host.ObjectCreator.ToString(); | ||
1938 | } | ||
1939 | |||
1940 | public string llGetTimestamp() | ||
1941 | { | ||
1942 | return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); | ||
1943 | } | ||
1944 | |||
1945 | public void llSetLinkAlpha(int linknumber, double alpha, int face) | ||
1946 | { | ||
1947 | NotImplemented("llSetLinkAlpha"); | ||
1948 | } | ||
1949 | |||
1950 | public int llGetNumberOfPrims() | ||
1951 | { | ||
1952 | NotImplemented("llGetNumberOfPrims"); | ||
1953 | return 0; | ||
1954 | } | ||
1955 | |||
1956 | public string llGetNumberOfNotecardLines(string name) | ||
1957 | { | ||
1958 | NotImplemented("llGetNumberOfNotecardLines"); | ||
1959 | return ""; | ||
1960 | } | ||
1961 | |||
1962 | public List<string> llGetBoundingBox(string obj) | ||
1963 | { | ||
1964 | NotImplemented("llGetBoundingBox"); | ||
1965 | return new List<string>(); | ||
1966 | } | ||
1967 | |||
1968 | public LSL_Types.Vector3 llGetGeometricCenter() | ||
1969 | { | ||
1970 | NotImplemented("llGetGeometricCenter"); | ||
1971 | return new LSL_Types.Vector3(); | ||
1972 | } | ||
1973 | |||
1974 | public void llGetPrimitiveParams() | ||
1975 | { | ||
1976 | NotImplemented("llGetPrimitiveParams"); | ||
1977 | } | ||
1978 | |||
1979 | public string llIntegerToBase64(int number) | ||
1980 | { | ||
1981 | NotImplemented("llIntegerToBase64"); | ||
1982 | return ""; | ||
1983 | } | ||
1984 | |||
1985 | public int llBase64ToInteger(string str) | ||
1986 | { | ||
1987 | NotImplemented("llBase64ToInteger"); | ||
1988 | return 0; | ||
1989 | } | ||
1990 | |||
1991 | public double llGetGMTclock() | ||
1992 | { | ||
1993 | return DateTime.UtcNow.TimeOfDay.TotalSeconds; | ||
1994 | } | ||
1995 | |||
1996 | public string llGetSimulatorHostname() | ||
1997 | { | ||
1998 | return Environment.MachineName; | ||
1999 | } | ||
2000 | |||
2001 | public void llSetLocalRot(LSL_Types.Quaternion rot) | ||
2002 | { | ||
2003 | NotImplemented("llSetLocalRot"); | ||
2004 | } | ||
2005 | |||
2006 | public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) | ||
2007 | { | ||
2008 | NotImplemented("llParseStringKeepNulls"); | ||
2009 | return new List<string>(); | ||
2010 | } | ||
2011 | |||
2012 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, | ||
2013 | LSL_Types.Quaternion rot, int param) | ||
2014 | { | ||
2015 | NotImplemented("llRezAtRoot"); | ||
2016 | } | ||
2017 | |||
2018 | public int llGetObjectPermMask(int mask) | ||
2019 | { | ||
2020 | NotImplemented("llGetObjectPermMask"); | ||
2021 | return 0; | ||
2022 | } | ||
2023 | |||
2024 | public void llSetObjectPermMask(int mask, int value) | ||
2025 | { | ||
2026 | NotImplemented("llSetObjectPermMask"); | ||
2027 | } | ||
2028 | |||
2029 | public void llGetInventoryPermMask(string item, int mask) | ||
2030 | { | ||
2031 | NotImplemented("llGetInventoryPermMask"); | ||
2032 | } | ||
2033 | |||
2034 | public void llSetInventoryPermMask(string item, int mask, int value) | ||
2035 | { | ||
2036 | NotImplemented("llSetInventoryPermMask"); | ||
2037 | } | ||
2038 | |||
2039 | public string llGetInventoryCreator(string item) | ||
2040 | { | ||
2041 | NotImplemented("llGetInventoryCreator"); | ||
2042 | return ""; | ||
2043 | } | ||
2044 | |||
2045 | public void llRequestSimulatorData(string simulator, int data) | ||
2046 | { | ||
2047 | NotImplemented("llRequestSimulatorData"); | ||
2048 | } | ||
2049 | |||
2050 | public void llForceMouselook(int mouselook) | ||
2051 | { | ||
2052 | NotImplemented("llForceMouselook"); | ||
2053 | } | ||
2054 | |||
2055 | public double llGetObjectMass(string id) | ||
2056 | { | ||
2057 | NotImplemented("llGetObjectMass"); | ||
2058 | return 0; | ||
2059 | } | ||
2060 | |||
2061 | public void llListReplaceList() | ||
2062 | { | ||
2063 | NotImplemented("llListReplaceList"); | ||
2064 | } | ||
2065 | |||
2066 | public void llLoadURL(string avatar_id, string message, string url) | ||
2067 | { | ||
2068 | LLUUID avatarId = new LLUUID(avatar_id); | ||
2069 | m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, | ||
2070 | url); | ||
2071 | } | ||
2072 | |||
2073 | public void llParcelMediaCommandList(List<string> commandList) | ||
2074 | { | ||
2075 | NotImplemented("llParcelMediaCommandList"); | ||
2076 | } | ||
2077 | |||
2078 | public void llParcelMediaQuery() | ||
2079 | { | ||
2080 | NotImplemented("llParcelMediaQuery"); | ||
2081 | } | ||
2082 | |||
2083 | public int llModPow(int a, int b, int c) | ||
2084 | { | ||
2085 | Int64 tmp = 0; | ||
2086 | Int64 val = Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); | ||
2087 | return Convert.ToInt32(tmp); | ||
2088 | } | ||
2089 | |||
2090 | public int llGetInventoryType(string name) | ||
2091 | { | ||
2092 | NotImplemented("llGetInventoryType"); | ||
2093 | return 0; | ||
2094 | } | ||
2095 | |||
2096 | public void llSetPayPrice(int price, List<string> quick_pay_buttons) | ||
2097 | { | ||
2098 | NotImplemented("llSetPayPrice"); | ||
2099 | } | ||
2100 | |||
2101 | public LSL_Types.Vector3 llGetCameraPos() | ||
2102 | { | ||
2103 | NotImplemented("llGetCameraPos"); | ||
2104 | return new LSL_Types.Vector3(); | ||
2105 | } | ||
2106 | |||
2107 | public LSL_Types.Quaternion llGetCameraRot() | ||
2108 | { | ||
2109 | NotImplemented("llGetCameraRot"); | ||
2110 | return new LSL_Types.Quaternion(); | ||
2111 | } | ||
2112 | |||
2113 | public void llSetPrimURL() | ||
2114 | { | ||
2115 | NotImplemented("llSetPrimURL"); | ||
2116 | } | ||
2117 | |||
2118 | public void llRefreshPrimURL() | ||
2119 | { | ||
2120 | NotImplemented("llRefreshPrimURL"); | ||
2121 | } | ||
2122 | |||
2123 | public string llEscapeURL(string url) | ||
2124 | { | ||
2125 | try | ||
2126 | { | ||
2127 | return Uri.EscapeUriString(url); | ||
2128 | } | ||
2129 | catch (Exception ex) | ||
2130 | { | ||
2131 | return "llEscapeURL: " + ex.ToString(); | ||
2132 | } | ||
2133 | } | ||
2134 | |||
2135 | public string llUnescapeURL(string url) | ||
2136 | { | ||
2137 | try | ||
2138 | { | ||
2139 | return Uri.UnescapeDataString(url); | ||
2140 | } | ||
2141 | catch (Exception ex) | ||
2142 | { | ||
2143 | return "llUnescapeURL: " + ex.ToString(); | ||
2144 | } | ||
2145 | } | ||
2146 | |||
2147 | public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) | ||
2148 | { | ||
2149 | NotImplemented("llMapDestination"); | ||
2150 | } | ||
2151 | |||
2152 | public void llAddToLandBanList(string avatar, double hours) | ||
2153 | { | ||
2154 | NotImplemented("llAddToLandBanList"); | ||
2155 | } | ||
2156 | |||
2157 | public void llRemoveFromLandPassList(string avatar) | ||
2158 | { | ||
2159 | NotImplemented("llRemoveFromLandPassList"); | ||
2160 | } | ||
2161 | |||
2162 | public void llRemoveFromLandBanList(string avatar) | ||
2163 | { | ||
2164 | NotImplemented("llRemoveFromLandBanList"); | ||
2165 | } | ||
2166 | |||
2167 | public void llSetCameraParams(List<string> rules) | ||
2168 | { | ||
2169 | NotImplemented("llSetCameraParams"); | ||
2170 | } | ||
2171 | |||
2172 | public void llClearCameraParams() | ||
2173 | { | ||
2174 | NotImplemented("llClearCameraParams"); | ||
2175 | } | ||
2176 | |||
2177 | public double llListStatistics(int operation, List<string> src) | ||
2178 | { | ||
2179 | NotImplemented("llListStatistics"); | ||
2180 | return 0; | ||
2181 | } | ||
2182 | |||
2183 | public int llGetUnixTime() | ||
2184 | { | ||
2185 | return Util.UnixTimeSinceEpoch(); | ||
2186 | } | ||
2187 | |||
2188 | public int llGetParcelFlags(LSL_Types.Vector3 pos) | ||
2189 | { | ||
2190 | NotImplemented("llGetParcelFlags"); | ||
2191 | return 0; | ||
2192 | } | ||
2193 | |||
2194 | public int llGetRegionFlags() | ||
2195 | { | ||
2196 | NotImplemented("llGetRegionFlags"); | ||
2197 | return 0; | ||
2198 | } | ||
2199 | |||
2200 | public string llXorBase64StringsCorrect(string str1, string str2) | ||
2201 | { | ||
2202 | string ret = ""; | ||
2203 | string src1 = llBase64ToString(str1); | ||
2204 | string src2 = llBase64ToString(str2); | ||
2205 | int c = 0; | ||
2206 | for (int i = 0; i < src1.Length; i++) | ||
2207 | { | ||
2208 | ret += src1[i] ^ src2[c]; | ||
2209 | |||
2210 | c++; | ||
2211 | if (c > src2.Length) | ||
2212 | c = 0; | ||
2213 | } | ||
2214 | return llStringToBase64(ret); | ||
2215 | } | ||
2216 | |||
2217 | public void llHTTPRequest(string url, List<string> parameters, string body) | ||
2218 | { | ||
2219 | m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); | ||
2220 | } | ||
2221 | |||
2222 | public void llResetLandBanList() | ||
2223 | { | ||
2224 | NotImplemented("llResetLandBanList"); | ||
2225 | } | ||
2226 | |||
2227 | public void llResetLandPassList() | ||
2228 | { | ||
2229 | NotImplemented("llResetLandPassList"); | ||
2230 | } | ||
2231 | |||
2232 | public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) | ||
2233 | { | ||
2234 | NotImplemented("llGetParcelPrimCount"); | ||
2235 | return 0; | ||
2236 | } | ||
2237 | |||
2238 | public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) | ||
2239 | { | ||
2240 | NotImplemented("llGetParcelPrimOwners"); | ||
2241 | return new List<string>(); | ||
2242 | } | ||
2243 | |||
2244 | public int llGetObjectPrimCount(string object_id) | ||
2245 | { | ||
2246 | NotImplemented("llGetObjectPrimCount"); | ||
2247 | return 0; | ||
2248 | } | ||
2249 | |||
2250 | public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) | ||
2251 | { | ||
2252 | NotImplemented("llGetParcelMaxPrims"); | ||
2253 | return 0; | ||
2254 | } | ||
2255 | |||
2256 | public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) | ||
2257 | { | ||
2258 | NotImplemented("llGetParcelDetails"); | ||
2259 | return new List<string>(); | ||
2260 | } | ||
2261 | |||
2262 | // | ||
2263 | // OpenSim functions | ||
2264 | // | ||
2265 | public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, | ||
2266 | int timer) | ||
2267 | { | ||
2268 | if (dynamicID == "") | ||
2269 | { | ||
2270 | IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>(); | ||
2271 | LLUUID createdTexture = | ||
2272 | textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, | ||
2273 | extraParams, timer); | ||
2274 | return createdTexture.ToString(); | ||
2275 | } | ||
2276 | else | ||
2277 | { | ||
2278 | //TODO update existing dynamic textures | ||
2279 | } | ||
2280 | |||
2281 | return LLUUID.Zero.ToString(); | ||
2282 | } | ||
2283 | |||
2284 | private void NotImplemented(string Command) | ||
2285 | { | ||
2286 | if (throwErrorOnNotImplemented) | ||
2287 | throw new NotImplementedException("Command not implemented: " + Command); | ||
2288 | } | ||
2289 | } | ||
2290 | } | ||