aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs1600
1 files changed, 860 insertions, 740 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 90cd3b1..1017fd8 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -45,7 +45,13 @@ using OpenSim.Region.Environment.Scenes;
45using OpenSim.Region.Physics.Manager; 45using OpenSim.Region.Physics.Manager;
46using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; 46using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
47 47
48//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 48using LSL_Float = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLFloat;
49using LSL_Integer = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLInteger;
50using LSL_Key = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString;
51using LSL_List = OpenSim.Region.ScriptEngine.Common.LSL_Types.list;
52using LSL_Rotation = OpenSim.Region.ScriptEngine.Common.LSL_Types.Quaternion;
53using LSL_String = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString;
54using LSL_Vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3;
49 55
50namespace OpenSim.Region.ScriptEngine.Common 56namespace OpenSim.Region.ScriptEngine.Common
51{ 57{
@@ -61,6 +67,9 @@ namespace OpenSim.Region.ScriptEngine.Common
61 internal uint m_localID; 67 internal uint m_localID;
62 internal UUID m_itemID; 68 internal UUID m_itemID;
63 internal bool throwErrorOnNotImplemented = true; 69 internal bool throwErrorOnNotImplemented = true;
70 internal float m_delayFactor = 1.0f;
71 internal float m_distanceFactor = 1.0f;
72
64 73
65 public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) 74 public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
66 { 75 {
@@ -81,12 +90,9 @@ namespace OpenSim.Region.ScriptEngine.Common
81 90
82 } 91 }
83 92
84 private DateTime m_timer = DateTime.Now;
85 private string m_state = "default"; 93 private string m_state = "default";
94 private DateTime m_timer = DateTime.Now;
86 private bool m_waitingForScriptAnswer=false; 95 private bool m_waitingForScriptAnswer=false;
87 private float m_delayFactor = 1.0f;
88 private float m_distanceFactor = 1.0f;
89
90 96
91 protected void ScriptSleep(int delay) 97 protected void ScriptSleep(int delay)
92 { 98 {
@@ -96,6 +102,23 @@ namespace OpenSim.Region.ScriptEngine.Common
96 System.Threading.Thread.Sleep(delay); 102 System.Threading.Thread.Sleep(delay);
97 } 103 }
98 104
105 // Object never expires
106 public override Object InitializeLifetimeService()
107 {
108 ILease lease = (ILease)base.InitializeLifetimeService();
109
110 if (lease.CurrentState == LeaseState.Initial)
111 {
112 lease.InitialLeaseTime = TimeSpan.Zero;
113 }
114 return lease;
115 }
116
117 public Scene World
118 {
119 get { return m_ScriptEngine.World; }
120 }
121
99 public string State 122 public string State
100 { 123 {
101 get { return m_state; } 124 get { return m_state; }
@@ -127,23 +150,6 @@ namespace OpenSim.Region.ScriptEngine.Common
127 } 150 }
128 } 151 }
129 152
130 // Object never expires
131 public override Object InitializeLifetimeService()
132 {
133 ILease lease = (ILease)base.InitializeLifetimeService();
134
135 if (lease.CurrentState == LeaseState.Initial)
136 {
137 lease.InitialLeaseTime = TimeSpan.Zero;
138 }
139 return lease;
140 }
141
142 public Scene World
143 {
144 get { return m_ScriptEngine.World; }
145 }
146
147 // Extension commands use this: 153 // Extension commands use this:
148 public ICommander GetCommander(string name) 154 public ICommander GetCommander(string name)
149 { 155 {
@@ -220,68 +226,57 @@ namespace OpenSim.Region.ScriptEngine.Common
220 } 226 }
221 } 227 }
222 228
223 public void osSetRegionWaterHeight(double height)
224 {
225 m_host.AddScriptLPS(1);
226 //Check to make sure that the script's owner is the estate manager/master
227 //World.Permissions.GenericEstatePermission(
228 if (World.ExternalChecks.ExternalChecksCanBeGodLike(m_host.OwnerID))
229 {
230 World.EventManager.TriggerRequestChangeWaterHeight((float)height);
231 }
232 }
233
234 //These are the implementations of the various ll-functions used by the LSL scripts. 229 //These are the implementations of the various ll-functions used by the LSL scripts.
235 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 230 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
236 public double llSin(double f) 231 public LSL_Float llSin(double f)
237 { 232 {
238 m_host.AddScriptLPS(1); 233 m_host.AddScriptLPS(1);
239 return (double)Math.Sin(f); 234 return (double)Math.Sin(f);
240 } 235 }
241 236
242 public double llCos(double f) 237 public LSL_Float llCos(double f)
243 { 238 {
244 m_host.AddScriptLPS(1); 239 m_host.AddScriptLPS(1);
245 return (double)Math.Cos(f); 240 return (double)Math.Cos(f);
246 } 241 }
247 242
248 public double llTan(double f) 243 public LSL_Float llTan(double f)
249 { 244 {
250 m_host.AddScriptLPS(1); 245 m_host.AddScriptLPS(1);
251 return (double)Math.Tan(f); 246 return (double)Math.Tan(f);
252 } 247 }
253 248
254 public double llAtan2(double x, double y) 249 public LSL_Float llAtan2(double x, double y)
255 { 250 {
256 m_host.AddScriptLPS(1); 251 m_host.AddScriptLPS(1);
257 return (double)Math.Atan2(y, x); 252 return (double)Math.Atan2(y, x);
258 } 253 }
259 254
260 public double llSqrt(double f) 255 public LSL_Float llSqrt(double f)
261 { 256 {
262 m_host.AddScriptLPS(1); 257 m_host.AddScriptLPS(1);
263 return (double)Math.Sqrt(f); 258 return (double)Math.Sqrt(f);
264 } 259 }
265 260
266 public double llPow(double fbase, double fexponent) 261 public LSL_Float llPow(double fbase, double fexponent)
267 { 262 {
268 m_host.AddScriptLPS(1); 263 m_host.AddScriptLPS(1);
269 return (double)Math.Pow(fbase, fexponent); 264 return (double)Math.Pow(fbase, fexponent);
270 } 265 }
271 266
272 public LSL_Types.LSLInteger llAbs(int i) 267 public LSL_Integer llAbs(int i)
273 { 268 {
274 m_host.AddScriptLPS(1); 269 m_host.AddScriptLPS(1);
275 return (int)Math.Abs(i); 270 return (int)Math.Abs(i);
276 } 271 }
277 272
278 public double llFabs(double f) 273 public LSL_Float llFabs(double f)
279 { 274 {
280 m_host.AddScriptLPS(1); 275 m_host.AddScriptLPS(1);
281 return (double)Math.Abs(f); 276 return (double)Math.Abs(f);
282 } 277 }
283 278
284 public double llFrand(double mag) 279 public LSL_Float llFrand(double mag)
285 { 280 {
286 m_host.AddScriptLPS(1); 281 m_host.AddScriptLPS(1);
287 lock (Util.RandomClass) 282 lock (Util.RandomClass)
@@ -290,44 +285,44 @@ namespace OpenSim.Region.ScriptEngine.Common
290 } 285 }
291 } 286 }
292 287
293 public LSL_Types.LSLInteger llFloor(double f) 288 public LSL_Integer llFloor(double f)
294 { 289 {
295 m_host.AddScriptLPS(1); 290 m_host.AddScriptLPS(1);
296 return (int)Math.Floor(f); 291 return (int)Math.Floor(f);
297 } 292 }
298 293
299 public LSL_Types.LSLInteger llCeil(double f) 294 public LSL_Integer llCeil(double f)
300 { 295 {
301 m_host.AddScriptLPS(1); 296 m_host.AddScriptLPS(1);
302 return (int)Math.Ceiling(f); 297 return (int)Math.Ceiling(f);
303 } 298 }
304 299
305 // Xantor 01/May/2008 fixed midpointrounding (2.5 becomes 3.0 instead of 2.0, default = ToEven) 300 // Xantor 01/May/2008 fixed midpointrounding (2.5 becomes 3.0 instead of 2.0, default = ToEven)
306 public LSL_Types.LSLInteger llRound(double f) 301 public LSL_Integer llRound(double f)
307 { 302 {
308 m_host.AddScriptLPS(1); 303 m_host.AddScriptLPS(1);
309 return (int)Math.Round(f, MidpointRounding.AwayFromZero); 304 return (int)Math.Round(f, MidpointRounding.AwayFromZero);
310 } 305 }
311 306
312 //This next group are vector operations involving squaring and square root. ckrinke 307 //This next group are vector operations involving squaring and square root. ckrinke
313 public double llVecMag(LSL_Types.Vector3 v) 308 public LSL_Float llVecMag(LSL_Vector v)
314 { 309 {
315 m_host.AddScriptLPS(1); 310 m_host.AddScriptLPS(1);
316 return LSL_Types.Vector3.Mag(v); 311 return LSL_Vector.Mag(v);
317 } 312 }
318 313
319 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) 314 public LSL_Vector llVecNorm(LSL_Vector v)
320 { 315 {
321 m_host.AddScriptLPS(1); 316 m_host.AddScriptLPS(1);
322 double mag = LSL_Types.Vector3.Mag(v); 317 double mag = LSL_Vector.Mag(v);
323 LSL_Types.Vector3 nor = new LSL_Types.Vector3(); 318 LSL_Vector nor = new LSL_Vector();
324 nor.x = v.x / mag; 319 nor.x = v.x / mag;
325 nor.y = v.y / mag; 320 nor.y = v.y / mag;
326 nor.z = v.z / mag; 321 nor.z = v.z / mag;
327 return nor; 322 return nor;
328 } 323 }
329 324
330 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) 325 public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b)
331 { 326 {
332 m_host.AddScriptLPS(1); 327 m_host.AddScriptLPS(1);
333 double dx = a.x - b.x; 328 double dx = a.x - b.x;
@@ -350,23 +345,23 @@ namespace OpenSim.Region.ScriptEngine.Common
350 345
351 // Old implementation of llRot2Euler, now normalized 346 // Old implementation of llRot2Euler, now normalized
352 347
353 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) 348 public LSL_Vector llRot2Euler(LSL_Rotation r)
354 { 349 {
355 m_host.AddScriptLPS(1); 350 m_host.AddScriptLPS(1);
356 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke 351 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke
357 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.x * r.x, r.y * r.y, r.z * r.z, r.s * r.s); 352 LSL_Rotation t = new LSL_Rotation(r.x * r.x, r.y * r.y, r.z * r.z, r.s * r.s);
358 double m = (t.x + t.y + t.z + t.s); 353 double m = (t.x + t.y + t.z + t.s);
359 if (m == 0) return new LSL_Types.Vector3(); 354 if (m == 0) return new LSL_Vector();
360 double n = 2 * (r.y * r.s + r.x * r.z); 355 double n = 2 * (r.y * r.s + r.x * r.z);
361 double p = m * m - n * n; 356 double p = m * m - n * n;
362 if (p > 0) 357 if (p > 0)
363 return new LSL_Types.Vector3(NormalizeAngle(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s))), 358 return new LSL_Vector(NormalizeAngle(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s))),
364 NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))), 359 NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))),
365 NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)))); 360 NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s))));
366 else if (n > 0) 361 else if (n > 0)
367 return new LSL_Types.Vector3(0.0, Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); 362 return new LSL_Vector(0.0, Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
368 else 363 else
369 return new LSL_Types.Vector3(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); 364 return new LSL_Vector(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
370 } 365 }
371 366
372 /* From wiki: 367 /* From wiki:
@@ -414,7 +409,7 @@ namespace OpenSim.Region.ScriptEngine.Common
414 * Apparently in some cases this is better from a numerical precision perspective? 409 * Apparently in some cases this is better from a numerical precision perspective?
415 */ 410 */
416 411
417 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) 412 public LSL_Rotation llEuler2Rot(LSL_Vector v)
418 { 413 {
419 m_host.AddScriptLPS(1); 414 m_host.AddScriptLPS(1);
420 415
@@ -432,10 +427,10 @@ namespace OpenSim.Region.ScriptEngine.Common
432 z = s1*s2*c3+c1*c2*s3; 427 z = s1*s2*c3+c1*c2*s3;
433 s = c1*c2*c3-s1*s2*s3; 428 s = c1*c2*c3-s1*s2*s3;
434 429
435 return new LSL_Types.Quaternion(x, y, z, s); 430 return new LSL_Rotation(x, y, z, s);
436 } 431 }
437 432
438 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) 433 public LSL_Rotation llAxes2Rot(LSL_Vector fwd, LSL_Vector left, LSL_Vector up)
439 { 434 {
440 m_host.AddScriptLPS(1); 435 m_host.AddScriptLPS(1);
441 double x, y, z, s; 436 double x, y, z, s;
@@ -468,7 +463,7 @@ namespace OpenSim.Region.ScriptEngine.Common
468 if (f == 5) { z = -z; } 463 if (f == 5) { z = -z; }
469 if (f == 6) { y = -y; } 464 if (f == 6) { y = -y; }
470 465
471 LSL_Types.Quaternion result = new LSL_Types.Quaternion(x, y, z, s); 466 LSL_Rotation result = new LSL_Rotation(x, y, z, s);
472 467
473 // a hack to correct a few questionable angles :( 468 // a hack to correct a few questionable angles :(
474 if (llVecDist(llRot2Fwd(result), fwd) > 0.001 || llVecDist(llRot2Left(result), left) > 0.001) 469 if (llVecDist(llRot2Fwd(result), fwd) > 0.001 || llVecDist(llRot2Left(result), left) > 0.001)
@@ -477,7 +472,7 @@ namespace OpenSim.Region.ScriptEngine.Common
477 return result; 472 return result;
478 } 473 }
479 474
480 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) 475 public LSL_Vector llRot2Fwd(LSL_Rotation r)
481 { 476 {
482 m_host.AddScriptLPS(1); 477 m_host.AddScriptLPS(1);
483 478
@@ -499,10 +494,10 @@ namespace OpenSim.Region.ScriptEngine.Common
499 x = r.x * r.x - r.y * r.y - r.z * r.z + r.s * r.s; 494 x = r.x * r.x - r.y * r.y - r.z * r.z + r.s * r.s;
500 y = 2 * (r.x * r.y + r.z * r.s); 495 y = 2 * (r.x * r.y + r.z * r.s);
501 z = 2 * (r.x * r.z - r.y * r.s); 496 z = 2 * (r.x * r.z - r.y * r.s);
502 return (new LSL_Types.Vector3(x, y, z)); 497 return (new LSL_Vector(x, y, z));
503 } 498 }
504 499
505 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) 500 public LSL_Vector llRot2Left(LSL_Rotation r)
506 { 501 {
507 m_host.AddScriptLPS(1); 502 m_host.AddScriptLPS(1);
508 503
@@ -524,10 +519,10 @@ namespace OpenSim.Region.ScriptEngine.Common
524 x = 2 * (r.x * r.y - r.z * r.s); 519 x = 2 * (r.x * r.y - r.z * r.s);
525 y = -r.x * r.x + r.y * r.y - r.z * r.z + r.s * r.s; 520 y = -r.x * r.x + r.y * r.y - r.z * r.z + r.s * r.s;
526 z = 2 * (r.x * r.s + r.y * r.z); 521 z = 2 * (r.x * r.s + r.y * r.z);
527 return (new LSL_Types.Vector3(x, y, z)); 522 return (new LSL_Vector(x, y, z));
528 } 523 }
529 524
530 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) 525 public LSL_Vector llRot2Up(LSL_Rotation r)
531 { 526 {
532 m_host.AddScriptLPS(1); 527 m_host.AddScriptLPS(1);
533 double x, y, z, m; 528 double x, y, z, m;
@@ -548,18 +543,18 @@ namespace OpenSim.Region.ScriptEngine.Common
548 x = 2 * (r.x * r.z + r.y * r.s); 543 x = 2 * (r.x * r.z + r.y * r.s);
549 y = 2 * (-r.x * r.s + r.y * r.z); 544 y = 2 * (-r.x * r.s + r.y * r.z);
550 z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s; 545 z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s;
551 return (new LSL_Types.Vector3(x, y, z)); 546 return (new LSL_Vector(x, y, z));
552 } 547 }
553 548
554 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 a, LSL_Types.Vector3 b) 549 public LSL_Rotation llRotBetween(LSL_Vector a, LSL_Vector b)
555 { 550 {
556 //A and B should both be normalized 551 //A and B should both be normalized
557 m_host.AddScriptLPS(1); 552 m_host.AddScriptLPS(1);
558 double dotProduct = LSL_Types.Vector3.Dot(a, b); 553 double dotProduct = LSL_Vector.Dot(a, b);
559 LSL_Types.Vector3 crossProduct = LSL_Types.Vector3.Cross(a, b); 554 LSL_Vector crossProduct = LSL_Vector.Cross(a, b);
560 double magProduct = LSL_Types.Vector3.Mag(a) * LSL_Types.Vector3.Mag(b); 555 double magProduct = LSL_Vector.Mag(a) * LSL_Vector.Mag(b);
561 double angle = Math.Acos(dotProduct / magProduct); 556 double angle = Math.Acos(dotProduct / magProduct);
562 LSL_Types.Vector3 axis = LSL_Types.Vector3.Norm(crossProduct); 557 LSL_Vector axis = LSL_Vector.Norm(crossProduct);
563 double s = Math.Sin(angle / 2); 558 double s = Math.Sin(angle / 2);
564 559
565 double x = axis.x * s; 560 double x = axis.x * s;
@@ -568,9 +563,9 @@ namespace OpenSim.Region.ScriptEngine.Common
568 double w = Math.Cos(angle / 2); 563 double w = Math.Cos(angle / 2);
569 564
570 if (Double.IsNaN(x) || Double.IsNaN(y) || Double.IsNaN(z) || Double.IsNaN(w)) 565 if (Double.IsNaN(x) || Double.IsNaN(y) || Double.IsNaN(z) || Double.IsNaN(w))
571 return new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f); 566 return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
572 567
573 return new LSL_Types.Quaternion((float)x, (float)y, (float)z, (float)w); 568 return new LSL_Rotation((float)x, (float)y, (float)z, (float)w);
574 } 569 }
575 570
576 public void llWhisper(int channelID, string text) 571 public void llWhisper(int channelID, string text)
@@ -632,7 +627,7 @@ namespace OpenSim.Region.ScriptEngine.Common
632 wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); 627 wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text);
633 } 628 }
634 629
635 public LSL_Types.LSLInteger llListen(int channelID, string name, string ID, string msg) 630 public LSL_Integer llListen(int channelID, string name, string ID, string msg)
636 { 631 {
637 m_host.AddScriptLPS(1); 632 m_host.AddScriptLPS(1);
638 UUID keyID; 633 UUID keyID;
@@ -707,10 +702,10 @@ namespace OpenSim.Region.ScriptEngine.Common
707 return SensedObject.Name; 702 return SensedObject.Name;
708 } 703 }
709 704
710 public string llDetectedName(int number) 705 public LSL_String llDetectedName(int number)
711 { 706 {
712 m_host.AddScriptLPS(1); 707 m_host.AddScriptLPS(1);
713 LSL_Types.list SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID); 708 LSL_List SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID);
714 if (SenseList != null) 709 if (SenseList != null)
715 { 710 {
716 if ((number >= 0) && (number < SenseList.Length)) 711 if ((number >= 0) && (number < SenseList.Length))
@@ -750,7 +745,7 @@ namespace OpenSim.Region.ScriptEngine.Common
750 745
751 public UUID uuidDetectedKey(int number) 746 public UUID uuidDetectedKey(int number)
752 { 747 {
753 LSL_Types.list SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID); 748 LSL_List SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID);
754 if (SenseList != null) 749 if (SenseList != null)
755 { 750 {
756 if ((number >= 0) && (number < SenseList.Length)) 751 if ((number >= 0) && (number < SenseList.Length))
@@ -787,7 +782,7 @@ namespace OpenSim.Region.ScriptEngine.Common
787 782
788 public EntityBase entityDetectedKey(int number) 783 public EntityBase entityDetectedKey(int number)
789 { 784 {
790 LSL_Types.list SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID); 785 LSL_List SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID);
791 if (SenseList != null) 786 if (SenseList != null)
792 { 787 {
793 if ((number >= 0) && (number < SenseList.Length)) 788 if ((number >= 0) && (number < SenseList.Length))
@@ -834,7 +829,7 @@ namespace OpenSim.Region.ScriptEngine.Common
834 return null; 829 return null;
835 } 830 }
836 831
837 public string llDetectedKey(int number) 832 public LSL_String llDetectedKey(int number)
838 { 833 {
839 m_host.AddScriptLPS(1); 834 m_host.AddScriptLPS(1);
840 UUID SensedUUID = uuidDetectedKey(number); 835 UUID SensedUUID = uuidDetectedKey(number);
@@ -843,7 +838,7 @@ namespace OpenSim.Region.ScriptEngine.Common
843 return SensedUUID.ToString(); 838 return SensedUUID.ToString();
844 } 839 }
845 840
846 public string llDetectedOwner(int number) 841 public LSL_String llDetectedOwner(int number)
847 { 842 {
848 // returns UUID of owner of object detected 843 // returns UUID of owner of object detected
849 m_host.AddScriptLPS(1); 844 m_host.AddScriptLPS(1);
@@ -869,7 +864,7 @@ namespace OpenSim.Region.ScriptEngine.Common
869 864
870 } 865 }
871 866
872 public LSL_Types.LSLInteger llDetectedType(int number) 867 public LSL_Integer llDetectedType(int number)
873 { 868 {
874 m_host.AddScriptLPS(1); 869 m_host.AddScriptLPS(1);
875 EntityBase SensedObject = entityDetectedKey(number); 870 EntityBase SensedObject = entityDetectedKey(number);
@@ -878,7 +873,7 @@ namespace OpenSim.Region.ScriptEngine.Common
878 int mask = 0; 873 int mask = 0;
879 874
880 UUID SensedUUID = uuidDetectedKey(number); 875 UUID SensedUUID = uuidDetectedKey(number);
881 LSL_Types.Vector3 ZeroVector = new LSL_Types.Vector3(0, 0, 0); 876 LSL_Vector ZeroVector = new LSL_Vector(0, 0, 0);
882 877
883 if (World.GetScenePresence(SensedUUID) != null) mask |= 0x01; // actor 878 if (World.GetScenePresence(SensedUUID) != null) mask |= 0x01; // actor
884 if (SensedObject.Velocity.Equals(ZeroVector)) 879 if (SensedObject.Velocity.Equals(ZeroVector))
@@ -889,71 +884,71 @@ namespace OpenSim.Region.ScriptEngine.Common
889 return mask; 884 return mask;
890 } 885 }
891 886
892 public LSL_Types.Vector3 llDetectedPos(int number) 887 public LSL_Vector llDetectedPos(int number)
893 { 888 {
894 m_host.AddScriptLPS(1); 889 m_host.AddScriptLPS(1);
895 EntityBase SensedObject = entityDetectedKey(number); 890 EntityBase SensedObject = entityDetectedKey(number);
896 if (SensedObject == null) 891 if (SensedObject == null)
897 return new LSL_Types.Vector3(0, 0, 0); 892 return new LSL_Vector(0, 0, 0);
898 return new LSL_Types.Vector3( 893 return new LSL_Vector(
899 SensedObject.AbsolutePosition.X, 894 SensedObject.AbsolutePosition.X,
900 SensedObject.AbsolutePosition.Y, 895 SensedObject.AbsolutePosition.Y,
901 SensedObject.AbsolutePosition.Z); 896 SensedObject.AbsolutePosition.Z);
902 } 897 }
903 898
904 public LSL_Types.Vector3 llDetectedVel(int number) 899 public LSL_Vector llDetectedVel(int number)
905 { 900 {
906 m_host.AddScriptLPS(1); 901 m_host.AddScriptLPS(1);
907 EntityBase SensedObject = entityDetectedKey(number); 902 EntityBase SensedObject = entityDetectedKey(number);
908 if (SensedObject == null) 903 if (SensedObject == null)
909 return new LSL_Types.Vector3(0, 0, 0); 904 return new LSL_Vector(0, 0, 0);
910 return new LSL_Types.Vector3( 905 return new LSL_Vector(
911 SensedObject.Velocity.X, 906 SensedObject.Velocity.X,
912 SensedObject.Velocity.Y, 907 SensedObject.Velocity.Y,
913 SensedObject.Velocity.Z); 908 SensedObject.Velocity.Z);
914 } 909 }
915 910
916 public LSL_Types.Vector3 llDetectedGrab(int number) 911 public LSL_Vector llDetectedGrab(int number)
917 { 912 {
918 m_host.AddScriptLPS(1); 913 m_host.AddScriptLPS(1);
919 EntityBase SensedObject = entityDetectedKey(number); 914 EntityBase SensedObject = entityDetectedKey(number);
920 if (SensedObject == null) 915 if (SensedObject == null)
921 return new LSL_Types.Vector3(0, 0, 0); 916 return new LSL_Vector(0, 0, 0);
922 917
923 return new LSL_Types.Vector3( 918 return new LSL_Vector(
924 SensedObject.AbsolutePosition.X, 919 SensedObject.AbsolutePosition.X,
925 SensedObject.AbsolutePosition.Y, 920 SensedObject.AbsolutePosition.Y,
926 SensedObject.AbsolutePosition.Z); 921 SensedObject.AbsolutePosition.Z);
927 } 922 }
928 923
929 public LSL_Types.Quaternion llDetectedRot(int number) 924 public LSL_Rotation llDetectedRot(int number)
930 { 925 {
931 m_host.AddScriptLPS(1); 926 m_host.AddScriptLPS(1);
932 EntityBase SensedObject = entityDetectedKey(number); 927 EntityBase SensedObject = entityDetectedKey(number);
933 if (SensedObject == null) 928 if (SensedObject == null)
934 return new LSL_Types.Quaternion(); 929 return new LSL_Rotation();
935 return new LSL_Types.Quaternion( 930 return new LSL_Rotation(
936 SensedObject.Rotation.X, 931 SensedObject.Rotation.X,
937 SensedObject.Rotation.Y, 932 SensedObject.Rotation.Y,
938 SensedObject.Rotation.Z, 933 SensedObject.Rotation.Z,
939 SensedObject.Rotation.W); 934 SensedObject.Rotation.W);
940 } 935 }
941 936
942 public LSL_Types.LSLInteger llDetectedGroup(int number) 937 public LSL_Integer llDetectedGroup(int number)
943 { 938 {
944 m_host.AddScriptLPS(1); 939 m_host.AddScriptLPS(1);
945 UUID SensedUUID = uuidDetectedKey(number); 940 UUID SensedUUID = uuidDetectedKey(number);
946 if (SensedUUID == UUID.Zero) 941 if (SensedUUID == UUID.Zero)
947 return new LSL_Types.LSLInteger(0); 942 return new LSL_Integer(0);
948 ScenePresence presence = World.GetScenePresence(SensedUUID); 943 ScenePresence presence = World.GetScenePresence(SensedUUID);
949 IClientAPI client = presence.ControllingClient; 944 IClientAPI client = presence.ControllingClient;
950 if (m_host.GroupID == client.ActiveGroupId) 945 if (m_host.GroupID == client.ActiveGroupId)
951 return new LSL_Types.LSLInteger(1); 946 return new LSL_Integer(1);
952 else 947 else
953 return new LSL_Types.LSLInteger(0); 948 return new LSL_Integer(0);
954 } 949 }
955 950
956 public LSL_Types.LSLInteger llDetectedLinkNumber(int number) 951 public LSL_Integer llDetectedLinkNumber(int number)
957 { 952 {
958 m_host.AddScriptLPS(1); 953 m_host.AddScriptLPS(1);
959 EntityBase SensedObject = entityDetectedKey(number); 954 EntityBase SensedObject = entityDetectedKey(number);
@@ -962,13 +957,55 @@ namespace OpenSim.Region.ScriptEngine.Common
962 return m_host.LinkNum; 957 return m_host.LinkNum;
963 } 958 }
964 959
960 public LSL_Vector llDetectedTouchBinormal(int index)
961 {
962 m_host.AddScriptLPS(1);
963 NotImplemented("llDetectedTouchBinormal");
964 return new LSL_Vector();
965 }
966
967 public LSL_Integer llDetectedTouchFace(int index)
968 {
969 m_host.AddScriptLPS(1);
970 NotImplemented("llDetectedTouchFace");
971 return new LSL_Integer(0);
972 }
973
974 public LSL_Vector llDetectedTouchNormal(int index)
975 {
976 m_host.AddScriptLPS(1);
977 NotImplemented("llDetectedTouchNormal");
978 return new LSL_Vector();
979 }
980
981 public LSL_Vector llDetectedTouchPos(int index)
982 {
983 m_host.AddScriptLPS(1);
984 NotImplemented("llDetectedTouchPos");
985 return new LSL_Vector();
986 }
987
988 public LSL_Vector llDetectedTouchST(int index)
989 {
990 m_host.AddScriptLPS(1);
991 NotImplemented("llDetectedTouchST");
992 return new LSL_Vector();
993 }
994
995 public LSL_Vector llDetectedTouchUV(int index)
996 {
997 m_host.AddScriptLPS(1);
998 NotImplemented("llDetectedTouchUV");
999 return new LSL_Vector();
1000 }
1001
965 public void llDie() 1002 public void llDie()
966 { 1003 {
967 m_host.AddScriptLPS(1); 1004 m_host.AddScriptLPS(1);
968 World.DeleteSceneObject(m_host.ParentGroup); 1005 World.DeleteSceneObject(m_host.ParentGroup);
969 } 1006 }
970 1007
971 public double llGround(LSL_Types.Vector3 offset) 1008 public LSL_Float llGround(LSL_Vector offset)
972 { 1009 {
973 m_host.AddScriptLPS(1); 1010 m_host.AddScriptLPS(1);
974 int x = (int)(m_host.OffsetPosition.X + offset.x); 1011 int x = (int)(m_host.OffsetPosition.X + offset.x);
@@ -976,16 +1013,16 @@ namespace OpenSim.Region.ScriptEngine.Common
976 return World.GetLandHeight(x, y); 1013 return World.GetLandHeight(x, y);
977 } 1014 }
978 1015
979 public double llCloud(LSL_Types.Vector3 offset) 1016 public LSL_Float llCloud(LSL_Vector offset)
980 { 1017 {
981 m_host.AddScriptLPS(1); 1018 m_host.AddScriptLPS(1);
982 return 0; 1019 return 0;
983 } 1020 }
984 1021
985 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) 1022 public LSL_Vector llWind(LSL_Vector offset)
986 { 1023 {
987 m_host.AddScriptLPS(1); 1024 m_host.AddScriptLPS(1);
988 return new LSL_Types.Vector3(); 1025 return new LSL_Vector();
989 } 1026 }
990 1027
991 public void llSetStatus(int status, int value) 1028 public void llSetStatus(int status, int value)
@@ -1076,7 +1113,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1076 } 1113 }
1077 } 1114 }
1078 1115
1079 public LSL_Types.LSLInteger llGetStatus(int status) 1116 public LSL_Integer llGetStatus(int status)
1080 { 1117 {
1081 m_host.AddScriptLPS(1); 1118 m_host.AddScriptLPS(1);
1082 // Console.WriteLine(m_host.ToString() + " status is " + m_host.GetEffectiveObjectFlags().ToString()); 1119 // Console.WriteLine(m_host.ToString() + " status is " + m_host.GetEffectiveObjectFlags().ToString());
@@ -1136,13 +1173,13 @@ namespace OpenSim.Region.ScriptEngine.Common
1136 return 0; 1173 return 0;
1137 } 1174 }
1138 1175
1139 public void llSetScale(LSL_Types.Vector3 scale) 1176 public void llSetScale(LSL_Vector scale)
1140 { 1177 {
1141 m_host.AddScriptLPS(1); 1178 m_host.AddScriptLPS(1);
1142 SetScale(m_host, scale); 1179 SetScale(m_host, scale);
1143 } 1180 }
1144 1181
1145 private void SetScale(SceneObjectPart part, LSL_Types.Vector3 scale) 1182 private void SetScale(SceneObjectPart part, LSL_Vector scale)
1146 { 1183 {
1147 // TODO: this needs to trigger a persistance save as well 1184 // TODO: this needs to trigger a persistance save as well
1148 1185
@@ -1172,24 +1209,31 @@ namespace OpenSim.Region.ScriptEngine.Common
1172 part.SendFullUpdateToAllClients(); 1209 part.SendFullUpdateToAllClients();
1173 } 1210 }
1174 1211
1175 public LSL_Types.Vector3 llGetScale() 1212 public LSL_Vector llGetScale()
1213 {
1214 m_host.AddScriptLPS(1);
1215 return new LSL_Vector(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z);
1216 }
1217
1218 public void llSetClickAction(int action)
1176 { 1219 {
1177 m_host.AddScriptLPS(1); 1220 m_host.AddScriptLPS(1);
1178 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); 1221 NotImplemented("llSetClickAction");
1222 return;
1179 } 1223 }
1180 1224
1181 public void llSetColor(LSL_Types.Vector3 color, int face) 1225 public void llSetColor(LSL_Vector color, int face)
1182 { 1226 {
1183 m_host.AddScriptLPS(1); 1227 m_host.AddScriptLPS(1);
1184 1228
1185 SetColor(m_host, color, face); 1229 SetColor(m_host, color, face);
1186 } 1230 }
1187 1231
1188 private void SetColor(SceneObjectPart part, LSL_Types.Vector3 color, int face) 1232 private void SetColor(SceneObjectPart part, LSL_Vector color, int face)
1189 { 1233 {
1190 Primitive.TextureEntry tex = part.Shape.Textures; 1234 Primitive.TextureEntry tex = part.Shape.Textures;
1191 Color4 texcolor; 1235 Color4 texcolor;
1192 if (face > -1) 1236 if (face >= 0 && face < GetNumberOfSides(part))
1193 { 1237 {
1194 texcolor = tex.CreateFace((uint)face).RGBA; 1238 texcolor = tex.CreateFace((uint)face).RGBA;
1195 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); 1239 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
@@ -1199,9 +1243,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1199 part.UpdateTexture(tex); 1243 part.UpdateTexture(tex);
1200 return; 1244 return;
1201 } 1245 }
1202 else if (face == -1) 1246 else if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1203 { 1247 {
1204 for (uint i = 0; i < 32; i++) 1248 for (uint i = 0; i < GetNumberOfSides(part); i++)
1205 { 1249 {
1206 if (tex.FaceTextures[i] != null) 1250 if (tex.FaceTextures[i] != null)
1207 { 1251 {
@@ -1225,16 +1269,16 @@ namespace OpenSim.Region.ScriptEngine.Common
1225 public void SetGlow(SceneObjectPart part, int face, float glow) 1269 public void SetGlow(SceneObjectPart part, int face, float glow)
1226 { 1270 {
1227 Primitive.TextureEntry tex = part.Shape.Textures; 1271 Primitive.TextureEntry tex = part.Shape.Textures;
1228 if (face > -1) 1272 if (face >= 0 && face < GetNumberOfSides(part))
1229 { 1273 {
1230 tex.CreateFace((uint) face); 1274 tex.CreateFace((uint) face);
1231 tex.FaceTextures[face].Glow = glow; 1275 tex.FaceTextures[face].Glow = glow;
1232 part.UpdateTexture(tex); 1276 part.UpdateTexture(tex);
1233 return; 1277 return;
1234 } 1278 }
1235 else if (face == -1) 1279 else if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1236 { 1280 {
1237 for (uint i = 0; i < 32; i++) 1281 for (uint i = 0; i < GetNumberOfSides(part); i++)
1238 { 1282 {
1239 if (tex.FaceTextures[i] != null) 1283 if (tex.FaceTextures[i] != null)
1240 { 1284 {
@@ -1272,7 +1316,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1272 } 1316 }
1273 1317
1274 Primitive.TextureEntry tex = part.Shape.Textures; 1318 Primitive.TextureEntry tex = part.Shape.Textures;
1275 if (face > -1) 1319 if (face >= 0 && face < GetNumberOfSides(part))
1276 { 1320 {
1277 tex.CreateFace((uint) face); 1321 tex.CreateFace((uint) face);
1278 tex.FaceTextures[face].Shiny = sval; 1322 tex.FaceTextures[face].Shiny = sval;
@@ -1280,9 +1324,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1280 part.UpdateTexture(tex); 1324 part.UpdateTexture(tex);
1281 return; 1325 return;
1282 } 1326 }
1283 else if (face == -1) 1327 else if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1284 { 1328 {
1285 for (uint i = 0; i < 32; i++) 1329 for (uint i = 0; i < GetNumberOfSides(part); i++)
1286 { 1330 {
1287 if (tex.FaceTextures[i] != null) 1331 if (tex.FaceTextures[i] != null)
1288 { 1332 {
@@ -1300,16 +1344,16 @@ namespace OpenSim.Region.ScriptEngine.Common
1300 public void SetFullBright(SceneObjectPart part, int face, bool bright) 1344 public void SetFullBright(SceneObjectPart part, int face, bool bright)
1301 { 1345 {
1302 Primitive.TextureEntry tex = part.Shape.Textures; 1346 Primitive.TextureEntry tex = part.Shape.Textures;
1303 if (face > -1) 1347 if (face >= 0 && face < GetNumberOfSides(part))
1304 { 1348 {
1305 tex.CreateFace((uint) face); 1349 tex.CreateFace((uint) face);
1306 tex.FaceTextures[face].Fullbright = bright; 1350 tex.FaceTextures[face].Fullbright = bright;
1307 part.UpdateTexture(tex); 1351 part.UpdateTexture(tex);
1308 return; 1352 return;
1309 } 1353 }
1310 else if (face == -1) 1354 else if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1311 { 1355 {
1312 for (uint i = 0; i < 32; i++) 1356 for (uint i = 0; i < GetNumberOfSides(part); i++)
1313 { 1357 {
1314 if (tex.FaceTextures[i] != null) 1358 if (tex.FaceTextures[i] != null)
1315 { 1359 {
@@ -1322,19 +1366,28 @@ namespace OpenSim.Region.ScriptEngine.Common
1322 } 1366 }
1323 } 1367 }
1324 1368
1325 public double llGetAlpha(int face) 1369 public LSL_Float llGetAlpha(int face)
1326 { 1370 {
1327 m_host.AddScriptLPS(1); 1371 m_host.AddScriptLPS(1);
1328 Primitive.TextureEntry tex = m_host.Shape.Textures; 1372 return GetAlpha(m_host, face);
1329 if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color 1373 }
1374
1375 private LSL_Float GetAlpha(SceneObjectPart part, int face)
1376 {
1377 Primitive.TextureEntry tex = part.Shape.Textures;
1378 if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1330 { 1379 {
1331 return (double)((tex.DefaultTexture.RGBA.A * 255) / 255); 1380 int i;
1381 double sum = 0.0;
1382 for (i = 0 ; i < GetNumberOfSides(part) ; i++)
1383 sum += (double)tex.GetFace((uint)i).RGBA.A;
1384 return sum;
1332 } 1385 }
1333 if (face > -1) 1386 if (face >= 0 && face < GetNumberOfSides(part))
1334 { 1387 {
1335 return (double)((tex.GetFace((uint)face).RGBA.A * 255) / 255); 1388 return (double)tex.GetFace((uint)face).RGBA.A;
1336 } 1389 }
1337 return 0; 1390 return 0.0;
1338 } 1391 }
1339 1392
1340 public void llSetAlpha(double alpha, int face) 1393 public void llSetAlpha(double alpha, int face)
@@ -1348,7 +1401,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1348 { 1401 {
1349 Primitive.TextureEntry tex = part.Shape.Textures; 1402 Primitive.TextureEntry tex = part.Shape.Textures;
1350 Color4 texcolor; 1403 Color4 texcolor;
1351 if (face > -1) 1404 if (face >= 0 && face < GetNumberOfSides(part))
1352 { 1405 {
1353 texcolor = tex.CreateFace((uint)face).RGBA; 1406 texcolor = tex.CreateFace((uint)face).RGBA;
1354 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); 1407 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
@@ -1356,9 +1409,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1356 part.UpdateTexture(tex); 1409 part.UpdateTexture(tex);
1357 return; 1410 return;
1358 } 1411 }
1359 else if (face == -1) 1412 else if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1360 { 1413 {
1361 for (int i = 0; i < 32; i++) 1414 for (int i = 0; i < GetNumberOfSides(part); i++)
1362 { 1415 {
1363 if (tex.FaceTextures[i] != null) 1416 if (tex.FaceTextures[i] != null)
1364 { 1417 {
@@ -1389,7 +1442,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1389 /// <param name="tension"></param> 1442 /// <param name="tension"></param>
1390 /// <param name="Force"></param> 1443 /// <param name="Force"></param>
1391 private void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction, 1444 private void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction,
1392 float wind, float tension, LSL_Types.Vector3 Force) 1445 float wind, float tension, LSL_Vector Force)
1393 { 1446 {
1394 if (part == null) 1447 if (part == null)
1395 return; 1448 return;
@@ -1447,7 +1500,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1447 /// <param name="intensity"></param> 1500 /// <param name="intensity"></param>
1448 /// <param name="radius"></param> 1501 /// <param name="radius"></param>
1449 /// <param name="falloff"></param> 1502 /// <param name="falloff"></param>
1450 private void SetPointLight(SceneObjectPart part, bool light, LSL_Types.Vector3 color, float intensity, float radius, float falloff) 1503 private void SetPointLight(SceneObjectPart part, bool light, LSL_Vector color, float intensity, float radius, float falloff)
1451 { 1504 {
1452 if (part == null) 1505 if (part == null)
1453 return; 1506 return;
@@ -1471,31 +1524,46 @@ namespace OpenSim.Region.ScriptEngine.Common
1471 part.ScheduleFullUpdate(); 1524 part.ScheduleFullUpdate();
1472 } 1525 }
1473 1526
1474 public LSL_Types.Vector3 llGetColor(int face) 1527 public LSL_Vector llGetColor(int face)
1475 { 1528 {
1476 m_host.AddScriptLPS(1); 1529 m_host.AddScriptLPS(1);
1477 Primitive.TextureEntry tex = m_host.Shape.Textures; 1530 return GetColor(m_host, face);
1531 }
1532
1533 private LSL_Vector GetColor(SceneObjectPart part, int face)
1534 {
1535 Primitive.TextureEntry tex = part.Shape.Textures;
1478 Color4 texcolor; 1536 Color4 texcolor;
1479 LSL_Types.Vector3 rgb; 1537 LSL_Vector rgb = new LSL_Vector();
1480 if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color 1538 if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1481 { 1539 {
1482 texcolor = tex.DefaultTexture.RGBA; 1540 int i;
1483 rgb.x = (255 - (texcolor.R * 255)) / 255; 1541
1484 rgb.y = (255 - (texcolor.G * 255)) / 255; 1542 for (i = 0 ; i < GetNumberOfSides(part) ; i++)
1485 rgb.z = (255 - (texcolor.B * 255)) / 255; 1543 {
1544 texcolor = tex.GetFace((uint)i).RGBA;
1545 rgb.x += texcolor.R;
1546 rgb.y += texcolor.G;
1547 rgb.z += texcolor.B;
1548 }
1549
1550 rgb.x /= (float)GetNumberOfSides(part);
1551 rgb.y /= (float)GetNumberOfSides(part);
1552 rgb.z /= (float)GetNumberOfSides(part);
1553
1486 return rgb; 1554 return rgb;
1487 } 1555 }
1488 if (face > -1) 1556 if (face >= 0 && face < GetNumberOfSides(part))
1489 { 1557 {
1490 texcolor = tex.GetFace((uint)face).RGBA; 1558 texcolor = tex.GetFace((uint)face).RGBA;
1491 rgb.x = (255 - (texcolor.R * 255)) / 255; 1559 rgb.x = texcolor.R;
1492 rgb.y = (255 - (texcolor.G * 255)) / 255; 1560 rgb.y = texcolor.G;
1493 rgb.z = (255 - (texcolor.B * 255)) / 255; 1561 rgb.z = texcolor.B;
1494 return rgb; 1562 return rgb;
1495 } 1563 }
1496 else 1564 else
1497 { 1565 {
1498 return new LSL_Types.Vector3(); 1566 return new LSL_Vector();
1499 } 1567 }
1500 } 1568 }
1501 1569
@@ -1520,7 +1588,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1520 1588
1521 Primitive.TextureEntry tex = part.Shape.Textures; 1589 Primitive.TextureEntry tex = part.Shape.Textures;
1522 1590
1523 if (face > -1) 1591 if (face >= 0 && face < GetNumberOfSides(part))
1524 { 1592 {
1525 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1593 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1526 texface.TextureID = textureID; 1594 texface.TextureID = textureID;
@@ -1528,9 +1596,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1528 part.UpdateTexture(tex); 1596 part.UpdateTexture(tex);
1529 return; 1597 return;
1530 } 1598 }
1531 else if (face == -1) 1599 else if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1532 { 1600 {
1533 for (uint i = 0; i < 32; i++) 1601 for (uint i = 0; i < GetNumberOfSides(part); i++)
1534 { 1602 {
1535 if (tex.FaceTextures[i] != null) 1603 if (tex.FaceTextures[i] != null)
1536 { 1604 {
@@ -1554,7 +1622,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1554 private void ScaleTexture(SceneObjectPart part, double u, double v, int face) 1622 private void ScaleTexture(SceneObjectPart part, double u, double v, int face)
1555 { 1623 {
1556 Primitive.TextureEntry tex = part.Shape.Textures; 1624 Primitive.TextureEntry tex = part.Shape.Textures;
1557 if (face > -1) 1625 if (face >= 0 && face < GetNumberOfSides(part))
1558 { 1626 {
1559 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1627 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1560 texface.RepeatU = (float)u; 1628 texface.RepeatU = (float)u;
@@ -1563,9 +1631,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1563 part.UpdateTexture(tex); 1631 part.UpdateTexture(tex);
1564 return; 1632 return;
1565 } 1633 }
1566 if (face == -1) 1634 if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1567 { 1635 {
1568 for (int i = 0; i < 32; i++) 1636 for (int i = 0; i < GetNumberOfSides(part); i++)
1569 { 1637 {
1570 if (tex.FaceTextures[i] != null) 1638 if (tex.FaceTextures[i] != null)
1571 { 1639 {
@@ -1590,7 +1658,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1590 private void OffsetTexture(SceneObjectPart part, double u, double v, int face) 1658 private void OffsetTexture(SceneObjectPart part, double u, double v, int face)
1591 { 1659 {
1592 Primitive.TextureEntry tex = part.Shape.Textures; 1660 Primitive.TextureEntry tex = part.Shape.Textures;
1593 if (face > -1) 1661 if (face >= 0 && face < GetNumberOfSides(part))
1594 { 1662 {
1595 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1663 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1596 texface.OffsetU = (float)u; 1664 texface.OffsetU = (float)u;
@@ -1599,9 +1667,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1599 part.UpdateTexture(tex); 1667 part.UpdateTexture(tex);
1600 return; 1668 return;
1601 } 1669 }
1602 if (face == -1) 1670 if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1603 { 1671 {
1604 for (int i = 0; i < 32; i++) 1672 for (int i = 0; i < GetNumberOfSides(part); i++)
1605 { 1673 {
1606 if (tex.FaceTextures[i] != null) 1674 if (tex.FaceTextures[i] != null)
1607 { 1675 {
@@ -1626,7 +1694,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1626 private void RotateTexture(SceneObjectPart part, double rotation, int face) 1694 private void RotateTexture(SceneObjectPart part, double rotation, int face)
1627 { 1695 {
1628 Primitive.TextureEntry tex = part.Shape.Textures; 1696 Primitive.TextureEntry tex = part.Shape.Textures;
1629 if (face > -1) 1697 if (face >= 0 && face < GetNumberOfSides(part))
1630 { 1698 {
1631 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1699 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1632 texface.Rotation = (float)rotation; 1700 texface.Rotation = (float)rotation;
@@ -1634,9 +1702,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1634 part.UpdateTexture(tex); 1702 part.UpdateTexture(tex);
1635 return; 1703 return;
1636 } 1704 }
1637 if (face == -1) 1705 if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1638 { 1706 {
1639 for (int i = 0; i < 32; i++) 1707 for (int i = 0; i < GetNumberOfSides(part); i++)
1640 { 1708 {
1641 if (tex.FaceTextures[i] != null) 1709 if (tex.FaceTextures[i] != null)
1642 { 1710 {
@@ -1649,15 +1717,20 @@ namespace OpenSim.Region.ScriptEngine.Common
1649 } 1717 }
1650 } 1718 }
1651 1719
1652 public string llGetTexture(int face) 1720 public LSL_String llGetTexture(int face)
1653 { 1721 {
1654 m_host.AddScriptLPS(1); 1722 m_host.AddScriptLPS(1);
1655 Primitive.TextureEntry tex = m_host.Shape.Textures; 1723 return GetTexture(m_host, face);
1656 if (face == -1) 1724 }
1725
1726 private LSL_String GetTexture(SceneObjectPart part, int face)
1727 {
1728 Primitive.TextureEntry tex = part.Shape.Textures;
1729 if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
1657 { 1730 {
1658 face = 0; 1731 face = 0;
1659 } 1732 }
1660 if (face > -1) 1733 if (face >= 0 && face < GetNumberOfSides(part))
1661 { 1734 {
1662 Primitive.TextureEntryFace texface; 1735 Primitive.TextureEntryFace texface;
1663 texface = tex.GetFace((uint)face); 1736 texface = tex.GetFace((uint)face);
@@ -1669,7 +1742,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1669 } 1742 }
1670 } 1743 }
1671 1744
1672 public void llSetPos(LSL_Types.Vector3 pos) 1745 public void llSetPos(LSL_Vector pos)
1673 { 1746 {
1674 m_host.AddScriptLPS(1); 1747 m_host.AddScriptLPS(1);
1675 1748
@@ -1678,10 +1751,10 @@ namespace OpenSim.Region.ScriptEngine.Common
1678 ScriptSleep(200); 1751 ScriptSleep(200);
1679 } 1752 }
1680 1753
1681 private void SetPos(SceneObjectPart part, LSL_Types.Vector3 targetPos) 1754 private void SetPos(SceneObjectPart part, LSL_Vector targetPos)
1682 { 1755 {
1683 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) 1756 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
1684 LSL_Types.Vector3 currentPos = llGetLocalPos(); 1757 LSL_Vector currentPos = llGetLocalPos();
1685 if (llVecDist(currentPos, targetPos) > 10.0f * m_distanceFactor) 1758 if (llVecDist(currentPos, targetPos) > 10.0f * m_distanceFactor)
1686 { 1759 {
1687 targetPos = currentPos + m_distanceFactor * 10.0f * llVecNorm(targetPos - currentPos); 1760 targetPos = currentPos + m_distanceFactor * 10.0f * llVecNorm(targetPos - currentPos);
@@ -1697,32 +1770,32 @@ namespace OpenSim.Region.ScriptEngine.Common
1697 } 1770 }
1698 } 1771 }
1699 1772
1700 public LSL_Types.Vector3 llGetPos() 1773 public LSL_Vector llGetPos()
1701 { 1774 {
1702 m_host.AddScriptLPS(1); 1775 m_host.AddScriptLPS(1);
1703 return new LSL_Types.Vector3(m_host.AbsolutePosition.X, 1776 return new LSL_Vector(m_host.AbsolutePosition.X,
1704 m_host.AbsolutePosition.Y, 1777 m_host.AbsolutePosition.Y,
1705 m_host.AbsolutePosition.Z); 1778 m_host.AbsolutePosition.Z);
1706 } 1779 }
1707 1780
1708 public LSL_Types.Vector3 llGetLocalPos() 1781 public LSL_Vector llGetLocalPos()
1709 { 1782 {
1710 m_host.AddScriptLPS(1); 1783 m_host.AddScriptLPS(1);
1711 if (m_host.ParentID != 0) 1784 if (m_host.ParentID != 0)
1712 { 1785 {
1713 return new LSL_Types.Vector3(m_host.OffsetPosition.X, 1786 return new LSL_Vector(m_host.OffsetPosition.X,
1714 m_host.OffsetPosition.Y, 1787 m_host.OffsetPosition.Y,
1715 m_host.OffsetPosition.Z); 1788 m_host.OffsetPosition.Z);
1716 } 1789 }
1717 else 1790 else
1718 { 1791 {
1719 return new LSL_Types.Vector3(m_host.AbsolutePosition.X, 1792 return new LSL_Vector(m_host.AbsolutePosition.X,
1720 m_host.AbsolutePosition.Y, 1793 m_host.AbsolutePosition.Y,
1721 m_host.AbsolutePosition.Z); 1794 m_host.AbsolutePosition.Z);
1722 } 1795 }
1723 } 1796 }
1724 1797
1725 public void llSetRot(LSL_Types.Quaternion rot) 1798 public void llSetRot(LSL_Rotation rot)
1726 { 1799 {
1727 m_host.AddScriptLPS(1); 1800 m_host.AddScriptLPS(1);
1728 1801
@@ -1731,31 +1804,27 @@ namespace OpenSim.Region.ScriptEngine.Common
1731 ScriptSleep(200); 1804 ScriptSleep(200);
1732 } 1805 }
1733 1806
1734 private void SetRot(SceneObjectPart part, LSL_Types.Quaternion rot) 1807 private void SetRot(SceneObjectPart part, LSL_Rotation rot)
1735 { 1808 {
1736 part.UpdateRotation(new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s)); 1809 part.UpdateRotation(new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s));
1737 // Update rotation does not move the object in the physics scene if it's a linkset. 1810 // Update rotation does not move the object in the physics scene if it's a linkset.
1738 part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; 1811 part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
1739 } 1812 }
1740 1813
1741 public LSL_Types.Quaternion llGetRot() 1814 public LSL_Rotation llGetRot()
1742 { 1815 {
1743 m_host.AddScriptLPS(1); 1816 m_host.AddScriptLPS(1);
1744 Quaternion q = m_host.RotationOffset; 1817 Quaternion q = m_host.RotationOffset;
1745 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 1818 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
1746 } 1819 }
1747 1820
1748 public LSL_Types.Quaternion llGetLocalRot() 1821 public LSL_Rotation llGetLocalRot()
1749 { 1822 {
1750 m_host.AddScriptLPS(1); 1823 m_host.AddScriptLPS(1);
1751 return new LSL_Types.Quaternion( 1824 return new LSL_Rotation(m_host.RotationOffset.X, m_host.RotationOffset.Y, m_host.RotationOffset.Z, m_host.RotationOffset.W);
1752 m_host.RotationOffset.X,
1753 m_host.RotationOffset.Y,
1754 m_host.RotationOffset.Z,
1755 m_host.RotationOffset.W);
1756 } 1825 }
1757 1826
1758 public void llSetForce(LSL_Types.Vector3 force, int local) 1827 public void llSetForce(LSL_Vector force, int local)
1759 { 1828 {
1760 m_host.AddScriptLPS(1); 1829 m_host.AddScriptLPS(1);
1761 1830
@@ -1771,9 +1840,9 @@ namespace OpenSim.Region.ScriptEngine.Common
1771 } 1840 }
1772 } 1841 }
1773 1842
1774 public LSL_Types.Vector3 llGetForce() 1843 public LSL_Vector llGetForce()
1775 { 1844 {
1776 LSL_Types.Vector3 force = new LSL_Types.Vector3(0.0, 0.0, 0.0); 1845 LSL_Vector force = new LSL_Vector(0.0, 0.0, 0.0);
1777 1846
1778 m_host.AddScriptLPS(1); 1847 m_host.AddScriptLPS(1);
1779 1848
@@ -1791,11 +1860,10 @@ namespace OpenSim.Region.ScriptEngine.Common
1791 return force; 1860 return force;
1792 } 1861 }
1793 1862
1794 public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range) 1863 public LSL_Integer llTarget(LSL_Vector position, double range)
1795 { 1864 {
1796 m_host.AddScriptLPS(1); 1865 m_host.AddScriptLPS(1);
1797 return m_host.registerTargetWaypoint(new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range); 1866 return m_host.registerTargetWaypoint(new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range);
1798
1799 } 1867 }
1800 1868
1801 public void llTargetRemove(int number) 1869 public void llTargetRemove(int number)
@@ -1804,7 +1872,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1804 m_host.unregisterTargetWaypoint(number); 1872 m_host.unregisterTargetWaypoint(number);
1805 } 1873 }
1806 1874
1807 public LSL_Types.LSLInteger llRotTarget(LSL_Types.Quaternion rot, double error) 1875 public LSL_Integer llRotTarget(LSL_Rotation rot, double error)
1808 { 1876 {
1809 m_host.AddScriptLPS(1); 1877 m_host.AddScriptLPS(1);
1810 NotImplemented("llRotTarget"); 1878 NotImplemented("llRotTarget");
@@ -1817,7 +1885,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1817 NotImplemented("llRotTargetRemove"); 1885 NotImplemented("llRotTargetRemove");
1818 } 1886 }
1819 1887
1820 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) 1888 public void llMoveToTarget(LSL_Vector target, double tau)
1821 { 1889 {
1822 m_host.AddScriptLPS(1); 1890 m_host.AddScriptLPS(1);
1823 m_host.MoveToTarget(new Vector3((float)target.x, (float)target.y, (float)target.z), (float)tau); 1891 m_host.MoveToTarget(new Vector3((float)target.x, (float)target.y, (float)target.z), (float)tau);
@@ -1829,7 +1897,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1829 m_host.StopMoveToTarget(); 1897 m_host.StopMoveToTarget();
1830 } 1898 }
1831 1899
1832 public void llApplyImpulse(LSL_Types.Vector3 force, int local) 1900 public void llApplyImpulse(LSL_Vector force, int local)
1833 { 1901 {
1834 m_host.AddScriptLPS(1); 1902 m_host.AddScriptLPS(1);
1835 //No energy force yet 1903 //No energy force yet
@@ -1844,62 +1912,62 @@ namespace OpenSim.Region.ScriptEngine.Common
1844 m_host.ApplyImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); 1912 m_host.ApplyImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0);
1845 } 1913 }
1846 1914
1847 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) 1915 public void llApplyRotationalImpulse(LSL_Vector force, int local)
1848 { 1916 {
1849 m_host.AddScriptLPS(1); 1917 m_host.AddScriptLPS(1);
1850 NotImplemented("llApplyRotationalImpulse"); 1918 NotImplemented("llApplyRotationalImpulse");
1851 } 1919 }
1852 1920
1853 public void llSetTorque(LSL_Types.Vector3 torque, int local) 1921 public void llSetTorque(LSL_Vector torque, int local)
1854 { 1922 {
1855 m_host.AddScriptLPS(1); 1923 m_host.AddScriptLPS(1);
1856 NotImplemented("llSetTorque"); 1924 NotImplemented("llSetTorque");
1857 } 1925 }
1858 1926
1859 public LSL_Types.Vector3 llGetTorque() 1927 public LSL_Vector llGetTorque()
1860 { 1928 {
1861 m_host.AddScriptLPS(1); 1929 m_host.AddScriptLPS(1);
1862 NotImplemented("llGetTorque"); 1930 NotImplemented("llGetTorque");
1863 return new LSL_Types.Vector3(); 1931 return new LSL_Vector();
1864 } 1932 }
1865 1933
1866 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) 1934 public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local)
1867 { 1935 {
1868 m_host.AddScriptLPS(1); 1936 m_host.AddScriptLPS(1);
1869 NotImplemented("llSetForceAndTorque"); 1937 NotImplemented("llSetForceAndTorque");
1870 } 1938 }
1871 1939
1872 public LSL_Types.Vector3 llGetVel() 1940 public LSL_Vector llGetVel()
1873 { 1941 {
1874 m_host.AddScriptLPS(1); 1942 m_host.AddScriptLPS(1);
1875 return new LSL_Types.Vector3(m_host.Velocity.X, m_host.Velocity.Y, m_host.Velocity.Z); 1943 return new LSL_Vector(m_host.Velocity.X, m_host.Velocity.Y, m_host.Velocity.Z);
1876 } 1944 }
1877 1945
1878 public LSL_Types.Vector3 llGetAccel() 1946 public LSL_Vector llGetAccel()
1879 { 1947 {
1880 m_host.AddScriptLPS(1); 1948 m_host.AddScriptLPS(1);
1881 return new LSL_Types.Vector3(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z); 1949 return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z);
1882 } 1950 }
1883 1951
1884 public LSL_Types.Vector3 llGetOmega() 1952 public LSL_Vector llGetOmega()
1885 { 1953 {
1886 m_host.AddScriptLPS(1); 1954 m_host.AddScriptLPS(1);
1887 return new LSL_Types.Vector3(m_host.RotationalVelocity.X, m_host.RotationalVelocity.Y, m_host.RotationalVelocity.Z); 1955 return new LSL_Vector(m_host.RotationalVelocity.X, m_host.RotationalVelocity.Y, m_host.RotationalVelocity.Z);
1888 } 1956 }
1889 1957
1890 public double llGetTimeOfDay() 1958 public LSL_Float llGetTimeOfDay()
1891 { 1959 {
1892 m_host.AddScriptLPS(1); 1960 m_host.AddScriptLPS(1);
1893 return (double)(((DateTime.Now.TimeOfDay.TotalMilliseconds / 1000) % (3600 * 4)) * World.TimeDilation); 1961 return (double)(((DateTime.Now.TimeOfDay.TotalMilliseconds / 1000) % (3600 * 4)) * World.TimeDilation);
1894 } 1962 }
1895 1963
1896 public double llGetWallclock() 1964 public LSL_Float llGetWallclock()
1897 { 1965 {
1898 m_host.AddScriptLPS(1); 1966 m_host.AddScriptLPS(1);
1899 return DateTime.Now.TimeOfDay.TotalSeconds; 1967 return DateTime.Now.TimeOfDay.TotalSeconds;
1900 } 1968 }
1901 1969
1902 public double llGetTime() 1970 public LSL_Float llGetTime()
1903 { 1971 {
1904 m_host.AddScriptLPS(1); 1972 m_host.AddScriptLPS(1);
1905 TimeSpan ScriptTime = DateTime.Now - m_timer; 1973 TimeSpan ScriptTime = DateTime.Now - m_timer;
@@ -1912,7 +1980,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1912 m_timer = DateTime.Now; 1980 m_timer = DateTime.Now;
1913 } 1981 }
1914 1982
1915 public double llGetAndResetTime() 1983 public LSL_Float llGetAndResetTime()
1916 { 1984 {
1917 m_host.AddScriptLPS(1); 1985 m_host.AddScriptLPS(1);
1918 TimeSpan ScriptTime = DateTime.Now - m_timer; 1986 TimeSpan ScriptTime = DateTime.Now - m_timer;
@@ -2017,7 +2085,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2017 /// this more complicated than it might otherwise seem. 2085 /// this more complicated than it might otherwise seem.
2018 /// </summary> 2086 /// </summary>
2019 2087
2020 public string llGetSubString(string src, int start, int end) 2088 public LSL_String llGetSubString(string src, int start, int end)
2021 { 2089 {
2022 2090
2023 m_host.AddScriptLPS(1); 2091 m_host.AddScriptLPS(1);
@@ -2113,7 +2181,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2113 /// i.e. end < start. 2181 /// i.e. end < start.
2114 /// </summary> 2182 /// </summary>
2115 2183
2116 public string llDeleteSubString(string src, int start, int end) 2184 public LSL_String llDeleteSubString(string src, int start, int end)
2117 { 2185 {
2118 2186
2119 m_host.AddScriptLPS(1); 2187 m_host.AddScriptLPS(1);
@@ -2196,7 +2264,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2196 /// string bound, with the result being a concatenation. 2264 /// string bound, with the result being a concatenation.
2197 /// </summary> 2265 /// </summary>
2198 2266
2199 public string llInsertString(string dest, int index, string src) 2267 public LSL_String llInsertString(string dest, int index, string src)
2200 { 2268 {
2201 2269
2202 m_host.AddScriptLPS(1); 2270 m_host.AddScriptLPS(1);
@@ -2234,19 +2302,19 @@ namespace OpenSim.Region.ScriptEngine.Common
2234 2302
2235 } 2303 }
2236 2304
2237 public string llToUpper(string src) 2305 public LSL_String llToUpper(string src)
2238 { 2306 {
2239 m_host.AddScriptLPS(1); 2307 m_host.AddScriptLPS(1);
2240 return src.ToUpper(); 2308 return src.ToUpper();
2241 } 2309 }
2242 2310
2243 public string llToLower(string src) 2311 public LSL_String llToLower(string src)
2244 { 2312 {
2245 m_host.AddScriptLPS(1); 2313 m_host.AddScriptLPS(1);
2246 return src.ToLower(); 2314 return src.ToLower();
2247 } 2315 }
2248 2316
2249 public LSL_Types.LSLInteger llGiveMoney(string destination, int amount) 2317 public LSL_Integer llGiveMoney(string destination, int amount)
2250 { 2318 {
2251 UUID invItemID=InventorySelf(); 2319 UUID invItemID=InventorySelf();
2252 if (invItemID == UUID.Zero) 2320 if (invItemID == UUID.Zero)
@@ -2315,7 +2383,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2315 // ScriptSleep(100); 2383 // ScriptSleep(100);
2316 } 2384 }
2317 2385
2318 public void llRezAtRoot(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param) 2386 public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
2319 { 2387 {
2320 m_host.AddScriptLPS(1); 2388 m_host.AddScriptLPS(1);
2321 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s)) 2389 if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
@@ -2363,11 +2431,11 @@ namespace OpenSim.Region.ScriptEngine.Common
2363 // objects rezzed with this method are die_at_edge by default. 2431 // objects rezzed with this method are die_at_edge by default.
2364 new_group.RootPart.SetDieAtEdge(true); 2432 new_group.RootPart.SetDieAtEdge(true);
2365 2433
2366 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "object_rez", EventQueueManager.llDetectNull, new Object[] { new LSL_Types.LSLString(new_group.RootPart.ToString()) }); 2434 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "object_rez", EventQueueManager.llDetectNull, new Object[] { new LSL_String(new_group.RootPart.ToString()) });
2367 float groupmass = new_group.GetMass(); 2435 float groupmass = new_group.GetMass();
2368 2436
2369 //Recoil. 2437 //Recoil.
2370 llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); 2438 llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
2371 found = true; 2439 found = true;
2372 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 2440 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2373 ScriptSleep((int)((groupmass * velmag) / 10)); 2441 ScriptSleep((int)((groupmass * velmag) / 10));
@@ -2379,12 +2447,12 @@ namespace OpenSim.Region.ScriptEngine.Common
2379 llSay(0, "Could not find object " + inventory); 2447 llSay(0, "Could not find object " + inventory);
2380 } 2448 }
2381 2449
2382 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param) 2450 public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
2383 { 2451 {
2384 llRezAtRoot(inventory, pos, vel, rot, param); 2452 llRezAtRoot(inventory, pos, vel, rot, param);
2385 } 2453 }
2386 2454
2387 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) 2455 public void llLookAt(LSL_Vector target, double strength, double damping)
2388 { 2456 {
2389 m_host.AddScriptLPS(1); 2457 m_host.AddScriptLPS(1);
2390 NotImplemented("llLookAt"); 2458 NotImplemented("llLookAt");
@@ -2409,7 +2477,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2409 Thread.Sleep((int)(sec * 1000)); 2477 Thread.Sleep((int)(sec * 1000));
2410 } 2478 }
2411 2479
2412 public double llGetMass() 2480 public LSL_Float llGetMass()
2413 { 2481 {
2414 m_host.AddScriptLPS(1); 2482 m_host.AddScriptLPS(1);
2415 return m_host.GetMass(); 2483 return m_host.GetMass();
@@ -2495,7 +2563,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2495 Deprecated("llReleaseCamera"); 2563 Deprecated("llReleaseCamera");
2496 } 2564 }
2497 2565
2498 public string llGetOwner() 2566 public LSL_String llGetOwner()
2499 { 2567 {
2500 m_host.AddScriptLPS(1); 2568 m_host.AddScriptLPS(1);
2501 2569
@@ -2544,6 +2612,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2544 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; 2612 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
2545 msg.binaryBucket = new byte[0];// binaryBucket; 2613 msg.binaryBucket = new byte[0];// binaryBucket;
2546 World.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); 2614 World.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
2615 // ScriptSleep(2000);
2547 } 2616 }
2548 2617
2549 public void llEmail(string address, string subject, string message) 2618 public void llEmail(string address, string subject, string message)
@@ -2563,7 +2632,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2563 NotImplemented("llGetNextEmail"); 2632 NotImplemented("llGetNextEmail");
2564 } 2633 }
2565 2634
2566 public string llGetKey() 2635 public LSL_String llGetKey()
2567 { 2636 {
2568 m_host.AddScriptLPS(1); 2637 m_host.AddScriptLPS(1);
2569 return m_host.UUID.ToString(); 2638 return m_host.UUID.ToString();
@@ -2607,13 +2676,13 @@ namespace OpenSim.Region.ScriptEngine.Common
2607 Deprecated("llSoundPreload"); 2676 Deprecated("llSoundPreload");
2608 } 2677 }
2609 2678
2610 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) 2679 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
2611 { 2680 {
2612 m_host.AddScriptLPS(1); 2681 m_host.AddScriptLPS(1);
2613 NotImplemented("llRotLookAt"); 2682 NotImplemented("llRotLookAt");
2614 } 2683 }
2615 2684
2616 public LSL_Types.LSLInteger llStringLength(string str) 2685 public LSL_Integer llStringLength(string str)
2617 { 2686 {
2618 m_host.AddScriptLPS(1); 2687 m_host.AddScriptLPS(1);
2619 if (str.Length > 0) 2688 if (str.Length > 0)
@@ -2697,22 +2766,23 @@ namespace OpenSim.Region.ScriptEngine.Common
2697 NotImplemented("llStopPointAt"); 2766 NotImplemented("llStopPointAt");
2698 } 2767 }
2699 2768
2700 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) 2769 public void llTargetOmega(LSL_Vector axis, double spinrate, double gain)
2701 { 2770 {
2702 m_host.AddScriptLPS(1); 2771 m_host.AddScriptLPS(1);
2703 m_host.RotationalVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); 2772 m_host.RotationalVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate));
2704 m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); 2773 m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate));
2705 m_host.ScheduleTerseUpdate(); 2774 m_host.ScheduleTerseUpdate();
2706 m_host.SendTerseUpdateToAllClients(); 2775 m_host.SendTerseUpdateToAllClients();
2776 m_host.ParentGroup.HasGroupChanged = true;
2707 } 2777 }
2708 2778
2709 public LSL_Types.LSLInteger llGetStartParameter() 2779 public LSL_Integer llGetStartParameter()
2710 { 2780 {
2711 // This is not handled here 2781 // This is not handled here
2712 return 0; 2782 return 0;
2713 } 2783 }
2714 2784
2715 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) 2785 public void llGodLikeRezObject(string inventory, LSL_Vector pos)
2716 { 2786 {
2717 m_host.AddScriptLPS(1); 2787 m_host.AddScriptLPS(1);
2718 NotImplemented("llGodLikeRezObject"); 2788 NotImplemented("llGodLikeRezObject");
@@ -2732,15 +2802,20 @@ namespace OpenSim.Region.ScriptEngine.Common
2732 2802
2733 if (agentID == UUID.Zero || perm == 0) // Releasing permissions 2803 if (agentID == UUID.Zero || perm == 0) // Releasing permissions
2734 { 2804 {
2805 llReleaseControls();
2806
2735 m_host.TaskInventory[invItemID].PermsGranter=UUID.Zero; 2807 m_host.TaskInventory[invItemID].PermsGranter=UUID.Zero;
2736 m_host.TaskInventory[invItemID].PermsMask=0; 2808 m_host.TaskInventory[invItemID].PermsMask=0;
2737 2809
2738 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2810 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2739 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(0)}); 2811 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(0)});
2740 2812
2741 return; 2813 return;
2742 } 2814 }
2743 2815
2816 if ( m_host.TaskInventory[invItemID].PermsGranter != agentID || (perm & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) == 0)
2817 llReleaseControls();
2818
2744 m_host.AddScriptLPS(1); 2819 m_host.AddScriptLPS(1);
2745 2820
2746 if (m_host.ParentGroup.RootPart.IsAttachment && agent == m_host.ParentGroup.RootPart.AttachedAvatar) 2821 if (m_host.ParentGroup.RootPart.IsAttachment && agent == m_host.ParentGroup.RootPart.AttachedAvatar)
@@ -2757,7 +2832,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2757 m_host.TaskInventory[invItemID].PermsMask=perm; 2832 m_host.TaskInventory[invItemID].PermsMask=perm;
2758 2833
2759 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2834 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2760 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(perm)}); 2835 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(perm)});
2761 2836
2762 return; 2837 return;
2763 } 2838 }
@@ -2775,7 +2850,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2775 m_host.TaskInventory[invItemID].PermsMask=perm; 2850 m_host.TaskInventory[invItemID].PermsMask=perm;
2776 2851
2777 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2852 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2778 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(perm)}); 2853 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(perm)});
2779 2854
2780 return; 2855 return;
2781 } 2856 }
@@ -2803,7 +2878,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2803 2878
2804 // Requested agent is not in range, refuse perms 2879 // Requested agent is not in range, refuse perms
2805 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2880 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2806 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(0)}); 2881 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(0)});
2807 } 2882 }
2808 2883
2809 void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer) 2884 void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer)
@@ -2821,10 +2896,10 @@ namespace OpenSim.Region.ScriptEngine.Common
2821 2896
2822 m_host.TaskInventory[invItemID].PermsMask=answer; 2897 m_host.TaskInventory[invItemID].PermsMask=answer;
2823 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2898 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2824 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(answer)}); 2899 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Integer(answer)});
2825 } 2900 }
2826 2901
2827 public string llGetPermissionsKey() 2902 public LSL_String llGetPermissionsKey()
2828 { 2903 {
2829 m_host.AddScriptLPS(1); 2904 m_host.AddScriptLPS(1);
2830 2905
@@ -2839,7 +2914,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2839 return UUID.Zero.ToString(); 2914 return UUID.Zero.ToString();
2840 } 2915 }
2841 2916
2842 public LSL_Types.LSLInteger llGetPermissions() 2917 public LSL_Integer llGetPermissions()
2843 { 2918 {
2844 m_host.AddScriptLPS(1); 2919 m_host.AddScriptLPS(1);
2845 2920
@@ -2854,7 +2929,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2854 return 0; 2929 return 0;
2855 } 2930 }
2856 2931
2857 public LSL_Types.LSLInteger llGetLinkNumber() 2932 public LSL_Integer llGetLinkNumber()
2858 { 2933 {
2859 m_host.AddScriptLPS(1); 2934 m_host.AddScriptLPS(1);
2860 2935
@@ -2868,7 +2943,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2868 } 2943 }
2869 } 2944 }
2870 2945
2871 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) 2946 public void llSetLinkColor(int linknumber, LSL_Vector color, int face)
2872 { 2947 {
2873 m_host.AddScriptLPS(1); 2948 m_host.AddScriptLPS(1);
2874 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknumber); 2949 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknumber);
@@ -2991,6 +3066,8 @@ namespace OpenSim.Region.ScriptEngine.Common
2991 } 3066 }
2992 parentPrim.TriggerScriptChangedEvent(Changed.LINK); 3067 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
2993 parentPrim.RootPart.AddFlag(PrimFlags.CreateSelected); 3068 parentPrim.RootPart.AddFlag(PrimFlags.CreateSelected);
3069 parentPrim.HasGroupChanged = true;
3070 parentPrim.ScheduleGroupForFullUpdate();
2994 parentPrim.GetProperties(client); 3071 parentPrim.GetProperties(client);
2995 3072
2996 ScriptSleep(1000); 3073 ScriptSleep(1000);
@@ -3067,13 +3144,14 @@ namespace OpenSim.Region.ScriptEngine.Common
3067 SceneObjectGroup parentPrim = m_host.ParentGroup; 3144 SceneObjectGroup parentPrim = m_host.ParentGroup;
3068 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); 3145 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
3069 parts.Remove(parentPrim.RootPart); 3146 parts.Remove(parentPrim.RootPart);
3070 foreach (SceneObjectPart part in parts) { 3147 foreach (SceneObjectPart part in parts)
3148 {
3071 parentPrim.DelinkFromGroup(part.LocalId, true); 3149 parentPrim.DelinkFromGroup(part.LocalId, true);
3072 parentPrim.TriggerScriptChangedEvent(Changed.LINK); 3150 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3073 } 3151 }
3074 } 3152 }
3075 3153
3076 public string llGetLinkKey(int linknum) 3154 public LSL_String llGetLinkKey(int linknum)
3077 { 3155 {
3078 m_host.AddScriptLPS(1); 3156 m_host.AddScriptLPS(1);
3079 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); 3157 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
@@ -3087,7 +3165,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3087 } 3165 }
3088 } 3166 }
3089 3167
3090 public string llGetLinkName(int linknum) 3168 public LSL_String llGetLinkName(int linknum)
3091 { 3169 {
3092 m_host.AddScriptLPS(1); 3170 m_host.AddScriptLPS(1);
3093 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); 3171 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
@@ -3101,7 +3179,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3101 } 3179 }
3102 } 3180 }
3103 3181
3104 public LSL_Types.LSLInteger llGetInventoryNumber(int type) 3182 public LSL_Integer llGetInventoryNumber(int type)
3105 { 3183 {
3106 m_host.AddScriptLPS(1); 3184 m_host.AddScriptLPS(1);
3107 int count = 0; 3185 int count = 0;
@@ -3115,7 +3193,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3115 return count; 3193 return count;
3116 } 3194 }
3117 3195
3118 public string llGetInventoryName(int type, int number) 3196 public LSL_String llGetInventoryName(int type, int number)
3119 { 3197 {
3120 m_host.AddScriptLPS(1); 3198 m_host.AddScriptLPS(1);
3121 ArrayList keys = new ArrayList(); 3199 ArrayList keys = new ArrayList();
@@ -3172,7 +3250,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3172 // assume it is not running. 3250 // assume it is not running.
3173 } 3251 }
3174 3252
3175 public double llGetEnergy() 3253 public LSL_Float llGetEnergy()
3176 { 3254 {
3177 m_host.AddScriptLPS(1); 3255 m_host.AddScriptLPS(1);
3178 // TODO: figure out real energy value 3256 // TODO: figure out real energy value
@@ -3236,16 +3314,17 @@ namespace OpenSim.Region.ScriptEngine.Common
3236 } 3314 }
3237 } 3315 }
3238 3316
3239 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) 3317 public void llSetText(string text, LSL_Vector color, double alpha)
3240 { 3318 {
3241 m_host.AddScriptLPS(1); 3319 m_host.AddScriptLPS(1);
3242 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), 3320 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f),
3243 Util.Clip((float)color.y, 0.0f, 1.0f), 3321 Util.Clip((float)color.y, 0.0f, 1.0f),
3244 Util.Clip((float)color.z, 0.0f, 1.0f)); 3322 Util.Clip((float)color.z, 0.0f, 1.0f));
3245 m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); 3323 m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
3324 m_host.ParentGroup.HasGroupChanged = true;
3246 } 3325 }
3247 3326
3248 public double llWater(LSL_Types.Vector3 offset) 3327 public LSL_Float llWater(LSL_Vector offset)
3249 { 3328 {
3250 m_host.AddScriptLPS(1); 3329 m_host.AddScriptLPS(1);
3251 return World.RegionInfo.RegionSettings.WaterHeight; 3330 return World.RegionInfo.RegionSettings.WaterHeight;
@@ -3257,7 +3336,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3257 NotImplemented("llPassTouches"); 3336 NotImplemented("llPassTouches");
3258 } 3337 }
3259 3338
3260 public string llRequestAgentData(string id, int data) 3339 public LSL_String llRequestAgentData(string id, int data)
3261 { 3340 {
3262 m_host.AddScriptLPS(1); 3341 m_host.AddScriptLPS(1);
3263 3342
@@ -3310,7 +3389,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3310 return tid.ToString(); 3389 return tid.ToString();
3311 } 3390 }
3312 3391
3313 public string llRequestInventoryData(string name) 3392 public LSL_String llRequestInventoryData(string name)
3314 { 3393 {
3315 m_host.AddScriptLPS(1); 3394 m_host.AddScriptLPS(1);
3316 3395
@@ -3372,6 +3451,12 @@ namespace OpenSim.Region.ScriptEngine.Common
3372 // ScriptSleep(5000); 3451 // ScriptSleep(5000);
3373 } 3452 }
3374 3453
3454 public void llTextBox(string avatar, string message, int chat_channel)
3455 {
3456 m_host.AddScriptLPS(1);
3457 NotImplemented("llTextBox");
3458 }
3459
3375 public void llModifyLand(int action, int brush) 3460 public void llModifyLand(int action, int brush)
3376 { 3461 {
3377 m_host.AddScriptLPS(1); 3462 m_host.AddScriptLPS(1);
@@ -3390,7 +3475,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3390 NotImplemented("llCollisionSprite"); 3475 NotImplemented("llCollisionSprite");
3391 } 3476 }
3392 3477
3393 public string llGetAnimation(string id) 3478 public LSL_String llGetAnimation(string id)
3394 { 3479 {
3395 m_host.AddScriptLPS(1); 3480 m_host.AddScriptLPS(1);
3396 NotImplemented("llGetAnimation"); 3481 NotImplemented("llGetAnimation");
@@ -3427,7 +3512,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3427 3512
3428 object[] resobj = new object[] 3513 object[] resobj = new object[]
3429 { 3514 {
3430 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3515 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3431 }; 3516 };
3432 3517
3433 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3518 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3451,7 +3536,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3451 partItemID = item.ItemID; 3536 partItemID = item.ItemID;
3452 Object[] resobj = new object[] 3537 Object[] resobj = new object[]
3453 { 3538 {
3454 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3539 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3455 }; 3540 };
3456 3541
3457 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3542 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3479,7 +3564,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3479 partItemID = item.ItemID; 3564 partItemID = item.ItemID;
3480 Object[] resobj = new object[] 3565 Object[] resobj = new object[]
3481 { 3566 {
3482 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3567 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3483 }; 3568 };
3484 3569
3485 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3570 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3509,7 +3594,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3509 partItemID = item.ItemID; 3594 partItemID = item.ItemID;
3510 Object[] resobj = new object[] 3595 Object[] resobj = new object[]
3511 { 3596 {
3512 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3597 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3513 }; 3598 };
3514 3599
3515 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3600 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3533,7 +3618,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3533 3618
3534 object[] resobj = new object[] 3619 object[] resobj = new object[]
3535 { 3620 {
3536 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3621 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3537 }; 3622 };
3538 3623
3539 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3624 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3560,7 +3645,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3560 partItemID = item.ItemID; 3645 partItemID = item.ItemID;
3561 Object[] resObjDef = new object[] 3646 Object[] resObjDef = new object[]
3562 { 3647 {
3563 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3648 new LSL_Integer(m_host.LinkNum), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id)
3564 }; 3649 };
3565 3650
3566 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3651 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3578,7 +3663,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3578 3663
3579 } 3664 }
3580 3665
3581 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) 3666 public void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local)
3582 { 3667 {
3583 m_host.AddScriptLPS(1); 3668 m_host.AddScriptLPS(1);
3584 SceneObjectPart targ = World.GetSceneObjectPart(target); 3669 SceneObjectPart targ = World.GetSceneObjectPart(target);
@@ -3593,7 +3678,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3593 NotImplemented("llPassCollisions"); 3678 NotImplemented("llPassCollisions");
3594 } 3679 }
3595 3680
3596 public string llGetScriptName() 3681 public LSL_String llGetScriptName()
3597 { 3682 {
3598 3683
3599 string result = String.Empty; 3684 string result = String.Empty;
@@ -3670,17 +3755,22 @@ namespace OpenSim.Region.ScriptEngine.Common
3670 3755
3671 } 3756 }
3672 3757
3673 public LSL_Types.LSLInteger llGetNumberOfSides() 3758 public LSL_Integer llGetNumberOfSides()
3674 { 3759 {
3675 m_host.AddScriptLPS(1); 3760 m_host.AddScriptLPS(1);
3761 return GetNumberOfSides(m_host);
3762 }
3763
3764 private int GetNumberOfSides(SceneObjectPart part)
3765 {
3676 int ret = 0; 3766 int ret = 0;
3677 bool hasCut; 3767 bool hasCut;
3678 bool hasHollow; 3768 bool hasHollow;
3679 bool hasDimple; 3769 bool hasDimple;
3680 bool hasProfileCut; 3770 bool hasProfileCut;
3681 3771
3682 int primType = getScriptPrimType(m_host.Shape); 3772 int primType = getScriptPrimType(part.Shape);
3683 hasCutHollowDimpleProfileCut(primType, m_host.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); 3773 hasCutHollowDimpleProfileCut(primType, part.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
3684 3774
3685 switch (primType) 3775 switch (primType)
3686 { 3776 {
@@ -3759,7 +3849,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3759 // Xantor 29/apr/2008 3849 // Xantor 29/apr/2008
3760 // Returns rotation described by rotating angle radians about axis. 3850 // Returns rotation described by rotating angle radians about axis.
3761 // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2)) 3851 // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2))
3762 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) 3852 public LSL_Rotation llAxisAngle2Rot(LSL_Vector axis, double angle)
3763 { 3853 {
3764 m_host.AddScriptLPS(1); 3854 m_host.AddScriptLPS(1);
3765 3855
@@ -3771,13 +3861,13 @@ namespace OpenSim.Region.ScriptEngine.Common
3771 y = axis.y * t; 3861 y = axis.y * t;
3772 z = axis.z * t; 3862 z = axis.z * t;
3773 3863
3774 return new LSL_Types.Quaternion(x,y,z,s); 3864 return new LSL_Rotation(x,y,z,s);
3775 } 3865 }
3776 3866
3777 3867
3778 // Xantor 29/apr/2008 3868 // Xantor 29/apr/2008
3779 // converts a Quaternion to X,Y,Z axis rotations 3869 // converts a Quaternion to X,Y,Z axis rotations
3780 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) 3870 public LSL_Vector llRot2Axis(LSL_Rotation rot)
3781 { 3871 {
3782 m_host.AddScriptLPS(1); 3872 m_host.AddScriptLPS(1);
3783 double x,y,z; 3873 double x,y,z;
@@ -3809,13 +3899,13 @@ namespace OpenSim.Region.ScriptEngine.Common
3809 } 3899 }
3810 3900
3811 3901
3812 return new LSL_Types.Vector3(x,y,z); 3902 return new LSL_Vector(x,y,z);
3813 3903
3814 } 3904 }
3815 3905
3816 3906
3817 // Returns the angle of a quaternion (see llRot2Axis for the axis) 3907 // Returns the angle of a quaternion (see llRot2Axis for the axis)
3818 public double llRot2Angle(LSL_Types.Quaternion rot) 3908 public LSL_Float llRot2Angle(LSL_Rotation rot)
3819 { 3909 {
3820 m_host.AddScriptLPS(1); 3910 m_host.AddScriptLPS(1);
3821 3911
@@ -3837,27 +3927,27 @@ namespace OpenSim.Region.ScriptEngine.Common
3837 3927
3838 } 3928 }
3839 3929
3840 public double llAcos(double val) 3930 public LSL_Float llAcos(double val)
3841 { 3931 {
3842 m_host.AddScriptLPS(1); 3932 m_host.AddScriptLPS(1);
3843 return (double)Math.Acos(val); 3933 return (double)Math.Acos(val);
3844 } 3934 }
3845 3935
3846 public double llAsin(double val) 3936 public LSL_Float llAsin(double val)
3847 { 3937 {
3848 m_host.AddScriptLPS(1); 3938 m_host.AddScriptLPS(1);
3849 return (double)Math.Asin(val); 3939 return (double)Math.Asin(val);
3850 } 3940 }
3851 3941
3852 // Xantor 30/apr/2008 3942 // Xantor 30/apr/2008
3853 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) 3943 public LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b)
3854 { 3944 {
3855 m_host.AddScriptLPS(1); 3945 m_host.AddScriptLPS(1);
3856 3946
3857 return (double) Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2; 3947 return (double) Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2;
3858 } 3948 }
3859 3949
3860 public string llGetInventoryKey(string name) 3950 public LSL_String llGetInventoryKey(string name)
3861 { 3951 {
3862 m_host.AddScriptLPS(1); 3952 m_host.AddScriptLPS(1);
3863 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 3953 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
@@ -3887,15 +3977,15 @@ namespace OpenSim.Region.ScriptEngine.Common
3887 m_host.ParentGroup.RootPart.AllowedDrop = false; 3977 m_host.ParentGroup.RootPart.AllowedDrop = false;
3888 } 3978 }
3889 3979
3890 public LSL_Types.Vector3 llGetSunDirection() 3980 public LSL_Vector llGetSunDirection()
3891 { 3981 {
3892 m_host.AddScriptLPS(1); 3982 m_host.AddScriptLPS(1);
3893 3983
3894 LSL_Types.Vector3 SunDoubleVector3; 3984 LSL_Vector SunDoubleVector3;
3895 Vector3 SunFloatVector3; 3985 Vector3 SunFloatVector3;
3896 3986
3897 // sunPosition estate setting is set in OpenSim.Region.Environment.Modules.SunModule 3987 // sunPosition estate setting is set in OpenSim.Region.Environment.Modules.SunModule
3898 // have to convert from Vector3 (float) to LSL_Types.Vector3 (double) 3988 // have to convert from Vector3 (float) to LSL_Vector (double)
3899 SunFloatVector3 = World.RegionInfo.RegionSettings.SunVector; 3989 SunFloatVector3 = World.RegionInfo.RegionSettings.SunVector;
3900 SunDoubleVector3.x = (double)SunFloatVector3.X; 3990 SunDoubleVector3.x = (double)SunFloatVector3.X;
3901 SunDoubleVector3.y = (double)SunFloatVector3.Y; 3991 SunDoubleVector3.y = (double)SunFloatVector3.Y;
@@ -3904,26 +3994,38 @@ namespace OpenSim.Region.ScriptEngine.Common
3904 return SunDoubleVector3; 3994 return SunDoubleVector3;
3905 } 3995 }
3906 3996
3907 public LSL_Types.Vector3 llGetTextureOffset(int face) 3997 public LSL_Vector llGetTextureOffset(int face)
3908 { 3998 {
3909 m_host.AddScriptLPS(1); 3999 m_host.AddScriptLPS(1);
3910 Primitive.TextureEntry tex = m_host.Shape.Textures; 4000 return GetTextureOffset(m_host, face);
3911 LSL_Types.Vector3 offset; 4001 }
3912 if (face == -1) 4002
4003 private LSL_Vector GetTextureOffset(SceneObjectPart part, int face)
4004 {
4005 Primitive.TextureEntry tex = part.Shape.Textures;
4006 LSL_Vector offset = new LSL_Vector();
4007 if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
3913 { 4008 {
3914 face = 0; 4009 face = 0;
3915 } 4010 }
3916 offset.x = tex.GetFace((uint)face).OffsetU; 4011 if (face >= 0 && face < GetNumberOfSides(part))
3917 offset.y = tex.GetFace((uint)face).OffsetV; 4012 {
3918 offset.z = 0.0; 4013 offset.x = tex.GetFace((uint)face).OffsetU;
3919 return offset; 4014 offset.y = tex.GetFace((uint)face).OffsetV;
4015 offset.z = 0.0;
4016 return offset;
4017 }
4018 else
4019 {
4020 return offset;
4021 }
3920 } 4022 }
3921 4023
3922 public LSL_Types.Vector3 llGetTextureScale(int side) 4024 public LSL_Vector llGetTextureScale(int side)
3923 { 4025 {
3924 m_host.AddScriptLPS(1); 4026 m_host.AddScriptLPS(1);
3925 Primitive.TextureEntry tex = m_host.Shape.Textures; 4027 Primitive.TextureEntry tex = m_host.Shape.Textures;
3926 LSL_Types.Vector3 scale; 4028 LSL_Vector scale;
3927 if (side == -1) 4029 if (side == -1)
3928 { 4030 {
3929 side = 0; 4031 side = 0;
@@ -3934,24 +4036,36 @@ namespace OpenSim.Region.ScriptEngine.Common
3934 return scale; 4036 return scale;
3935 } 4037 }
3936 4038
3937 public double llGetTextureRot(int face) 4039 public LSL_Float llGetTextureRot(int face)
3938 { 4040 {
3939 m_host.AddScriptLPS(1); 4041 m_host.AddScriptLPS(1);
3940 Primitive.TextureEntry tex = m_host.Shape.Textures; 4042 return GetTextureRot(m_host, face);
4043 }
4044
4045 private LSL_Float GetTextureRot(SceneObjectPart part, int face)
4046 {
4047 Primitive.TextureEntry tex = part.Shape.Textures;
3941 if (face == -1) 4048 if (face == -1)
3942 { 4049 {
3943 face = 0; 4050 face = 0;
3944 } 4051 }
3945 return tex.GetFace((uint)face).Rotation; 4052 if (face >= 0 && face < GetNumberOfSides(part))
4053 {
4054 return tex.GetFace((uint)face).Rotation;
4055 }
4056 else
4057 {
4058 return 0.0;
4059 }
3946 } 4060 }
3947 4061
3948 public LSL_Types.LSLInteger llSubStringIndex(string source, string pattern) 4062 public LSL_Integer llSubStringIndex(string source, string pattern)
3949 { 4063 {
3950 m_host.AddScriptLPS(1); 4064 m_host.AddScriptLPS(1);
3951 return source.IndexOf(pattern); 4065 return source.IndexOf(pattern);
3952 } 4066 }
3953 4067
3954 public string llGetOwnerKey(string id) 4068 public LSL_String llGetOwnerKey(string id)
3955 { 4069 {
3956 m_host.AddScriptLPS(1); 4070 m_host.AddScriptLPS(1);
3957 UUID key = new UUID(); 4071 UUID key = new UUID();
@@ -3976,14 +4090,14 @@ namespace OpenSim.Region.ScriptEngine.Common
3976 } 4090 }
3977 } 4091 }
3978 4092
3979 public LSL_Types.Vector3 llGetCenterOfMass() 4093 public LSL_Vector llGetCenterOfMass()
3980 { 4094 {
3981 m_host.AddScriptLPS(1); 4095 m_host.AddScriptLPS(1);
3982 NotImplemented("llGetCenterOfMass"); 4096 NotImplemented("llGetCenterOfMass");
3983 return new LSL_Types.Vector3(); 4097 return new LSL_Vector();
3984 } 4098 }
3985 4099
3986 public LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending) 4100 public LSL_List llListSort(LSL_List src, int stride, int ascending)
3987 { 4101 {
3988 m_host.AddScriptLPS(1); 4102 m_host.AddScriptLPS(1);
3989 4103
@@ -3994,7 +4108,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3994 return src.Sort(stride, ascending); 4108 return src.Sort(stride, ascending);
3995 } 4109 }
3996 4110
3997 public LSL_Types.LSLInteger llGetListLength(LSL_Types.list src) 4111 public LSL_Integer llGetListLength(LSL_List src)
3998 { 4112 {
3999 m_host.AddScriptLPS(1); 4113 m_host.AddScriptLPS(1);
4000 4114
@@ -4008,7 +4122,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4008 } 4122 }
4009 } 4123 }
4010 4124
4011 public LSL_Types.LSLInteger llList2Integer(LSL_Types.list src, int index) 4125 public LSL_Integer llList2Integer(LSL_List src, int index)
4012 { 4126 {
4013 m_host.AddScriptLPS(1); 4127 m_host.AddScriptLPS(1);
4014 if (index < 0) 4128 if (index < 0)
@@ -4021,12 +4135,12 @@ namespace OpenSim.Region.ScriptEngine.Common
4021 } 4135 }
4022 try 4136 try
4023 { 4137 {
4024 if (src.Data[index] is LSL_Types.LSLInteger) 4138 if (src.Data[index] is LSL_Integer)
4025 return Convert.ToInt32(((LSL_Types.LSLInteger) src.Data[index]).value); 4139 return Convert.ToInt32(((LSL_Integer) src.Data[index]).value);
4026 else if (src.Data[index] is LSL_Types.LSLFloat) 4140 else if (src.Data[index] is LSL_Float)
4027 return Convert.ToInt32(((LSL_Types.LSLFloat) src.Data[index]).value); 4141 return Convert.ToInt32(((LSL_Float) src.Data[index]).value);
4028 else if (src.Data[index] is LSL_Types.LSLString) 4142 else if (src.Data[index] is LSL_String)
4029 return Convert.ToInt32(((LSL_Types.LSLString) src.Data[index]).m_string); 4143 return Convert.ToInt32(((LSL_String) src.Data[index]).m_string);
4030 return Convert.ToInt32(src.Data[index]); 4144 return Convert.ToInt32(src.Data[index]);
4031 } 4145 }
4032 catch (FormatException) 4146 catch (FormatException)
@@ -4035,7 +4149,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4035 } 4149 }
4036 } 4150 }
4037 4151
4038 public double osList2Double(LSL_Types.list src, int index) 4152 public double osList2Double(LSL_List src, int index)
4039 { 4153 {
4040 m_host.AddScriptLPS(1); 4154 m_host.AddScriptLPS(1);
4041 if (index < 0) 4155 if (index < 0)
@@ -4046,16 +4160,16 @@ namespace OpenSim.Region.ScriptEngine.Common
4046 { 4160 {
4047 return 0.0; 4161 return 0.0;
4048 } 4162 }
4049 if (src.Data[index] is LSL_Types.LSLInteger) 4163 if (src.Data[index] is LSL_Integer)
4050 return Convert.ToDouble(((LSL_Types.LSLInteger) src.Data[index]).value); 4164 return Convert.ToDouble(((LSL_Integer) src.Data[index]).value);
4051 else if (src.Data[index] is LSL_Types.LSLFloat) 4165 else if (src.Data[index] is LSL_Float)
4052 return Convert.ToDouble(((LSL_Types.LSLFloat) src.Data[index]).value); 4166 return Convert.ToDouble(((LSL_Float) src.Data[index]).value);
4053 else if (src.Data[index] is LSL_Types.LSLString) 4167 else if (src.Data[index] is LSL_String)
4054 return Convert.ToDouble(((LSL_Types.LSLString) src.Data[index]).m_string); 4168 return Convert.ToDouble(((LSL_String) src.Data[index]).m_string);
4055 return Convert.ToDouble(src.Data[index]); 4169 return Convert.ToDouble(src.Data[index]);
4056 } 4170 }
4057 4171
4058 public double llList2Float(LSL_Types.list src, int index) 4172 public LSL_Float llList2Float(LSL_List src, int index)
4059 { 4173 {
4060 m_host.AddScriptLPS(1); 4174 m_host.AddScriptLPS(1);
4061 if (index < 0) 4175 if (index < 0)
@@ -4068,12 +4182,12 @@ namespace OpenSim.Region.ScriptEngine.Common
4068 } 4182 }
4069 try 4183 try
4070 { 4184 {
4071 if (src.Data[index] is LSL_Types.LSLInteger) 4185 if (src.Data[index] is LSL_Integer)
4072 return Convert.ToDouble(((LSL_Types.LSLInteger) src.Data[index]).value); 4186 return Convert.ToDouble(((LSL_Integer) src.Data[index]).value);
4073 else if (src.Data[index] is LSL_Types.LSLFloat) 4187 else if (src.Data[index] is LSL_Float)
4074 return Convert.ToDouble(((LSL_Types.LSLFloat) src.Data[index]).value); 4188 return Convert.ToDouble(((LSL_Float) src.Data[index]).value);
4075 else if (src.Data[index] is LSL_Types.LSLString) 4189 else if (src.Data[index] is LSL_String)
4076 return Convert.ToDouble(((LSL_Types.LSLString) src.Data[index]).m_string); 4190 return Convert.ToDouble(((LSL_String) src.Data[index]).m_string);
4077 return Convert.ToDouble(src.Data[index]); 4191 return Convert.ToDouble(src.Data[index]);
4078 } 4192 }
4079 catch (FormatException) 4193 catch (FormatException)
@@ -4082,7 +4196,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4082 } 4196 }
4083 } 4197 }
4084 4198
4085 public string llList2String(LSL_Types.list src, int index) 4199 public LSL_String llList2String(LSL_List src, int index)
4086 { 4200 {
4087 m_host.AddScriptLPS(1); 4201 m_host.AddScriptLPS(1);
4088 if (index < 0) 4202 if (index < 0)
@@ -4096,7 +4210,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4096 return src.Data[index].ToString(); 4210 return src.Data[index].ToString();
4097 } 4211 }
4098 4212
4099 public string llList2Key(LSL_Types.list src, int index) 4213 public LSL_String llList2Key(LSL_List src, int index)
4100 { 4214 {
4101 m_host.AddScriptLPS(1); 4215 m_host.AddScriptLPS(1);
4102 if (index < 0) 4216 if (index < 0)
@@ -4110,7 +4224,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4110 return src.Data[index].ToString(); 4224 return src.Data[index].ToString();
4111 } 4225 }
4112 4226
4113 public LSL_Types.Vector3 llList2Vector(LSL_Types.list src, int index) 4227 public LSL_Vector llList2Vector(LSL_List src, int index)
4114 { 4228 {
4115 m_host.AddScriptLPS(1); 4229 m_host.AddScriptLPS(1);
4116 if (index < 0) 4230 if (index < 0)
@@ -4119,19 +4233,19 @@ namespace OpenSim.Region.ScriptEngine.Common
4119 } 4233 }
4120 if (index >= src.Length) 4234 if (index >= src.Length)
4121 { 4235 {
4122 return new LSL_Types.Vector3(0, 0, 0); 4236 return new LSL_Vector(0, 0, 0);
4123 } 4237 }
4124 if (src.Data[index].GetType() == typeof(LSL_Types.Vector3)) 4238 if (src.Data[index].GetType() == typeof(LSL_Vector))
4125 { 4239 {
4126 return (LSL_Types.Vector3)src.Data[index]; 4240 return (LSL_Vector)src.Data[index];
4127 } 4241 }
4128 else 4242 else
4129 { 4243 {
4130 return new LSL_Types.Vector3(src.Data[index].ToString()); 4244 return new LSL_Vector(src.Data[index].ToString());
4131 } 4245 }
4132 } 4246 }
4133 4247
4134 public LSL_Types.Quaternion llList2Rot(LSL_Types.list src, int index) 4248 public LSL_Rotation llList2Rot(LSL_List src, int index)
4135 { 4249 {
4136 m_host.AddScriptLPS(1); 4250 m_host.AddScriptLPS(1);
4137 if (index < 0) 4251 if (index < 0)
@@ -4140,30 +4254,30 @@ namespace OpenSim.Region.ScriptEngine.Common
4140 } 4254 }
4141 if (index >= src.Length) 4255 if (index >= src.Length)
4142 { 4256 {
4143 return new LSL_Types.Quaternion(0, 0, 0, 1); 4257 return new LSL_Rotation(0, 0, 0, 1);
4144 } 4258 }
4145 if (src.Data[index].GetType() == typeof(LSL_Types.Quaternion)) 4259 if (src.Data[index].GetType() == typeof(LSL_Rotation))
4146 { 4260 {
4147 return (LSL_Types.Quaternion)src.Data[index]; 4261 return (LSL_Rotation)src.Data[index];
4148 } 4262 }
4149 else 4263 else
4150 { 4264 {
4151 return new LSL_Types.Quaternion(src.Data[index].ToString()); 4265 return new LSL_Rotation(src.Data[index].ToString());
4152 } 4266 }
4153 } 4267 }
4154 4268
4155 public LSL_Types.list llList2List(LSL_Types.list src, int start, int end) 4269 public LSL_List llList2List(LSL_List src, int start, int end)
4156 { 4270 {
4157 m_host.AddScriptLPS(1); 4271 m_host.AddScriptLPS(1);
4158 return src.GetSublist(start, end); 4272 return src.GetSublist(start, end);
4159 } 4273 }
4160 4274
4161 public LSL_Types.list llDeleteSubList(LSL_Types.list src, int start, int end) 4275 public LSL_List llDeleteSubList(LSL_List src, int start, int end)
4162 { 4276 {
4163 return src.DeleteSublist(end, start); 4277 return src.DeleteSublist(end, start);
4164 } 4278 }
4165 4279
4166 public LSL_Types.LSLInteger llGetListEntryType(LSL_Types.list src, int index) 4280 public LSL_Integer llGetListEntryType(LSL_List src, int index)
4167 { 4281 {
4168 m_host.AddScriptLPS(1); 4282 m_host.AddScriptLPS(1);
4169 if (index < 0) 4283 if (index < 0)
@@ -4175,27 +4289,27 @@ namespace OpenSim.Region.ScriptEngine.Common
4175 return 0; 4289 return 0;
4176 } 4290 }
4177 4291
4178 if (src.Data[index] is Int32) 4292 if (src.Data[index] is LSL_Integer || src.Data[index] is Int32)
4179 return 1; 4293 return 1;
4180 if (src.Data[index] is Double) 4294 if (src.Data[index] is LSL_Float || src.Data[index] is Single || src.Data[index] is Double)
4181 return 2; 4295 return 2;
4182 if (src.Data[index] is String) 4296 if (src.Data[index] is LSL_String || src.Data[index] is String)
4183 { 4297 {
4184 UUID tuuid; 4298 UUID tuuid;
4185 if (UUID.TryParse(src.Data[index].ToString(), out tuuid)) 4299 if (UUID.TryParse(src.Data[index].ToString(), out tuuid))
4186 { 4300 {
4187 return 3; 4301 return 4;
4188 } 4302 }
4189 else 4303 else
4190 { 4304 {
4191 return 4; 4305 return 3;
4192 } 4306 }
4193 } 4307 }
4194 if (src.Data[index] is LSL_Types.Vector3) 4308 if (src.Data[index] is LSL_Vector)
4195 return 5; 4309 return 5;
4196 if (src.Data[index] is LSL_Types.Quaternion) 4310 if (src.Data[index] is LSL_Rotation)
4197 return 6; 4311 return 6;
4198 if (src.Data[index] is LSL_Types.list) 4312 if (src.Data[index] is LSL_List)
4199 return 7; 4313 return 7;
4200 return 0; 4314 return 0;
4201 4315
@@ -4208,7 +4322,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4208 /// each comma. 4322 /// each comma.
4209 /// </summary> 4323 /// </summary>
4210 4324
4211 public string llList2CSV(LSL_Types.list src) 4325 public LSL_String llList2CSV(LSL_List src)
4212 { 4326 {
4213 4327
4214 string ret = String.Empty; 4328 string ret = String.Empty;
@@ -4236,10 +4350,10 @@ namespace OpenSim.Region.ScriptEngine.Common
4236 /// before or after an element is trimmed. 4350 /// before or after an element is trimmed.
4237 /// </summary> 4351 /// </summary>
4238 4352
4239 public LSL_Types.list llCSV2List(string src) 4353 public LSL_List llCSV2List(string src)
4240 { 4354 {
4241 4355
4242 LSL_Types.list result = new LSL_Types.list(); 4356 LSL_List result = new LSL_List();
4243 int parens = 0; 4357 int parens = 0;
4244 int start = 0; 4358 int start = 0;
4245 int length = 0; 4359 int length = 0;
@@ -4293,9 +4407,9 @@ namespace OpenSim.Region.ScriptEngine.Common
4293 /// sizes. 4407 /// sizes.
4294 /// </remarks> 4408 /// </remarks>
4295 4409
4296 public LSL_Types.list llListRandomize(LSL_Types.list src, int stride) 4410 public LSL_List llListRandomize(LSL_List src, int stride)
4297 { 4411 {
4298 LSL_Types.list result; 4412 LSL_List result;
4299 Random rand = new Random(); 4413 Random rand = new Random();
4300 4414
4301 int chunkk; 4415 int chunkk;
@@ -4336,7 +4450,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4336 4450
4337 // Construct the randomized list 4451 // Construct the randomized list
4338 4452
4339 result = new LSL_Types.list(); 4453 result = new LSL_List();
4340 4454
4341 for (int i = 0; i < chunkk; i++) 4455 for (int i = 0; i < chunkk; i++)
4342 { 4456 {
@@ -4349,7 +4463,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4349 else { 4463 else {
4350 object[] array = new object[src.Length]; 4464 object[] array = new object[src.Length];
4351 Array.Copy(src.Data, 0, array, 0, src.Length); 4465 Array.Copy(src.Data, 0, array, 0, src.Length);
4352 result = new LSL_Types.list(array); 4466 result = new LSL_List(array);
4353 } 4467 }
4354 4468
4355 return result; 4469 return result;
@@ -4363,10 +4477,10 @@ namespace OpenSim.Region.ScriptEngine.Common
4363 /// range are included in the result. 4477 /// range are included in the result.
4364 /// </summary> 4478 /// </summary>
4365 4479
4366 public LSL_Types.list llList2ListStrided(LSL_Types.list src, int start, int end, int stride) 4480 public LSL_List llList2ListStrided(LSL_List src, int start, int end, int stride)
4367 { 4481 {
4368 4482
4369 LSL_Types.list result = new LSL_Types.list(); 4483 LSL_List result = new LSL_List();
4370 int[] si = new int[2]; 4484 int[] si = new int[2];
4371 int[] ei = new int[2]; 4485 int[] ei = new int[2];
4372 bool twopass = false; 4486 bool twopass = false;
@@ -4443,10 +4557,17 @@ namespace OpenSim.Region.ScriptEngine.Common
4443 return result; 4557 return result;
4444 } 4558 }
4445 4559
4446 public LSL_Types.Vector3 llGetRegionCorner() 4560 public LSL_Integer llGetRegionAgentCount()
4447 { 4561 {
4448 m_host.AddScriptLPS(1); 4562 m_host.AddScriptLPS(1);
4449 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * Constants.RegionSize, World.RegionInfo.RegionLocY * Constants.RegionSize, 0); 4563 NotImplemented("llGetRegionAgentCount");
4564 return new LSL_Integer(0);
4565 }
4566
4567 public LSL_Vector llGetRegionCorner()
4568 {
4569 m_host.AddScriptLPS(1);
4570 return new LSL_Vector(World.RegionInfo.RegionLocX * Constants.RegionSize, World.RegionInfo.RegionLocY * Constants.RegionSize, 0);
4450 } 4571 }
4451 4572
4452 /// <summary> 4573 /// <summary>
@@ -4455,11 +4576,11 @@ namespace OpenSim.Region.ScriptEngine.Common
4455 /// new element has the index specified by <index> 4576 /// new element has the index specified by <index>
4456 /// </summary> 4577 /// </summary>
4457 4578
4458 public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int index) 4579 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
4459 { 4580 {
4460 4581
4461 LSL_Types.list pref = null; 4582 LSL_List pref = null;
4462 LSL_Types.list suff = null; 4583 LSL_List suff = null;
4463 4584
4464 m_host.AddScriptLPS(1); 4585 m_host.AddScriptLPS(1);
4465 4586
@@ -4505,7 +4626,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4505 /// in src. 4626 /// in src.
4506 /// </summary> 4627 /// </summary>
4507 4628
4508 public LSL_Types.LSLInteger llListFindList(LSL_Types.list src, LSL_Types.list test) 4629 public LSL_Integer llListFindList(LSL_List src, LSL_List test)
4509 { 4630 {
4510 4631
4511 int index = -1; 4632 int index = -1;
@@ -4519,11 +4640,11 @@ namespace OpenSim.Region.ScriptEngine.Common
4519 { 4640 {
4520 for (int i = 0; i < length; i++) 4641 for (int i = 0; i < length; i++)
4521 { 4642 {
4522 if (AreEqual(src.Data[i], test.Data[0])) 4643 if (src.Data[i].Equals(test.Data[0]))
4523 { 4644 {
4524 int j; 4645 int j;
4525 for (j = 1; j < test.Length; j++) 4646 for (j = 1; j < test.Length; j++)
4526 if (!AreEqual(src.Data[i+j], test.Data[j])) 4647 if (!src.Data[i+j].Equals(test.Data[j]))
4527 break; 4648 break;
4528 if (j == test.Length) 4649 if (j == test.Length)
4529 { 4650 {
@@ -4538,19 +4659,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4538 4659
4539 } 4660 }
4540 4661
4541 private bool AreEqual(object src, object test) 4662 public LSL_String llGetObjectName()
4542 {
4543 if (src.GetType().FullName == "System.String")
4544 {
4545 return src.ToString() == test.ToString();
4546 }
4547 else
4548 {
4549 return src.Equals(test);
4550 }
4551 }
4552
4553 public string llGetObjectName()
4554 { 4663 {
4555 m_host.AddScriptLPS(1); 4664 m_host.AddScriptLPS(1);
4556 return m_host.Name!=null?m_host.Name:String.Empty; 4665 return m_host.Name!=null?m_host.Name:String.Empty;
@@ -4562,7 +4671,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4562 m_host.Name = name!=null?name:String.Empty; 4671 m_host.Name = name!=null?name:String.Empty;
4563 } 4672 }
4564 4673
4565 public string llGetDate() 4674 public LSL_String llGetDate()
4566 { 4675 {
4567 m_host.AddScriptLPS(1); 4676 m_host.AddScriptLPS(1);
4568 DateTime date = DateTime.Now.ToUniversalTime(); 4677 DateTime date = DateTime.Now.ToUniversalTime();
@@ -4570,14 +4679,14 @@ namespace OpenSim.Region.ScriptEngine.Common
4570 return result; 4679 return result;
4571 } 4680 }
4572 4681
4573 public LSL_Types.LSLInteger llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) 4682 public LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir)
4574 { 4683 {
4575 m_host.AddScriptLPS(1); 4684 m_host.AddScriptLPS(1);
4576 NotImplemented("llEdgeOfWorld"); 4685 NotImplemented("llEdgeOfWorld");
4577 return 0; 4686 return 0;
4578 } 4687 }
4579 4688
4580 public LSL_Types.LSLInteger llGetAgentInfo(string id) 4689 public LSL_Integer llGetAgentInfo(string id)
4581 { 4690 {
4582 m_host.AddScriptLPS(1); 4691 m_host.AddScriptLPS(1);
4583 NotImplemented("llGetAgentInfo"); 4692 NotImplemented("llGetAgentInfo");
@@ -4603,7 +4712,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4603 m_host.SoundRadius = radius; 4712 m_host.SoundRadius = radius;
4604 } 4713 }
4605 4714
4606 public string llKey2Name(string id) 4715 public LSL_String llKey2Name(string id)
4607 { 4716 {
4608 m_host.AddScriptLPS(1); 4717 m_host.AddScriptLPS(1);
4609 UUID key = new UUID(); 4718 UUID key = new UUID();
@@ -4646,10 +4755,11 @@ namespace OpenSim.Region.ScriptEngine.Common
4646 4755
4647 m_host.AddTextureAnimation(pTexAnim); 4756 m_host.AddTextureAnimation(pTexAnim);
4648 m_host.SendFullUpdateToAllClients(); 4757 m_host.SendFullUpdateToAllClients();
4758 m_host.ParentGroup.HasGroupChanged = true;
4649 } 4759 }
4650 4760
4651 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, 4761 public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east,
4652 LSL_Types.Vector3 bottom_south_west) 4762 LSL_Vector bottom_south_west)
4653 { 4763 {
4654 m_host.AddScriptLPS(1); 4764 m_host.AddScriptLPS(1);
4655 NotImplemented("llTriggerSoundLimited"); 4765 NotImplemented("llTriggerSoundLimited");
@@ -4672,10 +4782,10 @@ namespace OpenSim.Region.ScriptEngine.Common
4672 // ScriptSleep(5000); 4782 // ScriptSleep(5000);
4673 } 4783 }
4674 4784
4675 public LSL_Types.list llParseString2List(string str, LSL_Types.list separators, LSL_Types.list spacers) 4785 public LSL_List llParseString2List(string str, LSL_List separators, LSL_List spacers)
4676 { 4786 {
4677 m_host.AddScriptLPS(1); 4787 m_host.AddScriptLPS(1);
4678 LSL_Types.list ret = new LSL_Types.list(); 4788 LSL_List ret = new LSL_List();
4679 object[] delimiters = new object[separators.Length + spacers.Length]; 4789 object[] delimiters = new object[separators.Length + spacers.Length];
4680 separators.Data.CopyTo(delimiters, 0); 4790 separators.Data.CopyTo(delimiters, 0);
4681 spacers.Data.CopyTo(delimiters, separators.Length); 4791 spacers.Data.CopyTo(delimiters, separators.Length);
@@ -4728,7 +4838,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4728 return ret; 4838 return ret;
4729 } 4839 }
4730 4840
4731 public LSL_Types.LSLInteger llOverMyLand(string id) 4841 public LSL_Integer llOverMyLand(string id)
4732 { 4842 {
4733 m_host.AddScriptLPS(1); 4843 m_host.AddScriptLPS(1);
4734 UUID key = new UUID(); 4844 UUID key = new UUID();
@@ -4751,17 +4861,17 @@ namespace OpenSim.Region.ScriptEngine.Common
4751 return 0; 4861 return 0;
4752 } 4862 }
4753 4863
4754 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) 4864 public LSL_String llGetLandOwnerAt(LSL_Vector pos)
4755 { 4865 {
4756 m_host.AddScriptLPS(1); 4866 m_host.AddScriptLPS(1);
4757 return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); 4867 return World.GetLandOwner((float)pos.x, (float)pos.y).ToString();
4758 } 4868 }
4759 4869
4760 public LSL_Types.Vector3 llGetAgentSize(string id) 4870 public LSL_Vector llGetAgentSize(string id)
4761 { 4871 {
4762 m_host.AddScriptLPS(1); 4872 m_host.AddScriptLPS(1);
4763 ScenePresence avatar = World.GetScenePresence(id); 4873 ScenePresence avatar = World.GetScenePresence(id);
4764 LSL_Types.Vector3 agentSize; 4874 LSL_Vector agentSize;
4765 if (avatar == null) 4875 if (avatar == null)
4766 { 4876 {
4767 agentSize = BuiltIn_Commands_BaseClass.ZERO_VECTOR; 4877 agentSize = BuiltIn_Commands_BaseClass.ZERO_VECTOR;
@@ -4769,25 +4879,25 @@ namespace OpenSim.Region.ScriptEngine.Common
4769 else 4879 else
4770 { 4880 {
4771 PhysicsVector size = avatar.PhysicsActor.Size; 4881 PhysicsVector size = avatar.PhysicsActor.Size;
4772 agentSize = new LSL_Types.Vector3(size.X, size.Y, size.Z); 4882 agentSize = new LSL_Vector(size.X, size.Y, size.Z);
4773 } 4883 }
4774 return agentSize; 4884 return agentSize;
4775 } 4885 }
4776 4886
4777 public LSL_Types.LSLInteger llSameGroup(string agent) 4887 public LSL_Integer llSameGroup(string agent)
4778 { 4888 {
4779 m_host.AddScriptLPS(1); 4889 m_host.AddScriptLPS(1);
4780 UUID agentId = new UUID(); 4890 UUID agentId = new UUID();
4781 if (!UUID.TryParse(agent, out agentId)) 4891 if (!UUID.TryParse(agent, out agentId))
4782 return new LSL_Types.LSLInteger(0); 4892 return new LSL_Integer(0);
4783 ScenePresence presence = World.GetScenePresence(agentId); 4893 ScenePresence presence = World.GetScenePresence(agentId);
4784 if (presence == null) 4894 if (presence == null)
4785 return new LSL_Types.LSLInteger(0); 4895 return new LSL_Integer(0);
4786 IClientAPI client = presence.ControllingClient; 4896 IClientAPI client = presence.ControllingClient;
4787 if (m_host.GroupID == client.ActiveGroupId) 4897 if (m_host.GroupID == client.ActiveGroupId)
4788 return new LSL_Types.LSLInteger(1); 4898 return new LSL_Integer(1);
4789 else 4899 else
4790 return new LSL_Types.LSLInteger(0); 4900 return new LSL_Integer(0);
4791 } 4901 }
4792 4902
4793 public void llUnSit(string id) 4903 public void llUnSit(string id)
@@ -4833,7 +4943,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4833 4943
4834 } 4944 }
4835 4945
4836 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) 4946 public LSL_Vector llGroundSlope(LSL_Vector offset)
4837 { 4947 {
4838 m_host.AddScriptLPS(1); 4948 m_host.AddScriptLPS(1);
4839 4949
@@ -4843,15 +4953,15 @@ namespace OpenSim.Region.ScriptEngine.Common
4843 4953
4844 Vector3 p0 = new Vector3(pos.X, pos.Y, 4954 Vector3 p0 = new Vector3(pos.X, pos.Y,
4845 (float)llGround( 4955 (float)llGround(
4846 new LSL_Types.Vector3(pos.X, pos.Y, pos.Z) 4956 new LSL_Vector(pos.X, pos.Y, pos.Z)
4847 )); 4957 ));
4848 Vector3 p1 = new Vector3(pos.X + 1, pos.Y, 4958 Vector3 p1 = new Vector3(pos.X + 1, pos.Y,
4849 (float)llGround( 4959 (float)llGround(
4850 new LSL_Types.Vector3(pos.X + 1, pos.Y, pos.Z) 4960 new LSL_Vector(pos.X + 1, pos.Y, pos.Z)
4851 )); 4961 ));
4852 Vector3 p2 = new Vector3(pos.X, pos.Y + 1, 4962 Vector3 p2 = new Vector3(pos.X, pos.Y + 1,
4853 (float)llGround( 4963 (float)llGround(
4854 new LSL_Types.Vector3(pos.X, pos.Y + 1, pos.Z) 4964 new LSL_Vector(pos.X, pos.Y + 1, pos.Z)
4855 )); 4965 ));
4856 4966
4857 Vector3 v0 = new Vector3( 4967 Vector3 v0 = new Vector3(
@@ -4867,50 +4977,50 @@ namespace OpenSim.Region.ScriptEngine.Common
4867 tv.Y = (v0.Z * v1.X) - (v0.X * v1.Z); 4977 tv.Y = (v0.Z * v1.X) - (v0.X * v1.Z);
4868 tv.Z = (v0.X * v1.Y) - (v0.Y * v1.X); 4978 tv.Z = (v0.X * v1.Y) - (v0.Y * v1.X);
4869 4979
4870 return new LSL_Types.Vector3(tv.X, tv.Y, tv.Z); 4980 return new LSL_Vector(tv.X, tv.Y, tv.Z);
4871 } 4981 }
4872 4982
4873 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) 4983 public LSL_Vector llGroundNormal(LSL_Vector offset)
4874 { 4984 {
4875 m_host.AddScriptLPS(1); 4985 m_host.AddScriptLPS(1);
4876 LSL_Types.Vector3 x = llGroundSlope(offset); 4986 LSL_Vector x = llGroundSlope(offset);
4877 return new LSL_Types.Vector3(x.x, x.y, 1.0); 4987 return new LSL_Vector(x.x, x.y, 1.0);
4878 } 4988 }
4879 4989
4880 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) 4990 public LSL_Vector llGroundContour(LSL_Vector offset)
4881 { 4991 {
4882 m_host.AddScriptLPS(1); 4992 m_host.AddScriptLPS(1);
4883 LSL_Types.Vector3 x = llGroundSlope(offset); 4993 LSL_Vector x = llGroundSlope(offset);
4884 return new LSL_Types.Vector3(-x.y, x.x, 0.0); 4994 return new LSL_Vector(-x.y, x.x, 0.0);
4885 } 4995 }
4886 4996
4887 public LSL_Types.LSLInteger llGetAttached() 4997 public LSL_Integer llGetAttached()
4888 { 4998 {
4889 m_host.AddScriptLPS(1); 4999 m_host.AddScriptLPS(1);
4890 NotImplemented("llGetAttached"); 5000 NotImplemented("llGetAttached");
4891 return 0; 5001 return 0;
4892 } 5002 }
4893 5003
4894 public LSL_Types.LSLInteger llGetFreeMemory() 5004 public LSL_Integer llGetFreeMemory()
4895 { 5005 {
4896 m_host.AddScriptLPS(1); 5006 m_host.AddScriptLPS(1);
4897 NotImplemented("llGetFreeMemory"); 5007 // Make scripts designed for LSO happy
4898 return 0; 5008 return 16384;
4899 } 5009 }
4900 5010
4901 public string llGetRegionName() 5011 public LSL_String llGetRegionName()
4902 { 5012 {
4903 m_host.AddScriptLPS(1); 5013 m_host.AddScriptLPS(1);
4904 return World.RegionInfo.RegionName; 5014 return World.RegionInfo.RegionName;
4905 } 5015 }
4906 5016
4907 public double llGetRegionTimeDilation() 5017 public LSL_Float llGetRegionTimeDilation()
4908 { 5018 {
4909 m_host.AddScriptLPS(1); 5019 m_host.AddScriptLPS(1);
4910 return (double)World.TimeDilation; 5020 return (double)World.TimeDilation;
4911 } 5021 }
4912 5022
4913 public double llGetRegionFPS() 5023 public LSL_Float llGetRegionFPS()
4914 { 5024 {
4915 m_host.AddScriptLPS(1); 5025 m_host.AddScriptLPS(1);
4916 //TODO: return actual FPS 5026 //TODO: return actual FPS
@@ -4976,17 +5086,18 @@ namespace OpenSim.Region.ScriptEngine.Common
4976 return ps; 5086 return ps;
4977 } 5087 }
4978 5088
4979 public void llParticleSystem(LSL_Types.list rules) 5089 public void llParticleSystem(LSL_List rules)
4980 { 5090 {
4981 m_host.AddScriptLPS(1); 5091 m_host.AddScriptLPS(1);
4982 if (rules.Length == 0) 5092 if (rules.Length == 0)
4983 { 5093 {
4984 m_host.RemoveParticleSystem(); 5094 m_host.RemoveParticleSystem();
5095 m_host.ParentGroup.HasGroupChanged = true;
4985 } 5096 }
4986 else 5097 else
4987 { 5098 {
4988 Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues(); 5099 Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues();
4989 LSL_Types.Vector3 tempv = new LSL_Types.Vector3(); 5100 LSL_Vector tempv = new LSL_Vector();
4990 5101
4991 float tempf = 0; 5102 float tempf = 0;
4992 5103
@@ -4999,7 +5110,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4999 break; 5110 break;
5000 5111
5001 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_COLOR: 5112 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_COLOR:
5002 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 5113 tempv = (LSL_Vector)rules.Data[i + 1];
5003 prules.PartStartColor.R = (float)tempv.x; 5114 prules.PartStartColor.R = (float)tempv.x;
5004 prules.PartStartColor.G = (float)tempv.y; 5115 prules.PartStartColor.G = (float)tempv.y;
5005 prules.PartStartColor.B = (float)tempv.z; 5116 prules.PartStartColor.B = (float)tempv.z;
@@ -5011,7 +5122,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5011 break; 5122 break;
5012 5123
5013 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_COLOR: 5124 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_COLOR:
5014 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 5125 tempv = (LSL_Vector)rules.Data[i + 1];
5015 //prules.PartEndColor = new Color4(tempv.x,tempv.y,tempv.z,1); 5126 //prules.PartEndColor = new Color4(tempv.x,tempv.y,tempv.z,1);
5016 5127
5017 prules.PartEndColor.R = (float)tempv.x; 5128 prules.PartEndColor.R = (float)tempv.x;
@@ -5025,13 +5136,13 @@ namespace OpenSim.Region.ScriptEngine.Common
5025 break; 5136 break;
5026 5137
5027 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_SCALE: 5138 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_START_SCALE:
5028 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 5139 tempv = (LSL_Vector)rules.Data[i + 1];
5029 prules.PartStartScaleX = (float)tempv.x; 5140 prules.PartStartScaleX = (float)tempv.x;
5030 prules.PartStartScaleY = (float)tempv.y; 5141 prules.PartStartScaleY = (float)tempv.y;
5031 break; 5142 break;
5032 5143
5033 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_SCALE: 5144 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_SCALE:
5034 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 5145 tempv = (LSL_Vector)rules.Data[i + 1];
5035 prules.PartEndScaleX = (float)tempv.x; 5146 prules.PartEndScaleX = (float)tempv.x;
5036 prules.PartEndScaleY = (float)tempv.y; 5147 prules.PartEndScaleY = (float)tempv.y;
5037 break; 5148 break;
@@ -5042,7 +5153,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5042 break; 5153 break;
5043 5154
5044 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ACCEL: 5155 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ACCEL:
5045 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 5156 tempv = (LSL_Vector)rules.Data[i + 1];
5046 prules.PartAcceleration.X = (float)tempv.x; 5157 prules.PartAcceleration.X = (float)tempv.x;
5047 prules.PartAcceleration.Y = (float)tempv.y; 5158 prules.PartAcceleration.Y = (float)tempv.y;
5048 prules.PartAcceleration.Z = (float)tempv.z; 5159 prules.PartAcceleration.Z = (float)tempv.z;
@@ -5104,20 +5215,19 @@ namespace OpenSim.Region.ScriptEngine.Common
5104 5215
5105 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_OMEGA: 5216 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_OMEGA:
5106 // AL: This is an assumption, since it is the only thing that would match. 5217 // AL: This is an assumption, since it is the only thing that would match.
5107 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 5218 tempv = rules.GetVector3Item(i + 1);
5108 prules.AngularVelocity.X = (float)tempv.x; 5219 prules.AngularVelocity.X = (float)tempv.x;
5109 prules.AngularVelocity.Y = (float)tempv.y; 5220 prules.AngularVelocity.Y = (float)tempv.y;
5110 prules.AngularVelocity.Z = (float)tempv.z; 5221 prules.AngularVelocity.Z = (float)tempv.z;
5111 //cast?? prules.MaxAge = (float)rules[i + 1];
5112 break; 5222 break;
5113 5223
5114 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_BEGIN: 5224 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_BEGIN:
5115 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 5225 tempf = (float)rules.GetLSLFloatItem(i + 1);
5116 prules.InnerAngle = (float)tempf; 5226 prules.InnerAngle = (float)tempf;
5117 break; 5227 break;
5118 5228
5119 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_END: 5229 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_ANGLE_END:
5120 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 5230 tempf = (float)rules.GetLSLFloatItem(i + 1);
5121 prules.OuterAngle = (float)tempf; 5231 prules.OuterAngle = (float)tempf;
5122 break; 5232 break;
5123 } 5233 }
@@ -5126,6 +5236,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5126 prules.CRC = 1; 5236 prules.CRC = 1;
5127 5237
5128 m_host.AddNewParticleSystem(prules); 5238 m_host.AddNewParticleSystem(prules);
5239 m_host.ParentGroup.HasGroupChanged = true;
5129 } 5240 }
5130 m_host.SendFullUpdateToAllClients(); 5241 m_host.SendFullUpdateToAllClients();
5131 } 5242 }
@@ -5146,7 +5257,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5146 return UUID.Zero; 5257 return UUID.Zero;
5147 } 5258 }
5148 5259
5149 public void llGiveInventoryList(string destination, string category, LSL_Types.list inventory) 5260 public void llGiveInventoryList(string destination, string category, LSL_List inventory)
5150 { 5261 {
5151 m_host.AddScriptLPS(1); 5262 m_host.AddScriptLPS(1);
5152 5263
@@ -5195,13 +5306,13 @@ namespace OpenSim.Region.ScriptEngine.Common
5195 NotImplemented("llSetVehicleFloatParam"); 5306 NotImplemented("llSetVehicleFloatParam");
5196 } 5307 }
5197 5308
5198 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) 5309 public void llSetVehicleVectorParam(int param, LSL_Vector vec)
5199 { 5310 {
5200 m_host.AddScriptLPS(1); 5311 m_host.AddScriptLPS(1);
5201 NotImplemented("llSetVehicleVectorParam"); 5312 NotImplemented("llSetVehicleVectorParam");
5202 } 5313 }
5203 5314
5204 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) 5315 public void llSetVehicleRotationParam(int param, LSL_Rotation rot)
5205 { 5316 {
5206 m_host.AddScriptLPS(1); 5317 m_host.AddScriptLPS(1);
5207 NotImplemented("llSetVehicleRotationParam"); 5318 NotImplemented("llSetVehicleRotationParam");
@@ -5219,7 +5330,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5219 NotImplemented("llRemoveVehicleFlags"); 5330 NotImplemented("llRemoveVehicleFlags");
5220 } 5331 }
5221 5332
5222 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) 5333 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
5223 { 5334 {
5224 m_host.AddScriptLPS(1); 5335 m_host.AddScriptLPS(1);
5225 // LSL quaternions can normalize to 0, normal Quaternions can't. 5336 // LSL quaternions can normalize to 0, normal Quaternions can't.
@@ -5230,7 +5341,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5230 m_host.SitTargetOrientation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); 5341 m_host.SitTargetOrientation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
5231 } 5342 }
5232 5343
5233 public string llAvatarOnSitTarget() 5344 public LSL_String llAvatarOnSitTarget()
5234 { 5345 {
5235 m_host.AddScriptLPS(1); 5346 m_host.AddScriptLPS(1);
5236 return m_host.GetAvatarOnSitTarget().ToString(); 5347 return m_host.GetAvatarOnSitTarget().ToString();
@@ -5267,19 +5378,19 @@ namespace OpenSim.Region.ScriptEngine.Common
5267 m_host.SitName = text; 5378 m_host.SitName = text;
5268 } 5379 }
5269 5380
5270 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) 5381 public void llSetCameraEyeOffset(LSL_Vector offset)
5271 { 5382 {
5272 m_host.AddScriptLPS(1); 5383 m_host.AddScriptLPS(1);
5273 m_host.SetCameraEyeOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); 5384 m_host.SetCameraEyeOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z));
5274 } 5385 }
5275 5386
5276 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) 5387 public void llSetCameraAtOffset(LSL_Vector offset)
5277 { 5388 {
5278 m_host.AddScriptLPS(1); 5389 m_host.AddScriptLPS(1);
5279 m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z)); 5390 m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z));
5280 } 5391 }
5281 5392
5282 public string llDumpList2String(LSL_Types.list src, string seperator) 5393 public LSL_String llDumpList2String(LSL_List src, string seperator)
5283 { 5394 {
5284 m_host.AddScriptLPS(1); 5395 m_host.AddScriptLPS(1);
5285 if (src.Length == 0) 5396 if (src.Length == 0)
@@ -5295,7 +5406,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5295 return ret; 5406 return ret;
5296 } 5407 }
5297 5408
5298 public LSL_Types.LSLInteger llScriptDanger(LSL_Types.Vector3 pos) 5409 public LSL_Integer llScriptDanger(LSL_Vector pos)
5299 { 5410 {
5300 m_host.AddScriptLPS(1); 5411 m_host.AddScriptLPS(1);
5301 bool result = World.scriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z)); 5412 bool result = World.scriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z));
@@ -5310,7 +5421,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5310 5421
5311 } 5422 }
5312 5423
5313 public void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel) 5424 public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
5314 { 5425 {
5315 m_host.AddScriptLPS(1); 5426 m_host.AddScriptLPS(1);
5316 UUID av = new UUID(); 5427 UUID av = new UUID();
@@ -5378,7 +5489,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5378 // assume it is not running. 5489 // assume it is not running.
5379 } 5490 }
5380 5491
5381 public LSL_Types.LSLInteger llGetScriptState(string name) 5492 public LSL_Integer llGetScriptState(string name)
5382 { 5493 {
5383 UUID item; 5494 UUID item;
5384 ScriptManager sm; 5495 ScriptManager sm;
@@ -5477,13 +5588,13 @@ namespace OpenSim.Region.ScriptEngine.Common
5477 if (xmlrpcMod.IsEnabled()) 5588 if (xmlrpcMod.IsEnabled())
5478 { 5589 {
5479 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); 5590 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero);
5480 object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(UUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) }; 5591 object[] resobj = new object[] { new LSL_Integer(1), new LSL_String(channelID.ToString()), new LSL_String(UUID.Zero.ToString()), new LSL_String(String.Empty), new LSL_Integer(0), new LSL_String(String.Empty) };
5481 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); 5592 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj);
5482 } 5593 }
5483 // ScriptSleep(1000); 5594 // ScriptSleep(1000);
5484 } 5595 }
5485 5596
5486 public string llSendRemoteData(string channel, string dest, int idata, string sdata) 5597 public LSL_String llSendRemoteData(string channel, string dest, int idata, string sdata)
5487 { 5598 {
5488 m_host.AddScriptLPS(1); 5599 m_host.AddScriptLPS(1);
5489 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 5600 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
@@ -5507,13 +5618,13 @@ namespace OpenSim.Region.ScriptEngine.Common
5507 // ScriptSleep(1000); 5618 // ScriptSleep(1000);
5508 } 5619 }
5509 5620
5510 public string llMD5String(string src, int nonce) 5621 public LSL_String llMD5String(string src, int nonce)
5511 { 5622 {
5512 m_host.AddScriptLPS(1); 5623 m_host.AddScriptLPS(1);
5513 return Util.Md5Hash(src + ":" + nonce.ToString()); 5624 return Util.Md5Hash(src + ":" + nonce.ToString());
5514 } 5625 }
5515 5626
5516 private ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist) 5627 private ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist)
5517 { 5628 {
5518 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 5629 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
5519 5630
@@ -5583,7 +5694,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5583 return shapeBlock; 5694 return shapeBlock;
5584 } 5695 }
5585 5696
5586 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge) 5697 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge)
5587 { 5698 {
5588 ObjectShapePacket.ObjectDataBlock shapeBlock; 5699 ObjectShapePacket.ObjectDataBlock shapeBlock;
5589 5700
@@ -5631,7 +5742,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5631 part.UpdateShape(shapeBlock); 5742 part.UpdateShape(shapeBlock);
5632 } 5743 }
5633 5744
5634 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge) 5745 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge)
5635 { 5746 {
5636 ObjectShapePacket.ObjectDataBlock shapeBlock; 5747 ObjectShapePacket.ObjectDataBlock shapeBlock;
5637 5748
@@ -5672,7 +5783,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5672 part.UpdateShape(shapeBlock); 5783 part.UpdateShape(shapeBlock);
5673 } 5784 }
5674 5785
5675 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge) 5786 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge)
5676 { 5787 {
5677 ObjectShapePacket.ObjectDataBlock shapeBlock; 5788 ObjectShapePacket.ObjectDataBlock shapeBlock;
5678 5789
@@ -5824,12 +5935,12 @@ namespace OpenSim.Region.ScriptEngine.Common
5824 part.UpdateShape(shapeBlock); 5935 part.UpdateShape(shapeBlock);
5825 } 5936 }
5826 5937
5827 public void llSetPrimitiveParams(LSL_Types.list rules) 5938 public void llSetPrimitiveParams(LSL_List rules)
5828 { 5939 {
5829 llSetLinkPrimitiveParams(m_host.LinkNum, rules); 5940 llSetLinkPrimitiveParams(m_host.LinkNum, rules);
5830 } 5941 }
5831 5942
5832 public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules) 5943 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
5833 { 5944 {
5834 m_host.AddScriptLPS(1); 5945 m_host.AddScriptLPS(1);
5835 5946
@@ -5850,7 +5961,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5850 int remain = rules.Length - idx; 5961 int remain = rules.Length - idx;
5851 5962
5852 int face; 5963 int face;
5853 LSL_Types.Vector3 v; 5964 LSL_Vector v;
5854 5965
5855 switch (code) 5966 switch (code)
5856 { 5967 {
@@ -5858,7 +5969,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5858 if (remain < 1) 5969 if (remain < 1)
5859 return; 5970 return;
5860 5971
5861 v=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5972 v=new LSL_Vector(rules.Data[idx++].ToString());
5862 SetPos(part, v); 5973 SetPos(part, v);
5863 5974
5864 break; 5975 break;
@@ -5866,7 +5977,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5866 if (remain < 1) 5977 if (remain < 1)
5867 return; 5978 return;
5868 5979
5869 v=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5980 v=new LSL_Vector(rules.Data[idx++].ToString());
5870 SetScale(part, v); 5981 SetScale(part, v);
5871 5982
5872 break; 5983 break;
@@ -5874,7 +5985,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5874 if (remain < 1) 5985 if (remain < 1)
5875 return; 5986 return;
5876 5987
5877 LSL_Types.Quaternion q = new LSL_Types.Quaternion(rules.Data[idx++].ToString()); 5988 LSL_Rotation q = new LSL_Rotation(rules.Data[idx++].ToString());
5878 SetRot(part, q); 5989 SetRot(part, q);
5879 5990
5880 break; 5991 break;
@@ -5887,14 +5998,14 @@ namespace OpenSim.Region.ScriptEngine.Common
5887 5998
5888 remain = rules.Length - idx; 5999 remain = rules.Length - idx;
5889 float hollow; 6000 float hollow;
5890 LSL_Types.Vector3 twist; 6001 LSL_Vector twist;
5891 LSL_Types.Vector3 taper_b; 6002 LSL_Vector taper_b;
5892 LSL_Types.Vector3 topshear; 6003 LSL_Vector topshear;
5893 float revolutions; 6004 float revolutions;
5894 float radiusoffset; 6005 float radiusoffset;
5895 float skew; 6006 float skew;
5896 LSL_Types.Vector3 holesize; 6007 LSL_Vector holesize;
5897 LSL_Types.Vector3 profilecut; 6008 LSL_Vector profilecut;
5898 6009
5899 switch (code) 6010 switch (code)
5900 { 6011 {
@@ -5902,12 +6013,12 @@ namespace OpenSim.Region.ScriptEngine.Common
5902 if (remain < 6) 6013 if (remain < 6)
5903 return; 6014 return;
5904 6015
5905 face = Convert.ToInt32(rules.Data[idx++]); // holeshape 6016 face = (int)rules.GetLSLIntegerItem(idx++);
5906 v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // cut 6017 v = rules.GetVector3Item(idx++); // cut
5907 hollow = (float)Convert.ToDouble(rules.Data[idx++]); 6018 hollow = (float)rules.GetLSLFloatItem(idx++);
5908 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6019 twist = rules.GetVector3Item(idx++);
5909 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6020 taper_b = rules.GetVector3Item(idx++);
5910 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6021 topshear = rules.GetVector3Item(idx++);
5911 part.Shape.PathCurve = (byte)Extrusion.Straight; 6022 part.Shape.PathCurve = (byte)Extrusion.Straight;
5912 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1); 6023 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1);
5913 break; 6024 break;
@@ -5916,12 +6027,12 @@ namespace OpenSim.Region.ScriptEngine.Common
5916 if (remain < 6) 6027 if (remain < 6)
5917 return; 6028 return;
5918 6029
5919 face = Convert.ToInt32(rules.Data[idx++]); // holeshape 6030 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
5920 v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // cut 6031 v = rules.GetVector3Item(idx++); // cut
5921 hollow = (float)Convert.ToDouble(rules.Data[idx++]); 6032 hollow = (float)rules.GetLSLFloatItem(idx++);
5922 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6033 twist = rules.GetVector3Item(idx++);
5923 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6034 taper_b = rules.GetVector3Item(idx++);
5924 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6035 topshear = rules.GetVector3Item(idx++);
5925 part.Shape.ProfileShape = ProfileShape.Circle; 6036 part.Shape.ProfileShape = ProfileShape.Circle;
5926 part.Shape.PathCurve = (byte)Extrusion.Straight; 6037 part.Shape.PathCurve = (byte)Extrusion.Straight;
5927 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0); 6038 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0);
@@ -5931,12 +6042,12 @@ namespace OpenSim.Region.ScriptEngine.Common
5931 if (remain < 6) 6042 if (remain < 6)
5932 return; 6043 return;
5933 6044
5934 face = Convert.ToInt32(rules.Data[idx++]); // holeshape 6045 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
5935 v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut 6046 v = rules.GetVector3Item(idx++); //cut
5936 hollow = (float)Convert.ToDouble(rules.Data[idx++]); 6047 hollow = (float)rules.GetLSLFloatItem(idx++);
5937 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6048 twist = rules.GetVector3Item(idx++);
5938 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6049 taper_b = rules.GetVector3Item(idx++);
5939 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6050 topshear = rules.GetVector3Item(idx++);
5940 part.Shape.PathCurve = (byte)Extrusion.Straight; 6051 part.Shape.PathCurve = (byte)Extrusion.Straight;
5941 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3); 6052 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3);
5942 break; 6053 break;
@@ -5945,11 +6056,11 @@ namespace OpenSim.Region.ScriptEngine.Common
5945 if (remain < 5) 6056 if (remain < 5)
5946 return; 6057 return;
5947 6058
5948 face = Convert.ToInt32(rules.Data[idx++]); // holeshape 6059 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
5949 v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // cut 6060 v = rules.GetVector3Item(idx++); // cut
5950 hollow = (float)Convert.ToDouble(rules.Data[idx++]); 6061 hollow = (float)rules.GetLSLFloatItem(idx++);
5951 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6062 twist = rules.GetVector3Item(idx++);
5952 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // dimple 6063 taper_b = rules.GetVector3Item(idx++); // dimple
5953 part.Shape.PathCurve = (byte)Extrusion.Curve1; 6064 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5954 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5); 6065 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5);
5955 break; 6066 break;
@@ -5958,17 +6069,17 @@ namespace OpenSim.Region.ScriptEngine.Common
5958 if (remain < 11) 6069 if (remain < 11)
5959 return; 6070 return;
5960 6071
5961 face = Convert.ToInt32(rules.Data[idx++]); // holeshape 6072 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
5962 v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut 6073 v = rules.GetVector3Item(idx++); //cut
5963 hollow = (float)Convert.ToDouble(rules.Data[idx++]); 6074 hollow = (float)rules.GetLSLFloatItem(idx++);
5964 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6075 twist = rules.GetVector3Item(idx++);
5965 holesize = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6076 holesize = rules.GetVector3Item(idx++);
5966 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6077 topshear = rules.GetVector3Item(idx++);
5967 profilecut = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6078 profilecut = rules.GetVector3Item(idx++);
5968 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // taper_a 6079 taper_b = rules.GetVector3Item(idx++); // taper_a
5969 revolutions = (float)Convert.ToDouble(rules.Data[idx++]); 6080 revolutions = (float)rules.GetLSLFloatItem(idx++);
5970 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); 6081 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
5971 skew = (float)Convert.ToDouble(rules.Data[idx++]); 6082 skew = (float)rules.GetLSLFloatItem(idx++);
5972 part.Shape.PathCurve = (byte)Extrusion.Curve1; 6083 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5973 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); 6084 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0);
5974 break; 6085 break;
@@ -5977,17 +6088,17 @@ namespace OpenSim.Region.ScriptEngine.Common
5977 if (remain < 11) 6088 if (remain < 11)
5978 return; 6089 return;
5979 6090
5980 face = Convert.ToInt32(rules.Data[idx++]); // holeshape 6091 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
5981 v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut 6092 v = rules.GetVector3Item(idx++); //cut
5982 hollow = (float)Convert.ToDouble(rules.Data[idx++]); 6093 hollow = (float)rules.GetLSLFloatItem(idx++);
5983 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6094 twist = rules.GetVector3Item(idx++);
5984 holesize = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6095 holesize = rules.GetVector3Item(idx++);
5985 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6096 topshear = rules.GetVector3Item(idx++);
5986 profilecut = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6097 profilecut = rules.GetVector3Item(idx++);
5987 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // taper_a 6098 taper_b = rules.GetVector3Item(idx++); // taper_a
5988 revolutions = (float)Convert.ToDouble(rules.Data[idx++]); 6099 revolutions = (float)rules.GetLSLFloatItem(idx++);
5989 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); 6100 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
5990 skew = (float)Convert.ToDouble(rules.Data[idx++]); 6101 skew = (float)rules.GetLSLFloatItem(idx++);
5991 part.Shape.PathCurve = (byte)Extrusion.Curve1; 6102 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5992 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); 6103 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1);
5993 break; 6104 break;
@@ -5996,17 +6107,17 @@ namespace OpenSim.Region.ScriptEngine.Common
5996 if (remain < 11) 6107 if (remain < 11)
5997 return; 6108 return;
5998 6109
5999 face = Convert.ToInt32(rules.Data[idx++]); // holeshape 6110 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
6000 v = new LSL_Types.Vector3(rules.Data[idx++].ToString()); //cut 6111 v = rules.GetVector3Item(idx++); //cut
6001 hollow = (float)Convert.ToDouble(rules.Data[idx++]); 6112 hollow = (float)rules.GetLSLFloatItem(idx++);
6002 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6113 twist = rules.GetVector3Item(idx++);
6003 holesize = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6114 holesize = rules.GetVector3Item(idx++);
6004 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6115 topshear = rules.GetVector3Item(idx++);
6005 profilecut = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6116 profilecut = rules.GetVector3Item(idx++);
6006 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // taper_a 6117 taper_b = rules.GetVector3Item(idx++); // taper_a
6007 revolutions = (float)Convert.ToDouble(rules.Data[idx++]); 6118 revolutions = (float)rules.GetLSLFloatItem(idx++);
6008 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); 6119 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
6009 skew = (float)Convert.ToDouble(rules.Data[idx++]); 6120 skew = (float)rules.GetLSLFloatItem(idx++);
6010 part.Shape.PathCurve = (byte)Extrusion.Curve1; 6121 part.Shape.PathCurve = (byte)Extrusion.Curve1;
6011 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); 6122 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3);
6012 break; 6123 break;
@@ -6016,7 +6127,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6016 return; 6127 return;
6017 6128
6018 string map = rules.Data[idx++].ToString(); 6129 string map = rules.Data[idx++].ToString();
6019 face = Convert.ToInt32(rules.Data[idx++]); // type 6130 face = (int)rules.GetLSLIntegerItem(idx++); // type
6020 part.Shape.PathCurve = (byte)Extrusion.Curve1; 6131 part.Shape.PathCurve = (byte)Extrusion.Curve1;
6021 SetPrimitiveShapeParams(part, map, face); 6132 SetPrimitiveShapeParams(part, map, face);
6022 break; 6133 break;
@@ -6028,11 +6139,11 @@ namespace OpenSim.Region.ScriptEngine.Common
6028 if (remain < 5) 6139 if (remain < 5)
6029 return; 6140 return;
6030 6141
6031 face=Convert.ToInt32(rules.Data[idx++]); 6142 face=(int)rules.GetLSLIntegerItem(idx++);
6032 string tex=rules.Data[idx++].ToString(); 6143 string tex=rules.Data[idx++].ToString();
6033 LSL_Types.Vector3 repeats=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6144 LSL_Vector repeats=rules.GetVector3Item(idx++);
6034 LSL_Types.Vector3 offsets=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6145 LSL_Vector offsets=rules.GetVector3Item(idx++);
6035 double rotation=Convert.ToDouble(rules.Data[idx++]); 6146 double rotation=(double)rules.GetLSLFloatItem(idx++);
6036 6147
6037 SetTexture(part, tex, face); 6148 SetTexture(part, tex, face);
6038 ScaleTexture(part, repeats.x, repeats.y, face); 6149 ScaleTexture(part, repeats.x, repeats.y, face);
@@ -6045,9 +6156,9 @@ namespace OpenSim.Region.ScriptEngine.Common
6045 if (remain < 3) 6156 if (remain < 3)
6046 return; 6157 return;
6047 6158
6048 face=Convert.ToInt32(rules.Data[idx++]); 6159 face=(int)rules.GetLSLIntegerItem(idx++);
6049 LSL_Types.Vector3 color=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6160 LSL_Vector color=rules.GetVector3Item(idx++);
6050 double alpha=Convert.ToDouble(rules.Data[idx++]); 6161 double alpha=(double)rules.GetLSLFloatItem(idx++);
6051 6162
6052 SetColor(part, color, face); 6163 SetColor(part, color, face);
6053 SetAlpha(part, alpha, face); 6164 SetAlpha(part, alpha, face);
@@ -6057,34 +6168,34 @@ namespace OpenSim.Region.ScriptEngine.Common
6057 if (remain < 7) 6168 if (remain < 7)
6058 return; 6169 return;
6059 6170
6060 int flexi = Convert.ToInt32(rules.Data[idx++]); 6171 bool flexi = rules.GetLSLIntegerItem(idx++);
6061 int softness = Convert.ToInt32(rules.Data[idx++]); 6172 int softness = rules.GetLSLIntegerItem(idx++);
6062 float gravity = (float)Convert.ToDouble(rules.Data[idx++]); 6173 float gravity = (float)rules.GetLSLFloatItem(idx++);
6063 float friction = (float)Convert.ToDouble(rules.Data[idx++]); 6174 float friction = (float)rules.GetLSLFloatItem(idx++);
6064 float wind = (float)Convert.ToDouble(rules.Data[idx++]); 6175 float wind = (float)rules.GetLSLFloatItem(idx++);
6065 float tension = (float)Convert.ToDouble(rules.Data[idx++]); 6176 float tension = (float)rules.GetLSLFloatItem(idx++);
6066 LSL_Types.Vector3 force =new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6177 LSL_Vector force = rules.GetVector3Item(idx++);
6067 6178
6068 SetFlexi(part, (flexi == 1), softness, gravity, friction, wind, tension, force); 6179 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force);
6069 6180
6070 break; 6181 break;
6071 case (int)BuiltIn_Commands_BaseClass.PRIM_POINT_LIGHT: 6182 case (int)BuiltIn_Commands_BaseClass.PRIM_POINT_LIGHT:
6072 if (remain < 5) 6183 if (remain < 5)
6073 return; 6184 return;
6074 int light = Convert.ToInt32(rules.Data[idx++]); 6185 bool light = rules.GetLSLIntegerItem(idx++);
6075 LSL_Types.Vector3 lightcolor =new LSL_Types.Vector3(rules.Data[idx++].ToString()); 6186 LSL_Vector lightcolor = rules.GetVector3Item(idx++);
6076 float intensity = (float)Convert.ToDouble(rules.Data[idx++]); 6187 float intensity = (float)rules.GetLSLFloatItem(idx++);
6077 float radius = (float)Convert.ToDouble(rules.Data[idx++]); 6188 float radius = (float)rules.GetLSLFloatItem(idx++);
6078 float falloff = (float)Convert.ToDouble(rules.Data[idx++]); 6189 float falloff = (float)rules.GetLSLFloatItem(idx++);
6079 6190
6080 SetPointLight(part, (light == 1), lightcolor, intensity, radius, falloff); 6191 SetPointLight(part, light, lightcolor, intensity, radius, falloff);
6081 6192
6082 break; 6193 break;
6083 case (int)BuiltIn_Commands_BaseClass.PRIM_GLOW: 6194 case (int)BuiltIn_Commands_BaseClass.PRIM_GLOW:
6084 if (remain < 2) 6195 if (remain < 2)
6085 return; 6196 return;
6086 face = Convert.ToInt32(rules.Data[idx++]); 6197 face = rules.GetLSLIntegerItem(idx++);
6087 float glow = (float)Convert.ToDouble(rules.Data[idx++]); 6198 float glow = (float)rules.GetLSLFloatItem(idx++);
6088 6199
6089 SetGlow(part, face, glow); 6200 SetGlow(part, face, glow);
6090 6201
@@ -6092,9 +6203,9 @@ namespace OpenSim.Region.ScriptEngine.Common
6092 case (int)BuiltIn_Commands_BaseClass.PRIM_BUMP_SHINY: 6203 case (int)BuiltIn_Commands_BaseClass.PRIM_BUMP_SHINY:
6093 if (remain < 3) 6204 if (remain < 3)
6094 return; 6205 return;
6095 face = Convert.ToInt32(rules.Data[idx++]); 6206 face = (int)rules.GetLSLIntegerItem(idx++);
6096 int shiny = Convert.ToInt32(rules.Data[idx++]); 6207 int shiny = (int)rules.GetLSLIntegerItem(idx++);
6097 Bumpiness bump = (Bumpiness)Convert.ToByte(rules.Data[idx++]); 6208 Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++));
6098 6209
6099 SetShiny(part, face, shiny, bump); 6210 SetShiny(part, face, shiny, bump);
6100 6211
@@ -6102,14 +6213,8 @@ namespace OpenSim.Region.ScriptEngine.Common
6102 case (int)BuiltIn_Commands_BaseClass.PRIM_FULLBRIGHT: 6213 case (int)BuiltIn_Commands_BaseClass.PRIM_FULLBRIGHT:
6103 if (remain < 2) 6214 if (remain < 2)
6104 return; 6215 return;
6105 face = Convert.ToInt32(rules.Data[idx++]); 6216 face = rules.GetLSLIntegerItem(idx++);
6106 string bv = rules.Data[idx++].ToString(); 6217 bool st = rules.GetLSLIntegerItem(idx++);
6107 bool st;
6108 if (bv.Equals("1"))
6109 st = true;
6110 else
6111 st = false;
6112
6113 SetFullBright(part, face , st); 6218 SetFullBright(part, face , st);
6114 break; 6219 break;
6115 case (int)BuiltIn_Commands_BaseClass.PRIM_MATERIAL: 6220 case (int)BuiltIn_Commands_BaseClass.PRIM_MATERIAL:
@@ -6119,7 +6224,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6119 { 6224 {
6120 /* Unhandled at this time - sends "Unhandled" message 6225 /* Unhandled at this time - sends "Unhandled" message
6121 will enable when available 6226 will enable when available
6122 byte material = (byte)Convert.ToByte( rules.Data[idx++]); 6227 byte material = Convert.ToByte((int)rules.GetLSLIntegerItem(idx++));
6123 part.Material = material; 6228 part.Material = material;
6124 */ 6229 */
6125 return; 6230 return;
@@ -6158,7 +6263,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6158 } 6263 }
6159 } 6264 }
6160 6265
6161 public string llStringToBase64(string str) 6266 public LSL_String llStringToBase64(string str)
6162 { 6267 {
6163 m_host.AddScriptLPS(1); 6268 m_host.AddScriptLPS(1);
6164 try 6269 try
@@ -6174,7 +6279,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6174 } 6279 }
6175 } 6280 }
6176 6281
6177 public string llBase64ToString(string str) 6282 public LSL_String llBase64ToString(string str)
6178 { 6283 {
6179 m_host.AddScriptLPS(1); 6284 m_host.AddScriptLPS(1);
6180 UTF8Encoding encoder = new UTF8Encoding(); 6285 UTF8Encoding encoder = new UTF8Encoding();
@@ -6207,23 +6312,23 @@ namespace OpenSim.Region.ScriptEngine.Common
6207 NotImplemented("llRemoteDataSetRegion"); 6312 NotImplemented("llRemoteDataSetRegion");
6208 } 6313 }
6209 6314
6210 public double llLog10(double val) 6315 public LSL_Float llLog10(double val)
6211 { 6316 {
6212 m_host.AddScriptLPS(1); 6317 m_host.AddScriptLPS(1);
6213 return (double)Math.Log10(val); 6318 return (double)Math.Log10(val);
6214 } 6319 }
6215 6320
6216 public double llLog(double val) 6321 public LSL_Float llLog(double val)
6217 { 6322 {
6218 m_host.AddScriptLPS(1); 6323 m_host.AddScriptLPS(1);
6219 return (double)Math.Log(val); 6324 return (double)Math.Log(val);
6220 } 6325 }
6221 6326
6222 public LSL_Types.list llGetAnimationList( string id ) 6327 public LSL_List llGetAnimationList( string id )
6223 { 6328 {
6224 m_host.AddScriptLPS(1); 6329 m_host.AddScriptLPS(1);
6225 6330
6226 LSL_Types.list l = new LSL_Types.list(); 6331 LSL_List l = new LSL_List();
6227 ScenePresence av = World.GetScenePresence(id); 6332 ScenePresence av = World.GetScenePresence(id);
6228 if (av == null) 6333 if (av == null)
6229 return l; 6334 return l;
@@ -6250,44 +6355,19 @@ namespace OpenSim.Region.ScriptEngine.Common
6250 // ScriptSleep(2000); 6355 // ScriptSleep(2000);
6251 } 6356 }
6252 6357
6253 public void osSetParcelMediaURL(string url) 6358 public LSL_Vector llGetRootPosition()
6254 { 6359 {
6255 m_host.AddScriptLPS(1); 6360 m_host.AddScriptLPS(1);
6256 UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 6361 return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, m_host.ParentGroup.AbsolutePosition.Z);
6257
6258 if (landowner == UUID.Zero)
6259 {
6260 return;
6261 }
6262
6263 if (landowner != m_host.ObjectOwner)
6264 {
6265 return;
6266 }
6267
6268 World.SetLandMediaURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url);
6269 }
6270
6271 public LSL_Types.Vector3 llGetRootPosition()
6272 {
6273 m_host.AddScriptLPS(1);
6274 return new LSL_Types.Vector3(
6275 m_host.ParentGroup.AbsolutePosition.X,
6276 m_host.ParentGroup.AbsolutePosition.Y,
6277 m_host.ParentGroup.AbsolutePosition.Z);
6278 } 6362 }
6279 6363
6280 public LSL_Types.Quaternion llGetRootRotation() 6364 public LSL_Rotation llGetRootRotation()
6281 { 6365 {
6282 m_host.AddScriptLPS(1); 6366 m_host.AddScriptLPS(1);
6283 return new LSL_Types.Quaternion( 6367 return new LSL_Rotation(m_host.ParentGroup.GroupRotation.X, m_host.ParentGroup.GroupRotation.Y, m_host.ParentGroup.GroupRotation.Z, m_host.ParentGroup.GroupRotation.W);
6284 m_host.ParentGroup.GroupRotation.X,
6285 m_host.ParentGroup.GroupRotation.Y,
6286 m_host.ParentGroup.GroupRotation.Z,
6287 m_host.ParentGroup.GroupRotation.W);
6288 } 6368 }
6289 6369
6290 public string llGetObjectDesc() 6370 public LSL_String llGetObjectDesc()
6291 { 6371 {
6292 return m_host.Description!=null?m_host.Description:String.Empty; 6372 return m_host.Description!=null?m_host.Description:String.Empty;
6293 } 6373 }
@@ -6298,13 +6378,13 @@ namespace OpenSim.Region.ScriptEngine.Common
6298 m_host.Description = desc!=null?desc:String.Empty; 6378 m_host.Description = desc!=null?desc:String.Empty;
6299 } 6379 }
6300 6380
6301 public string llGetCreator() 6381 public LSL_String llGetCreator()
6302 { 6382 {
6303 m_host.AddScriptLPS(1); 6383 m_host.AddScriptLPS(1);
6304 return m_host.ObjectCreator.ToString(); 6384 return m_host.ObjectCreator.ToString();
6305 } 6385 }
6306 6386
6307 public string llGetTimestamp() 6387 public LSL_String llGetTimestamp()
6308 { 6388 {
6309 m_host.AddScriptLPS(1); 6389 m_host.AddScriptLPS(1);
6310 return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); 6390 return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
@@ -6318,7 +6398,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6318 { 6398 {
6319 Primitive.TextureEntry tex = part.Shape.Textures; 6399 Primitive.TextureEntry tex = part.Shape.Textures;
6320 Color4 texcolor; 6400 Color4 texcolor;
6321 if (face > -1) 6401 if (face >= 0 && face < GetNumberOfSides(m_host))
6322 { 6402 {
6323 texcolor = tex.CreateFace((uint)face).RGBA; 6403 texcolor = tex.CreateFace((uint)face).RGBA;
6324 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); 6404 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
@@ -6326,12 +6406,12 @@ namespace OpenSim.Region.ScriptEngine.Common
6326 part.UpdateTexture(tex); 6406 part.UpdateTexture(tex);
6327 return; 6407 return;
6328 } 6408 }
6329 else if (face == -1) 6409 else if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
6330 { 6410 {
6331 texcolor = tex.DefaultTexture.RGBA; 6411 texcolor = tex.DefaultTexture.RGBA;
6332 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); 6412 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
6333 tex.DefaultTexture.RGBA = texcolor; 6413 tex.DefaultTexture.RGBA = texcolor;
6334 for (uint i = 0; i < 32; i++) 6414 for (uint i = 0; i < GetNumberOfSides(m_host); i++)
6335 { 6415 {
6336 if (tex.FaceTextures[i] != null) 6416 if (tex.FaceTextures[i] != null)
6337 { 6417 {
@@ -6388,77 +6468,76 @@ namespace OpenSim.Region.ScriptEngine.Common
6388 } 6468 }
6389 } 6469 }
6390 6470
6391 public LSL_Types.LSLInteger llGetNumberOfPrims() 6471 public LSL_Integer llGetNumberOfPrims()
6392 { 6472 {
6393 m_host.AddScriptLPS(1); 6473 m_host.AddScriptLPS(1);
6394 return m_host.ParentGroup.PrimCount; 6474 return m_host.ParentGroup.PrimCount;
6395 } 6475 }
6396 6476
6397 public LSL_Types.list llGetBoundingBox(string obj) 6477 public LSL_List llGetBoundingBox(string obj)
6398 { 6478 {
6399 m_host.AddScriptLPS(1); 6479 m_host.AddScriptLPS(1);
6400 NotImplemented("llGetBoundingBox"); 6480 NotImplemented("llGetBoundingBox");
6401 return new LSL_Types.list(); 6481 return new LSL_List();
6402 } 6482 }
6403 6483
6404 public LSL_Types.Vector3 llGetGeometricCenter() 6484 public LSL_Vector llGetGeometricCenter()
6405 { 6485 {
6406 return new LSL_Types.Vector3( 6486 return new LSL_Vector(m_host.GetGeometricCenter().X, m_host.GetGeometricCenter().Y, m_host.GetGeometricCenter().Z);
6407 m_host.GetGeometricCenter().X, m_host.GetGeometricCenter().Y, m_host.GetGeometricCenter().Z);
6408 } 6487 }
6409 6488
6410 public LSL_Types.list llGetPrimitiveParams(LSL_Types.list rules) 6489 public LSL_List llGetPrimitiveParams(LSL_List rules)
6411 { 6490 {
6412 m_host.AddScriptLPS(1); 6491 m_host.AddScriptLPS(1);
6413 6492
6414 LSL_Types.list res = new LSL_Types.list(); 6493 LSL_List res = new LSL_List();
6415 int idx=0; 6494 int idx=0;
6416 while (idx < rules.Length) 6495 while (idx < rules.Length)
6417 { 6496 {
6418 int code=Convert.ToInt32(rules.Data[idx++]); 6497 int code=(int)rules.GetLSLIntegerItem(idx++);
6419 int remain=rules.Length-idx; 6498 int remain=rules.Length-idx;
6420 6499
6421 switch (code) 6500 switch (code)
6422 { 6501 {
6423 case (int)BuiltIn_Commands_BaseClass.PRIM_MATERIAL: 6502 case (int)BuiltIn_Commands_BaseClass.PRIM_MATERIAL:
6424 res.Add(new LSL_Types.LSLInteger(m_host.Material)); 6503 res.Add(new LSL_Integer(m_host.Material));
6425 break; 6504 break;
6426 6505
6427 case (int)BuiltIn_Commands_BaseClass.PRIM_PHYSICS: 6506 case (int)BuiltIn_Commands_BaseClass.PRIM_PHYSICS:
6428 if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0) 6507 if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0)
6429 res.Add(new LSL_Types.LSLInteger(1)); 6508 res.Add(new LSL_Integer(1));
6430 else 6509 else
6431 res.Add(new LSL_Types.LSLInteger(0)); 6510 res.Add(new LSL_Integer(0));
6432 break; 6511 break;
6433 6512
6434 case (int)BuiltIn_Commands_BaseClass.PRIM_TEMP_ON_REZ: 6513 case (int)BuiltIn_Commands_BaseClass.PRIM_TEMP_ON_REZ:
6435 if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0) 6514 if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0)
6436 res.Add(new LSL_Types.LSLInteger(1)); 6515 res.Add(new LSL_Integer(1));
6437 else 6516 else
6438 res.Add(new LSL_Types.LSLInteger(0)); 6517 res.Add(new LSL_Integer(0));
6439 break; 6518 break;
6440 6519
6441 case (int)BuiltIn_Commands_BaseClass.PRIM_PHANTOM: 6520 case (int)BuiltIn_Commands_BaseClass.PRIM_PHANTOM:
6442 if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) 6521 if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
6443 res.Add(new LSL_Types.LSLInteger(1)); 6522 res.Add(new LSL_Integer(1));
6444 else 6523 else
6445 res.Add(new LSL_Types.LSLInteger(0)); 6524 res.Add(new LSL_Integer(0));
6446 break; 6525 break;
6447 6526
6448 case (int)BuiltIn_Commands_BaseClass.PRIM_POSITION: 6527 case (int)BuiltIn_Commands_BaseClass.PRIM_POSITION:
6449 res.Add(new LSL_Types.Vector3(m_host.AbsolutePosition.X, 6528 res.Add(new LSL_Vector(m_host.AbsolutePosition.X,
6450 m_host.AbsolutePosition.Y, 6529 m_host.AbsolutePosition.Y,
6451 m_host.AbsolutePosition.Z)); 6530 m_host.AbsolutePosition.Z));
6452 break; 6531 break;
6453 6532
6454 case (int)BuiltIn_Commands_BaseClass.PRIM_SIZE: 6533 case (int)BuiltIn_Commands_BaseClass.PRIM_SIZE:
6455 res.Add(new LSL_Types.Vector3(m_host.Scale.X, 6534 res.Add(new LSL_Vector(m_host.Scale.X,
6456 m_host.Scale.Y, 6535 m_host.Scale.Y,
6457 m_host.Scale.Z)); 6536 m_host.Scale.Z));
6458 break; 6537 break;
6459 6538
6460 case (int)BuiltIn_Commands_BaseClass.PRIM_ROTATION: 6539 case (int)BuiltIn_Commands_BaseClass.PRIM_ROTATION:
6461 res.Add(new LSL_Types.Quaternion(m_host.RotationOffset.X, 6540 res.Add(new LSL_Rotation(m_host.RotationOffset.X,
6462 m_host.RotationOffset.Y, 6541 m_host.RotationOffset.Y,
6463 m_host.RotationOffset.Z, 6542 m_host.RotationOffset.Z,
6464 m_host.RotationOffset.W)); 6543 m_host.RotationOffset.W));
@@ -6468,69 +6547,69 @@ namespace OpenSim.Region.ScriptEngine.Common
6468 // implementing box 6547 // implementing box
6469 PrimitiveBaseShape Shape = m_host.Shape; 6548 PrimitiveBaseShape Shape = m_host.Shape;
6470 int primType = getScriptPrimType(m_host.Shape); 6549 int primType = getScriptPrimType(m_host.Shape);
6471 res.Add(new LSL_Types.LSLInteger(primType)); 6550 res.Add(new LSL_Integer(primType));
6472 switch (primType) 6551 switch (primType)
6473 { 6552 {
6474 case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX: 6553 case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX:
6475 case BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER: 6554 case BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER:
6476 case BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM: 6555 case BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM:
6477 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); 6556 res.Add(new LSL_Integer(Shape.ProfileCurve));
6478 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 6557 res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6479 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); 6558 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
6480 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 6559 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6481 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); 6560 res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
6482 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); 6561 res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
6483 break; 6562 break;
6484 6563
6485 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SPHERE: 6564 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SPHERE:
6486 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); 6565 res.Add(new LSL_Integer(Shape.ProfileCurve));
6487 res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); 6566 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
6488 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); 6567 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
6489 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 6568 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6490 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 6569 res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6491 break; 6570 break;
6492 6571
6493 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT: 6572 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT:
6494 res.Add(Shape.SculptTexture.ToString()); 6573 res.Add(Shape.SculptTexture.ToString());
6495 res.Add(new LSL_Types.LSLInteger(Shape.SculptType)); 6574 res.Add(new LSL_Integer(Shape.SculptType));
6496 break; 6575 break;
6497 6576
6498 case BuiltIn_Commands_BaseClass.PRIM_TYPE_RING: 6577 case BuiltIn_Commands_BaseClass.PRIM_TYPE_RING:
6499 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE: 6578 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE:
6500 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS: 6579 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS:
6501 // holeshape 6580 // holeshape
6502 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); 6581 res.Add(new LSL_Integer(Shape.ProfileCurve));
6503 6582
6504 // cut 6583 // cut
6505 res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); 6584 res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
6506 6585
6507 // hollow 6586 // hollow
6508 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); 6587 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
6509 6588
6510 // twist 6589 // twist
6511 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 6590 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6512 6591
6513 // vector holesize 6592 // vector holesize
6514 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); 6593 res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
6515 6594
6516 // vector topshear 6595 // vector topshear
6517 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); 6596 res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
6518 6597
6519 // vector profilecut 6598 // vector profilecut
6520 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 6599 res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6521 6600
6522 6601
6523 // vector tapera 6602 // vector tapera
6524 res.Add(new LSL_Types.Vector3(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); 6603 res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
6525 6604
6526 // float revolutions, 6605 // float revolutions,
6527 res.Add(new LSL_Types.LSLFloat(Shape.PathRevolutions / 50.0)); // needs fixing :( 6606 res.Add(new LSL_Float(Shape.PathRevolutions / 50.0)); // needs fixing :(
6528 6607
6529 // float radiusoffset, 6608 // float radiusoffset,
6530 res.Add(new LSL_Types.LSLFloat(Shape.PathRadiusOffset / 100.0)); 6609 res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
6531 6610
6532 // float skew 6611 // float skew
6533 res.Add(new LSL_Types.LSLFloat(Shape.PathSkew / 100.0)); 6612 res.Add(new LSL_Float(Shape.PathSkew / 100.0));
6534 break; 6613 break;
6535 6614
6536 } 6615 }
@@ -6540,39 +6619,69 @@ namespace OpenSim.Region.ScriptEngine.Common
6540 if (remain < 1) 6619 if (remain < 1)
6541 return res; 6620 return res;
6542 6621
6543 int face = Convert.ToInt32("" + rules.Data[idx++]); 6622 int face = (int)rules.GetLSLIntegerItem(idx++);
6544 if (face == -1)
6545 face = 0;
6546
6547 Primitive.TextureEntry tex = m_host.Shape.Textures; 6623 Primitive.TextureEntry tex = m_host.Shape.Textures;
6548 Primitive.TextureEntryFace texface = tex.GetFace((uint)face); 6624 if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
6549 6625 {
6550 res.Add(new LSL_Types.LSLString(texface.TextureID.ToString())); 6626 for (face = 0 ; face < GetNumberOfSides(m_host) ; face++)
6551 res.Add(new LSL_Types.Vector3(texface.RepeatU, 6627 {
6552 texface.RepeatV, 6628 Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
6553 0)); 6629
6554 res.Add(new LSL_Types.Vector3(texface.OffsetU, 6630 res.Add(new LSL_String(texface.TextureID.ToString()));
6555 texface.OffsetV, 6631 res.Add(new LSL_Vector(texface.RepeatU,
6556 0)); 6632 texface.RepeatV,
6557 res.Add(new LSL_Types.LSLFloat(texface.Rotation)); 6633 0));
6634 res.Add(new LSL_Vector(texface.OffsetU,
6635 texface.OffsetV,
6636 0));
6637 res.Add(new LSL_Float(texface.Rotation));
6638 }
6639 }
6640 else
6641 {
6642 if (face >= 0 && face < GetNumberOfSides(m_host))
6643 {
6644 Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
6645
6646 res.Add(new LSL_String(texface.TextureID.ToString()));
6647 res.Add(new LSL_Vector(texface.RepeatU,
6648 texface.RepeatV,
6649 0));
6650 res.Add(new LSL_Vector(texface.OffsetU,
6651 texface.OffsetV,
6652 0));
6653 res.Add(new LSL_Float(texface.Rotation));
6654 }
6655 }
6558 break; 6656 break;
6559 6657
6560 case (int)BuiltIn_Commands_BaseClass.PRIM_COLOR: 6658 case (int)BuiltIn_Commands_BaseClass.PRIM_COLOR:
6561 if (remain < 1) 6659 if (remain < 1)
6562 return res; 6660 return res;
6563 6661
6564 face=Convert.ToInt32("" + rules.Data[idx++]); 6662 face=(int)rules.GetLSLIntegerItem(idx++);
6565 6663
6566 tex = m_host.Shape.Textures; 6664 tex = m_host.Shape.Textures;
6567 Color4 texcolor; 6665 Color4 texcolor;
6568 if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color 6666 if (face == BuiltIn_Commands_BaseClass.ALL_SIDES)
6569 texcolor = tex.DefaultTexture.RGBA; 6667 {
6668 for (face = 0 ; face < GetNumberOfSides(m_host) ; face++)
6669 {
6670 texcolor = tex.GetFace((uint)face).RGBA;
6671 res.Add(new LSL_Vector(texcolor.R,
6672 texcolor.G,
6673 texcolor.B));
6674 res.Add(new LSL_Float(texcolor.A));
6675 }
6676 }
6570 else 6677 else
6678 {
6571 texcolor = tex.GetFace((uint)face).RGBA; 6679 texcolor = tex.GetFace((uint)face).RGBA;
6572 res.Add(new LSL_Types.Vector3((255 - (texcolor.R * 255)) / 255, 6680 res.Add(new LSL_Vector(texcolor.R,
6573 (255 - (texcolor.G * 255)) / 255, 6681 texcolor.G,
6574 (255 - (texcolor.B * 255)) / 255)); 6682 texcolor.B));
6575 res.Add(new LSL_Types.LSLFloat((texcolor.A * 255) / 255)); 6683 res.Add(new LSL_Float(texcolor.A));
6684 }
6576 break; 6685 break;
6577 6686
6578 case (int)BuiltIn_Commands_BaseClass.PRIM_BUMP_SHINY: 6687 case (int)BuiltIn_Commands_BaseClass.PRIM_BUMP_SHINY:
@@ -6580,10 +6689,10 @@ namespace OpenSim.Region.ScriptEngine.Common
6580 if (remain < 1) 6689 if (remain < 1)
6581 return res; 6690 return res;
6582 6691
6583 face=Convert.ToInt32(rules.Data[idx++]); 6692 face=(int)rules.GetLSLIntegerItem(idx++);
6584 6693
6585 res.Add(new LSL_Types.LSLInteger(0)); 6694 res.Add(new LSL_Integer(0));
6586 res.Add(new LSL_Types.LSLInteger(0)); 6695 res.Add(new LSL_Integer(0));
6587 break; 6696 break;
6588 6697
6589 case (int)BuiltIn_Commands_BaseClass.PRIM_FULLBRIGHT: 6698 case (int)BuiltIn_Commands_BaseClass.PRIM_FULLBRIGHT:
@@ -6591,24 +6700,24 @@ namespace OpenSim.Region.ScriptEngine.Common
6591 if (remain < 1) 6700 if (remain < 1)
6592 return res; 6701 return res;
6593 6702
6594 face=Convert.ToInt32(rules.Data[idx++]); 6703 face=(int)rules.GetLSLIntegerItem(idx++);
6595 6704
6596 res.Add(new LSL_Types.LSLInteger(0)); 6705 res.Add(new LSL_Integer(0));
6597 break; 6706 break;
6598 6707
6599 case (int)BuiltIn_Commands_BaseClass.PRIM_FLEXIBLE: 6708 case (int)BuiltIn_Commands_BaseClass.PRIM_FLEXIBLE:
6600 PrimitiveBaseShape shape = m_host.Shape; 6709 PrimitiveBaseShape shape = m_host.Shape;
6601 6710
6602 if (shape.FlexiEntry) 6711 if (shape.FlexiEntry)
6603 res.Add(new LSL_Types.LSLInteger(1)); // active 6712 res.Add(new LSL_Integer(1)); // active
6604 else 6713 else
6605 res.Add(new LSL_Types.LSLInteger(0)); 6714 res.Add(new LSL_Integer(0));
6606 res.Add(new LSL_Types.LSLInteger(shape.FlexiSoftness));// softness 6715 res.Add(new LSL_Integer(shape.FlexiSoftness));// softness
6607 res.Add(new LSL_Types.LSLFloat(shape.FlexiGravity)); // gravity 6716 res.Add(new LSL_Float(shape.FlexiGravity)); // gravity
6608 res.Add(new LSL_Types.LSLFloat(shape.FlexiDrag)); // friction 6717 res.Add(new LSL_Float(shape.FlexiDrag)); // friction
6609 res.Add(new LSL_Types.LSLFloat(shape.FlexiWind)); // wind 6718 res.Add(new LSL_Float(shape.FlexiWind)); // wind
6610 res.Add(new LSL_Types.LSLFloat(shape.FlexiTension)); // tension 6719 res.Add(new LSL_Float(shape.FlexiTension)); // tension
6611 res.Add(new LSL_Types.Vector3(shape.FlexiForceX, // force 6720 res.Add(new LSL_Vector(shape.FlexiForceX, // force
6612 shape.FlexiForceY, 6721 shape.FlexiForceY,
6613 shape.FlexiForceZ)); 6722 shape.FlexiForceZ));
6614 break; 6723 break;
@@ -6619,24 +6728,24 @@ namespace OpenSim.Region.ScriptEngine.Common
6619 if (remain < 1) 6728 if (remain < 1)
6620 return res; 6729 return res;
6621 6730
6622 face=Convert.ToInt32(rules.Data[idx++]); 6731 face=(int)rules.GetLSLIntegerItem(idx++);
6623 6732
6624 res.Add(new LSL_Types.LSLInteger(0)); 6733 res.Add(new LSL_Integer(0));
6625 break; 6734 break;
6626 6735
6627 case (int)BuiltIn_Commands_BaseClass.PRIM_POINT_LIGHT: 6736 case (int)BuiltIn_Commands_BaseClass.PRIM_POINT_LIGHT:
6628 shape = m_host.Shape; 6737 shape = m_host.Shape;
6629 6738
6630 if (shape.LightEntry) 6739 if (shape.LightEntry)
6631 res.Add(new LSL_Types.LSLInteger(1)); // active 6740 res.Add(new LSL_Integer(1)); // active
6632 else 6741 else
6633 res.Add(new LSL_Types.LSLInteger(0)); 6742 res.Add(new LSL_Integer(0));
6634 res.Add(new LSL_Types.Vector3(shape.LightColorR, // color 6743 res.Add(new LSL_Vector(shape.LightColorR, // color
6635 shape.LightColorG, 6744 shape.LightColorG,
6636 shape.LightColorB)); 6745 shape.LightColorB));
6637 res.Add(new LSL_Types.LSLFloat(shape.LightIntensity)); // intensity 6746 res.Add(new LSL_Float(shape.LightIntensity)); // intensity
6638 res.Add(new LSL_Types.LSLFloat(shape.LightRadius)); // radius 6747 res.Add(new LSL_Float(shape.LightRadius)); // radius
6639 res.Add(new LSL_Types.LSLFloat(shape.LightFalloff)); // falloff 6748 res.Add(new LSL_Float(shape.LightFalloff)); // falloff
6640 break; 6749 break;
6641 6750
6642 case (int)BuiltIn_Commands_BaseClass.PRIM_GLOW: 6751 case (int)BuiltIn_Commands_BaseClass.PRIM_GLOW:
@@ -6644,9 +6753,9 @@ namespace OpenSim.Region.ScriptEngine.Common
6644 if (remain < 1) 6753 if (remain < 1)
6645 return res; 6754 return res;
6646 6755
6647 face=Convert.ToInt32(rules.Data[idx++]); 6756 face=(int)rules.GetLSLIntegerItem(idx++);
6648 6757
6649 res.Add(new LSL_Types.LSLFloat(0)); 6758 res.Add(new LSL_Float(0));
6650 break; 6759 break;
6651 } 6760 }
6652 } 6761 }
@@ -6780,7 +6889,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6780 // characters are padded with "=". 6889 // characters are padded with "=".
6781 // </returns> 6890 // </returns>
6782 6891
6783 public string llIntegerToBase64(int number) 6892 public LSL_String llIntegerToBase64(int number)
6784 { 6893 {
6785 // uninitialized string 6894 // uninitialized string
6786 6895
@@ -6843,7 +6952,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6843 // </para> 6952 // </para>
6844 // </remarks> 6953 // </remarks>
6845 6954
6846 public LSL_Types.LSLInteger llBase64ToInteger(string str) 6955 public LSL_Integer llBase64ToInteger(string str)
6847 { 6956 {
6848 int number = 0; 6957 int number = 0;
6849 int digit; 6958 int digit;
@@ -6903,19 +7012,19 @@ namespace OpenSim.Region.ScriptEngine.Common
6903 return number; 7012 return number;
6904 } 7013 }
6905 7014
6906 public double llGetGMTclock() 7015 public LSL_Float llGetGMTclock()
6907 { 7016 {
6908 m_host.AddScriptLPS(1); 7017 m_host.AddScriptLPS(1);
6909 return DateTime.UtcNow.TimeOfDay.TotalSeconds; 7018 return DateTime.UtcNow.TimeOfDay.TotalSeconds;
6910 } 7019 }
6911 7020
6912 public string llGetSimulatorHostname() 7021 public LSL_String llGetSimulatorHostname()
6913 { 7022 {
6914 m_host.AddScriptLPS(1); 7023 m_host.AddScriptLPS(1);
6915 return System.Environment.MachineName; 7024 return System.Environment.MachineName;
6916 } 7025 }
6917 7026
6918 public void llSetLocalRot(LSL_Types.Quaternion rot) 7027 public void llSetLocalRot(LSL_Rotation rot)
6919 { 7028 {
6920 m_host.AddScriptLPS(1); 7029 m_host.AddScriptLPS(1);
6921 m_host.RotationOffset = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); 7030 m_host.RotationOffset = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
@@ -6970,7 +7079,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6970 // of arrays or other objects. 7079 // of arrays or other objects.
6971 // </remarks> 7080 // </remarks>
6972 7081
6973 public LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list separators, LSL_Types.list spacers) 7082 public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
6974 { 7083 {
6975 int beginning = 0; 7084 int beginning = 0;
6976 int srclen = src.Length; 7085 int srclen = src.Length;
@@ -6988,7 +7097,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6988 7097
6989 // Initial capacity reduces resize cost 7098 // Initial capacity reduces resize cost
6990 7099
6991 LSL_Types.list tokens = new LSL_Types.list(); 7100 LSL_List tokens = new LSL_List();
6992 7101
6993 m_host.AddScriptLPS(1); 7102 m_host.AddScriptLPS(1);
6994 7103
@@ -7098,7 +7207,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7098 return tokens; 7207 return tokens;
7099 } 7208 }
7100 7209
7101 public LSL_Types.LSLInteger llGetObjectPermMask(int mask) 7210 public LSL_Integer llGetObjectPermMask(int mask)
7102 { 7211 {
7103 m_host.AddScriptLPS(1); 7212 m_host.AddScriptLPS(1);
7104 7213
@@ -7171,7 +7280,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7171 } 7280 }
7172 } 7281 }
7173 7282
7174 public LSL_Types.LSLInteger llGetInventoryPermMask(string item, int mask) 7283 public LSL_Integer llGetInventoryPermMask(string item, int mask)
7175 { 7284 {
7176 m_host.AddScriptLPS(1); 7285 m_host.AddScriptLPS(1);
7177 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 7286 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
@@ -7202,7 +7311,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7202 NotImplemented("llSetInventoryPermMask"); 7311 NotImplemented("llSetInventoryPermMask");
7203 } 7312 }
7204 7313
7205 public string llGetInventoryCreator(string item) 7314 public LSL_String llGetInventoryCreator(string item)
7206 { 7315 {
7207 m_host.AddScriptLPS(1); 7316 m_host.AddScriptLPS(1);
7208 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 7317 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
@@ -7225,7 +7334,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7225// wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); 7334// wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg);
7226 } 7335 }
7227 7336
7228 public string llRequestSimulatorData(string simulator, int data) 7337 public LSL_String llRequestSimulatorData(string simulator, int data)
7229 { 7338 {
7230 try 7339 try
7231 { 7340 {
@@ -7243,7 +7352,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7243 // ScriptSleep(1000); 7352 // ScriptSleep(1000);
7244 return UUID.Zero.ToString(); 7353 return UUID.Zero.ToString();
7245 } 7354 }
7246 reply = new LSL_Types.Vector3( 7355 reply = new LSL_Vector(
7247 info.RegionLocX * Constants.RegionSize, 7356 info.RegionLocX * Constants.RegionSize,
7248 info.RegionLocY * Constants.RegionSize, 7357 info.RegionLocY * Constants.RegionSize,
7249 0).ToString(); 7358 0).ToString();
@@ -7299,7 +7408,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7299 m_host.SetForceMouselook(mouselook != 0); 7408 m_host.SetForceMouselook(mouselook != 0);
7300 } 7409 }
7301 7410
7302 public double llGetObjectMass(string id) 7411 public LSL_Float llGetObjectMass(string id)
7303 { 7412 {
7304 m_host.AddScriptLPS(1); 7413 m_host.AddScriptLPS(1);
7305 UUID key = new UUID(); 7414 UUID key = new UUID();
@@ -7322,9 +7431,9 @@ namespace OpenSim.Region.ScriptEngine.Common
7322 /// and the source list is added as a suffix. 7431 /// and the source list is added as a suffix.
7323 /// </summary> 7432 /// </summary>
7324 7433
7325 public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) 7434 public LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end)
7326 { 7435 {
7327 LSL_Types.list pref = null; 7436 LSL_List pref = null;
7328 7437
7329 m_host.AddScriptLPS(1); 7438 m_host.AddScriptLPS(1);
7330 7439
@@ -7401,7 +7510,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7401 // ScriptSleep(10000); 7510 // ScriptSleep(10000);
7402 } 7511 }
7403 7512
7404 public void llParcelMediaCommandList(LSL_Types.list commandList) 7513 public void llParcelMediaCommandList(LSL_List commandList)
7405 { 7514 {
7406 //TO DO: Implement the missing commands 7515 //TO DO: Implement the missing commands
7407 //PARCEL_MEDIA_COMMAND_STOP Stop the media stream and go back to the first frame. 7516 //PARCEL_MEDIA_COMMAND_STOP Stop the media stream and go back to the first frame.
@@ -7459,8 +7568,19 @@ namespace OpenSim.Region.ScriptEngine.Common
7459 { 7568 {
7460 if (commandList.Data[i + 1] is string) 7569 if (commandList.Data[i + 1] is string)
7461 { 7570 {
7462 //Set the new media URL only if the user is the owner of the land 7571 UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
7463 osSetParcelMediaURL(commandList.Data[i + 1].ToString()); 7572
7573 if (landowner == UUID.Zero)
7574 {
7575 return;
7576 }
7577
7578 if (landowner != m_host.ObjectOwner)
7579 {
7580 return;
7581 }
7582
7583 World.SetLandMediaURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, (string)commandList.GetLSLStringItem(i + 1));
7464 7584
7465 List<ScenePresence> scenePresenceList = World.GetScenePresences(); 7585 List<ScenePresence> scenePresenceList = World.GetScenePresences();
7466 LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 7586 LandData landData = World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
@@ -7485,12 +7605,13 @@ namespace OpenSim.Region.ScriptEngine.Common
7485 }//end switch 7605 }//end switch
7486 7606
7487 } 7607 }
7608 // ScriptSleep(2000);
7488 } 7609 }
7489 7610
7490 public LSL_Types.list llParcelMediaQuery(LSL_Types.list aList) 7611 public LSL_List llParcelMediaQuery(LSL_List aList)
7491 { 7612 {
7492 m_host.AddScriptLPS(1); 7613 m_host.AddScriptLPS(1);
7493 LSL_Types.list list = new LSL_Types.list(); 7614 LSL_List list = new LSL_List();
7494 //TO DO: make the implementation for the missing commands 7615 //TO DO: make the implementation for the missing commands
7495 //PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture. 7616 //PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture.
7496 //PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url. 7617 //PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url.
@@ -7506,13 +7627,13 @@ namespace OpenSim.Region.ScriptEngine.Common
7506 switch ((ParcelMediaCommandEnum) aList.Data[i]) 7627 switch ((ParcelMediaCommandEnum) aList.Data[i])
7507 { 7628 {
7508 case ParcelMediaCommandEnum.Url: 7629 case ParcelMediaCommandEnum.Url:
7509 list.Add(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL); 7630 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL));
7510 break; 7631 break;
7511 case ParcelMediaCommandEnum.Desc: 7632 case ParcelMediaCommandEnum.Desc:
7512 list.Add(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).Description); 7633 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).Description));
7513 break; 7634 break;
7514 case ParcelMediaCommandEnum.Texture: 7635 case ParcelMediaCommandEnum.Texture:
7515 list.Add(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID); 7636 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString()));
7516 break; 7637 break;
7517 default: 7638 default:
7518 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; 7639 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
@@ -7526,7 +7647,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7526 return list; 7647 return list;
7527 } 7648 }
7528 7649
7529 public LSL_Types.LSLInteger llModPow(int a, int b, int c) 7650 public LSL_Integer llModPow(int a, int b, int c)
7530 { 7651 {
7531 m_host.AddScriptLPS(1); 7652 m_host.AddScriptLPS(1);
7532 Int64 tmp = 0; 7653 Int64 tmp = 0;
@@ -7535,7 +7656,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7535 return Convert.ToInt32(tmp); 7656 return Convert.ToInt32(tmp);
7536 } 7657 }
7537 7658
7538 public LSL_Types.LSLInteger llGetInventoryType(string name) 7659 public LSL_Integer llGetInventoryType(string name)
7539 { 7660 {
7540 m_host.AddScriptLPS(1); 7661 m_host.AddScriptLPS(1);
7541 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 7662 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
@@ -7548,7 +7669,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7548 return -1; 7669 return -1;
7549 } 7670 }
7550 7671
7551 public void llSetPayPrice(int price, LSL_Types.list quick_pay_buttons) 7672 public void llSetPayPrice(int price, LSL_List quick_pay_buttons)
7552 { 7673 {
7553 m_host.AddScriptLPS(1); 7674 m_host.AddScriptLPS(1);
7554 7675
@@ -7558,42 +7679,41 @@ namespace OpenSim.Region.ScriptEngine.Common
7558 return; 7679 return;
7559 } 7680 }
7560 m_host.ParentGroup.RootPart.PayPrice[0]=price; 7681 m_host.ParentGroup.RootPart.PayPrice[0]=price;
7561 m_host.ParentGroup.RootPart.PayPrice[1]=(int)quick_pay_buttons.Data[0]; 7682
7562 m_host.ParentGroup.RootPart.PayPrice[2]=(int)quick_pay_buttons.Data[1]; 7683 m_host.ParentGroup.RootPart.PayPrice[1]=(LSL_Integer)quick_pay_buttons.Data[0];
7563 m_host.ParentGroup.RootPart.PayPrice[3]=(int)quick_pay_buttons.Data[2]; 7684 m_host.ParentGroup.RootPart.PayPrice[2]=(LSL_Integer)quick_pay_buttons.Data[1];
7564 m_host.ParentGroup.RootPart.PayPrice[4]=(int)quick_pay_buttons.Data[3]; 7685 m_host.ParentGroup.RootPart.PayPrice[3]=(LSL_Integer)quick_pay_buttons.Data[2];
7686 m_host.ParentGroup.RootPart.PayPrice[4]=(LSL_Integer)quick_pay_buttons.Data[3];
7687 m_host.ParentGroup.HasGroupChanged = true;
7565 } 7688 }
7566 7689
7567 public LSL_Types.Vector3 llGetCameraPos() 7690 public LSL_Vector llGetCameraPos()
7568 { 7691 {
7569 m_host.AddScriptLPS(1); 7692 m_host.AddScriptLPS(1);
7570 UUID invItemID=InventorySelf(); 7693 UUID invItemID=InventorySelf();
7571 if (invItemID == UUID.Zero) 7694 if (invItemID == UUID.Zero)
7572 return new LSL_Types.Vector3(); 7695 return new LSL_Vector();
7573 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) 7696 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
7574 return new LSL_Types.Vector3(); 7697 return new LSL_Vector();
7575 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA) == 0) 7698 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA) == 0)
7576 { 7699 {
7577 ShoutError("No permissions to track the camera"); 7700 ShoutError("No permissions to track the camera");
7578 return new LSL_Types.Vector3(); 7701 return new LSL_Vector();
7579 } 7702 }
7580 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 7703 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
7581 if (presence != null) 7704 if (presence != null)
7582 { 7705 {
7583 LSL_Types.Vector3 pos = new LSL_Types.Vector3( 7706 LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z);
7584 presence.CameraPosition.X,
7585 presence.CameraPosition.Y,
7586 presence.CameraPosition.Z);
7587 return pos; 7707 return pos;
7588 } 7708 }
7589 return new LSL_Types.Vector3(); 7709 return new LSL_Vector();
7590 } 7710 }
7591 7711
7592 public LSL_Types.Quaternion llGetCameraRot() 7712 public LSL_Rotation llGetCameraRot()
7593 { 7713 {
7594 m_host.AddScriptLPS(1); 7714 m_host.AddScriptLPS(1);
7595 NotImplemented("llGetCameraRot"); 7715 NotImplemented("llGetCameraRot");
7596 return new LSL_Types.Quaternion(); 7716 return new LSL_Rotation();
7597 } 7717 }
7598 7718
7599 public void llSetPrimURL() 7719 public void llSetPrimURL()
@@ -7610,7 +7730,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7610 // ScriptSleep(20000); 7730 // ScriptSleep(20000);
7611 } 7731 }
7612 7732
7613 public string llEscapeURL(string url) 7733 public LSL_String llEscapeURL(string url)
7614 { 7734 {
7615 m_host.AddScriptLPS(1); 7735 m_host.AddScriptLPS(1);
7616 try 7736 try
@@ -7623,7 +7743,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7623 } 7743 }
7624 } 7744 }
7625 7745
7626 public string llUnescapeURL(string url) 7746 public LSL_String llUnescapeURL(string url)
7627 { 7747 {
7628 m_host.AddScriptLPS(1); 7748 m_host.AddScriptLPS(1);
7629 try 7749 try
@@ -7636,7 +7756,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7636 } 7756 }
7637 } 7757 }
7638 7758
7639 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) 7759 public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector look_at)
7640 { 7760 {
7641 m_host.AddScriptLPS(1); 7761 m_host.AddScriptLPS(1);
7642 NotImplemented("llMapDestination"); 7762 NotImplemented("llMapDestination");
@@ -7706,7 +7826,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7706 // ScriptSleep(100); 7826 // ScriptSleep(100);
7707 } 7827 }
7708 7828
7709 public void llSetCameraParams(LSL_Types.list rules) 7829 public void llSetCameraParams(LSL_List rules)
7710 { 7830 {
7711 m_host.AddScriptLPS(1); 7831 m_host.AddScriptLPS(1);
7712 7832
@@ -7731,7 +7851,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7731 SortedDictionary<int, float> parameters = new SortedDictionary<int, float>(); 7851 SortedDictionary<int, float> parameters = new SortedDictionary<int, float>();
7732 object[] data = rules.Data; 7852 object[] data = rules.Data;
7733 for (int i = 0; i < data.Length; ++i) { 7853 for (int i = 0; i < data.Length; ++i) {
7734 int type = Convert.ToInt32(data[i++]); 7854 int type = Convert.ToInt32(data[i++].ToString());
7735 if (i >= data.Length) break; // odd number of entries => ignore the last 7855 if (i >= data.Length) break; // odd number of entries => ignore the last
7736 7856
7737 // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3) 7857 // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3)
@@ -7739,17 +7859,17 @@ namespace OpenSim.Region.ScriptEngine.Common
7739 case BuiltIn_Commands_BaseClass.CAMERA_FOCUS: 7859 case BuiltIn_Commands_BaseClass.CAMERA_FOCUS:
7740 case BuiltIn_Commands_BaseClass.CAMERA_FOCUS_OFFSET: 7860 case BuiltIn_Commands_BaseClass.CAMERA_FOCUS_OFFSET:
7741 case BuiltIn_Commands_BaseClass.CAMERA_POSITION: 7861 case BuiltIn_Commands_BaseClass.CAMERA_POSITION:
7742 LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i]; 7862 LSL_Vector v = (LSL_Vector)data[i];
7743 parameters.Add(type + 1, (float)v.x); 7863 parameters.Add(type + 1, (float)v.x);
7744 parameters.Add(type + 2, (float)v.y); 7864 parameters.Add(type + 2, (float)v.y);
7745 parameters.Add(type + 3, (float)v.z); 7865 parameters.Add(type + 3, (float)v.z);
7746 break; 7866 break;
7747 default: 7867 default:
7748 // TODO: clean that up as soon as the implicit casts are in 7868 // TODO: clean that up as soon as the implicit casts are in
7749 if (data[i] is LSL_Types.LSLFloat) 7869 if (data[i] is LSL_Float)
7750 parameters.Add(type, (float)((LSL_Types.LSLFloat)data[i]).value); 7870 parameters.Add(type, (float)((LSL_Float)data[i]).value);
7751 else if (data[i] is LSL_Types.LSLInteger) 7871 else if (data[i] is LSL_Integer)
7752 parameters.Add(type, (float)((LSL_Types.LSLInteger)data[i]).value); 7872 parameters.Add(type, (float)((LSL_Integer)data[i]).value);
7753 else parameters.Add(type, Convert.ToSingle(data[i])); 7873 else parameters.Add(type, Convert.ToSingle(data[i]));
7754 break; 7874 break;
7755 } 7875 }
@@ -7782,10 +7902,10 @@ namespace OpenSim.Region.ScriptEngine.Common
7782 presence.ControllingClient.SendClearFollowCamProperties(objectID); 7902 presence.ControllingClient.SendClearFollowCamProperties(objectID);
7783 } 7903 }
7784 7904
7785 public double llListStatistics(int operation, LSL_Types.list src) 7905 public LSL_Float llListStatistics(int operation, LSL_List src)
7786 { 7906 {
7787 m_host.AddScriptLPS(1); 7907 m_host.AddScriptLPS(1);
7788 LSL_Types.list nums = LSL_Types.list.ToDoubleList(src); 7908 LSL_List nums = LSL_List.ToDoubleList(src);
7789 switch (operation) 7909 switch (operation)
7790 { 7910 {
7791 case BuiltIn_Commands_BaseClass.LIST_STAT_RANGE: 7911 case BuiltIn_Commands_BaseClass.LIST_STAT_RANGE:
@@ -7815,19 +7935,19 @@ namespace OpenSim.Region.ScriptEngine.Common
7815 } 7935 }
7816 } 7936 }
7817 7937
7818 public LSL_Types.LSLInteger llGetUnixTime() 7938 public LSL_Integer llGetUnixTime()
7819 { 7939 {
7820 m_host.AddScriptLPS(1); 7940 m_host.AddScriptLPS(1);
7821 return Util.UnixTimeSinceEpoch(); 7941 return Util.UnixTimeSinceEpoch();
7822 } 7942 }
7823 7943
7824 public LSL_Types.LSLInteger llGetParcelFlags(LSL_Types.Vector3 pos) 7944 public LSL_Integer llGetParcelFlags(LSL_Vector pos)
7825 { 7945 {
7826 m_host.AddScriptLPS(1); 7946 m_host.AddScriptLPS(1);
7827 return (int)World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).landData.Flags; 7947 return (int)World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).landData.Flags;
7828 } 7948 }
7829 7949
7830 public LSL_Types.LSLInteger llGetRegionFlags() 7950 public LSL_Integer llGetRegionFlags()
7831 { 7951 {
7832 m_host.AddScriptLPS(1); 7952 m_host.AddScriptLPS(1);
7833 IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); 7953 IEstateModule estate = World.RequestModuleInterface<IEstateModule>();
@@ -7836,7 +7956,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7836 return (int)estate.GetRegionFlags(); 7956 return (int)estate.GetRegionFlags();
7837 } 7957 }
7838 7958
7839 public string llXorBase64StringsCorrect(string str1, string str2) 7959 public LSL_String llXorBase64StringsCorrect(string str1, string str2)
7840 { 7960 {
7841 m_host.AddScriptLPS(1); 7961 m_host.AddScriptLPS(1);
7842 string ret = String.Empty; 7962 string ret = String.Empty;
@@ -7854,7 +7974,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7854 return llStringToBase64(ret); 7974 return llStringToBase64(ret);
7855 } 7975 }
7856 7976
7857 public string llHTTPRequest(string url, LSL_Types.list parameters, string body) 7977 public LSL_String llHTTPRequest(string url, LSL_List parameters, string body)
7858 { 7978 {
7859 // Partial implementation: support for parameter flags needed 7979 // Partial implementation: support for parameter flags needed
7860 // see http://wiki.secondlife.com/wiki/LlHTTPRequest 7980 // see http://wiki.secondlife.com/wiki/LlHTTPRequest
@@ -7931,7 +8051,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7931 // ScriptSleep(100); 8051 // ScriptSleep(100);
7932 } 8052 }
7933 8053
7934 public LSL_Types.LSLInteger llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) 8054 public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
7935 { 8055 {
7936 m_host.AddScriptLPS(1); 8056 m_host.AddScriptLPS(1);
7937 8057
@@ -7994,11 +8114,11 @@ namespace OpenSim.Region.ScriptEngine.Common
7994 return 0; 8114 return 0;
7995 } 8115 }
7996 8116
7997 public LSL_Types.list llGetParcelPrimOwners(LSL_Types.Vector3 pos) 8117 public LSL_List llGetParcelPrimOwners(LSL_Vector pos)
7998 { 8118 {
7999 m_host.AddScriptLPS(1); 8119 m_host.AddScriptLPS(1);
8000 LandObject land = (LandObject)World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); 8120 LandObject land = (LandObject)World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
8001 LSL_Types.list ret = new LSL_Types.list(); 8121 LSL_List ret = new LSL_List();
8002 if (land != null) 8122 if (land != null)
8003 { 8123 {
8004 foreach (KeyValuePair<UUID, int> d in land.getLandObjectOwners()) 8124 foreach (KeyValuePair<UUID, int> d in land.getLandObjectOwners())
@@ -8011,7 +8131,7 @@ namespace OpenSim.Region.ScriptEngine.Common
8011 return ret; 8131 return ret;
8012 } 8132 }
8013 8133
8014 public LSL_Types.LSLInteger llGetObjectPrimCount(string object_id) 8134 public LSL_Integer llGetObjectPrimCount(string object_id)
8015 { 8135 {
8016 m_host.AddScriptLPS(1); 8136 m_host.AddScriptLPS(1);
8017 SceneObjectPart part = World.GetSceneObjectPart(new UUID(object_id)); 8137 SceneObjectPart part = World.GetSceneObjectPart(new UUID(object_id));
@@ -8025,7 +8145,7 @@ namespace OpenSim.Region.ScriptEngine.Common
8025 } 8145 }
8026 } 8146 }
8027 8147
8028 public LSL_Types.LSLInteger llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) 8148 public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide)
8029 { 8149 {
8030 m_host.AddScriptLPS(1); 8150 m_host.AddScriptLPS(1);
8031 // Alondria: This currently just is utilizing the normal grid's 0.22 prims/m2 calculation 8151 // Alondria: This currently just is utilizing the normal grid's 0.22 prims/m2 calculation
@@ -8055,36 +8175,36 @@ namespace OpenSim.Region.ScriptEngine.Common
8055 8175
8056 } 8176 }
8057 8177
8058 public LSL_Types.list llGetParcelDetails(LSL_Types.Vector3 pos, LSL_Types.list param) 8178 public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param)
8059 { 8179 {
8060 m_host.AddScriptLPS(1); 8180 m_host.AddScriptLPS(1);
8061 LandData land = World.GetLandData((float)pos.x, (float)pos.y); 8181 LandData land = World.GetLandData((float)pos.x, (float)pos.y);
8062 if (land == null) 8182 if (land == null)
8063 { 8183 {
8064 return new LSL_Types.list(0); 8184 return new LSL_List(0);
8065 } 8185 }
8066 LSL_Types.list ret = new LSL_Types.list(); 8186 LSL_List ret = new LSL_List();
8067 foreach (object o in param.Data) 8187 foreach (object o in param.Data)
8068 { 8188 {
8069 switch (o.ToString()) 8189 switch (o.ToString())
8070 { 8190 {
8071 case "0": 8191 case "0":
8072 ret = ret + new LSL_Types.list(land.Name); 8192 ret = ret + new LSL_List(land.Name);
8073 break; 8193 break;
8074 case "1": 8194 case "1":
8075 ret = ret + new LSL_Types.list(land.Description); 8195 ret = ret + new LSL_List(land.Description);
8076 break; 8196 break;
8077 case "2": 8197 case "2":
8078 ret = ret + new LSL_Types.list(land.OwnerID.ToString()); 8198 ret = ret + new LSL_List(land.OwnerID.ToString());
8079 break; 8199 break;
8080 case "3": 8200 case "3":
8081 ret = ret + new LSL_Types.list(land.GroupID.ToString()); 8201 ret = ret + new LSL_List(land.GroupID.ToString());
8082 break; 8202 break;
8083 case "4": 8203 case "4":
8084 ret = ret + new LSL_Types.list(land.Area); 8204 ret = ret + new LSL_List(land.Area);
8085 break; 8205 break;
8086 default: 8206 default:
8087 ret = ret + new LSL_Types.list(0); 8207 ret = ret + new LSL_List(0);
8088 break; 8208 break;
8089 } 8209 }
8090 } 8210 }
@@ -8107,7 +8227,7 @@ namespace OpenSim.Region.ScriptEngine.Common
8107 // ScriptSleep(200); 8227 // ScriptSleep(200);
8108 } 8228 }
8109 8229
8110 public string llStringTrim(string src, int type) 8230 public LSL_String llStringTrim(string src, int type)
8111 { 8231 {
8112 m_host.AddScriptLPS(1); 8232 m_host.AddScriptLPS(1);
8113 if (type == (int)BuiltIn_Commands_BaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); } 8233 if (type == (int)BuiltIn_Commands_BaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); }
@@ -8116,10 +8236,10 @@ namespace OpenSim.Region.ScriptEngine.Common
8116 return src; 8236 return src;
8117 } 8237 }
8118 8238
8119 public LSL_Types.list llGetObjectDetails(string id, LSL_Types.list args) 8239 public LSL_List llGetObjectDetails(string id, LSL_List args)
8120 { 8240 {
8121 m_host.AddScriptLPS(1); 8241 m_host.AddScriptLPS(1);
8122 LSL_Types.list ret = new LSL_Types.list(); 8242 LSL_List ret = new LSL_List();
8123 UUID key = new UUID(); 8243 UUID key = new UUID();
8124 if (UUID.TryParse(id, out key)) 8244 if (UUID.TryParse(id, out key))
8125 { 8245 {
@@ -8138,13 +8258,13 @@ namespace OpenSim.Region.ScriptEngine.Common
8138 ret.Add(""); 8258 ret.Add("");
8139 break; 8259 break;
8140 case "3": 8260 case "3":
8141 ret.Add(new LSL_Types.Vector3((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); 8261 ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z));
8142 break; 8262 break;
8143 case "4": 8263 case "4":
8144 ret.Add(new LSL_Types.Quaternion((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); 8264 ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W));
8145 break; 8265 break;
8146 case "5": 8266 case "5":
8147 ret.Add(new LSL_Types.Vector3(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); 8267 ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z));
8148 break; 8268 break;
8149 case "6": 8269 case "6":
8150 ret.Add(id); 8270 ret.Add(id);
@@ -8173,13 +8293,13 @@ namespace OpenSim.Region.ScriptEngine.Common
8173 ret.Add(obj.Description); 8293 ret.Add(obj.Description);
8174 break; 8294 break;
8175 case "3": 8295 case "3":
8176 ret.Add(new LSL_Types.Vector3(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); 8296 ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z));
8177 break; 8297 break;
8178 case "4": 8298 case "4":
8179 ret.Add(new LSL_Types.Quaternion(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); 8299 ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W));
8180 break; 8300 break;
8181 case "5": 8301 case "5":
8182 ret.Add(new LSL_Types.Vector3(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); 8302 ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z));
8183 break; 8303 break;
8184 case "6": 8304 case "6":
8185 ret.Add(obj.OwnerID.ToString()); 8305 ret.Add(obj.OwnerID.ToString());
@@ -8195,7 +8315,7 @@ namespace OpenSim.Region.ScriptEngine.Common
8195 return ret; 8315 return ret;
8196 } 8316 }
8197 } 8317 }
8198 return new LSL_Types.list(); 8318 return new LSL_List();
8199 } 8319 }
8200 8320
8201 8321
@@ -8232,7 +8352,7 @@ namespace OpenSim.Region.ScriptEngine.Common
8232 throw new Exception("LSL Runtime Error: " + msg); 8352 throw new Exception("LSL Runtime Error: " + msg);
8233 } 8353 }
8234 8354
8235 public string llGetNumberOfNotecardLines(string name) 8355 public LSL_String llGetNumberOfNotecardLines(string name)
8236 { 8356 {
8237 m_host.AddScriptLPS(1); 8357 m_host.AddScriptLPS(1);
8238 8358
@@ -8255,7 +8375,7 @@ namespace OpenSim.Region.ScriptEngine.Common
8255 // ScriptSleep(100); 8375 // ScriptSleep(100);
8256 } 8376 }
8257 8377
8258 public string llGetNotecardLine(string name, int line) 8378 public LSL_String llGetNotecardLine(string name, int line)
8259 { 8379 {
8260 m_host.AddScriptLPS(1); 8380 m_host.AddScriptLPS(1);
8261 8381