aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine
diff options
context:
space:
mode:
authorTedd Hansen2007-09-15 15:45:20 +0000
committerTedd Hansen2007-09-15 15:45:20 +0000
commitad042f1d75fcbadfe4d82b50ae577b86006e5578 (patch)
treeda17dd26a0d63db02a20f62eff46153c53b4f707 /OpenSim/Region/ScriptEngine/DotNetEngine
parentWill display error in main chat if unsupported llFunction is used. (diff)
downloadopensim-SC-ad042f1d75fcbadfe4d82b50ae577b86006e5578.zip
opensim-SC-ad042f1d75fcbadfe4d82b50ae577b86006e5578.tar.gz
opensim-SC-ad042f1d75fcbadfe4d82b50ae577b86006e5578.tar.bz2
opensim-SC-ad042f1d75fcbadfe4d82b50ae577b86006e5578.tar.xz
Implemented llList2CSV, llCSV2List, llListRandomize, llList2Vector, llListFindList, llListInsertList, llDeleteSubList
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs131
1 files changed, 118 insertions, 13 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index 3404bac..6000193 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -234,14 +234,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
234 public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; } 234 public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; }
235 public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; } 235 public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; }
236 236
237 public string llGetTexture(int face) 237 public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; }
238 {
239 throw new NotImplementedException(cni); return "";
240 }
241 238
242 public void llSetPos(LSL_Types.Vector3 pos) 239 public void llSetPos(LSL_Types.Vector3 pos)
243 { 240 {
244 LLVector3 tmp;
245 if (m_host.ParentID != 0) 241 if (m_host.ParentID != 0)
246 { 242 {
247 m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 243 m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z));
@@ -508,14 +504,101 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
508 return ""; 504 return "";
509 } 505 }
510 506
511 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) { NotImplemented("llList2Vector"); return new LSL_Types.Vector3(); } 507 public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
508 {
509 return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]));
510 }
512 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) { NotImplemented("llList2Rot"); return new LSL_Types.Quaternion(); } 511 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) { NotImplemented("llList2Rot"); return new LSL_Types.Quaternion(); }
513 public List<string> llList2List(List<string> src, int start, int end) { NotImplemented("llList2List"); return new List<string>(); } 512 public List<string> llList2List(List<string> src, int start, int end)
514 public List<string> llDeleteSubList(List<string> src, int start, int end) { NotImplemented("llDeleteSubList"); return new List<string>(); } 513 {
514 if (end > start)
515 {
516 // Simple straight forward chunk
517 return src.GetRange(start, end - start);
518 }
519 else
520 {
521 // Some of the end + some of the beginning
522 // First chunk
523 List<string> ret = new List<string>();
524 ret.AddRange(src.GetRange(start, src.Count - start));
525 ret.AddRange(src.GetRange(0, end));
526 return ret;
527 }
528
529
530
531
532 }
533 public List<string> llDeleteSubList(List<string> src, int start, int end)
534 {
535 List<string> ret = new List<string>(src);
536 ret.RemoveRange(start, end - start);
537 return ret;
538 }
515 public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; } 539 public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; }
516 public string llList2CSV(List<string> src) { NotImplemented("llList2CSV"); return ""; } 540 public string llList2CSV(List<string> src)
517 public List<string> llCSV2List(string src) { NotImplemented("llCSV2List"); return new List<string>(); } 541 {
518 public List<string> llListRandomize(List<string> src, int stride) { NotImplemented("llListRandomize"); return new List<string>(); } 542 string ret = "";
543 foreach (string s in src)
544 {
545 if (s.Length > 0)
546 ret += ",";
547 ret += s;
548 }
549 return ret;
550 }
551 public List<string> llCSV2List(string src)
552 {
553 List<string> ret = new List<string>();
554 foreach (string s in src.Split(",".ToCharArray()))
555 {
556 ret.Add(s);
557 }
558 return ret;
559 }
560 public List<string> llListRandomize(List<string> src, int stride)
561 {
562 int s = stride;
563 if (s < 1)
564 s = 1;
565
566 // This is a cowardly way of doing it ;)
567 // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange
568 List<List<string>> tmp = new List<List<string>>();
569
570 // Add chunks to an array
571 int c = 0;
572 List<string> chunk = new List<string>();
573 foreach (string element in src)
574 {
575 c++;
576 if (c > s)
577 {
578 tmp.Add(chunk);
579 chunk = new List<string>();
580 c = 0;
581 }
582 chunk.Add(element);
583 }
584
585 // Decreate array back into a list
586 int rnd;
587 List<string> ret = new List<string>();
588 while (tmp.Count > 0)
589 {
590 rnd = Util.RandomClass.Next(tmp.Count);
591 foreach (string str in tmp[rnd])
592 {
593 ret.Add(str);
594 }
595 tmp.RemoveAt(rnd);
596 }
597
598 return ret;
599
600
601 }
519 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) { NotImplemented("llList2ListStrided"); return new List<string>(); } 602 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) { NotImplemented("llList2ListStrided"); return new List<string>(); }
520 603
521 public LSL_Types.Vector3 llGetRegionCorner() 604 public LSL_Types.Vector3 llGetRegionCorner()
@@ -523,8 +606,30 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
523 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); 606 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0);
524 } 607 }
525 608
526 public List<string> llListInsertList(List<string> dest, List<string> src, int start) { NotImplemented("llListInsertList"); return new List<string>(); } 609 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
527 public int llListFindList(List<string> src, List<string> test) { return 0; } 610 {
611
612 List<string> ret = new List<string>(dest);
613 //foreach (string s in src.Reverse())
614 for (int ci = src.Count - 1; ci > -1; ci--)
615 {
616 ret.Insert(start, src[ci]);
617 }
618 return ret;
619 }
620 public int llListFindList(List<string> src, List<string> test)
621 {
622 foreach (string s in test)
623 {
624 for (int ci = 0; ci < src.Count; ci++)
625 {
626
627 if (s == src[ci])
628 return ci;
629 }
630 }
631 return -1;
632 }
528 633
529 public string llGetObjectName() 634 public string llGetObjectName()
530 { 635 {