diff options
author | Charles Krinke | 2008-08-25 21:39:36 +0000 |
---|---|---|
committer | Charles Krinke | 2008-08-25 21:39:36 +0000 |
commit | a055d3c2e8d8b03db3d4de77dfa9d1aa10a8df58 (patch) | |
tree | f9da0b44240c1f3c65dcebf81e465c59c33ee09c /OpenSim/Region/ScriptEngine/Common | |
parent | * zap compilation warnings (diff) | |
download | opensim-SC_OLD-a055d3c2e8d8b03db3d4de77dfa9d1aa10a8df58.zip opensim-SC_OLD-a055d3c2e8d8b03db3d4de77dfa9d1aa10a8df58.tar.gz opensim-SC_OLD-a055d3c2e8d8b03db3d4de77dfa9d1aa10a8df58.tar.bz2 opensim-SC_OLD-a055d3c2e8d8b03db3d4de77dfa9d1aa10a8df58.tar.xz |
Mantis#2045. Thank you kindly, Tyre for a patch that:
This patch adds even more LSL compatibility to llSetPos() As stated in the
wiki http://wiki.secondlife.com/wiki/LlSetPos, [^] movement should also be
capped to 10m per call for unattached root prims.
Beside this issue the attached patch adds (hopefully) all known LSL script
delays (as ScriptSleep(), but still commented out) to LSL_BuiltIn_Commands.cs
and LSL_Api.cs and a lot of format cleanup.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 782 |
1 files changed, 419 insertions, 363 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 602a3c8..60ed5c1 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -72,6 +72,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
72 | 72 | ||
73 | //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); | 73 | //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); |
74 | 74 | ||
75 | |||
75 | IConfigSource config = new IniConfigSource(Application.iniFilePath); | 76 | IConfigSource config = new IniConfigSource(Application.iniFilePath); |
76 | if (config.Configs["LL-Functions"] == null) | 77 | if (config.Configs["LL-Functions"] == null) |
77 | config.AddConfig("LL-Functions"); | 78 | config.AddConfig("LL-Functions"); |
@@ -89,7 +90,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
89 | private void ScriptSleep(int delay) | 90 | private void ScriptSleep(int delay) |
90 | { | 91 | { |
91 | delay = (int)((float)delay * m_delayFactor); | 92 | delay = (int)((float)delay * m_delayFactor); |
92 | if(delay == 0) | 93 | if (delay == 0) |
93 | return; | 94 | return; |
94 | System.Threading.Thread.Sleep(delay); | 95 | System.Threading.Thread.Sleep(delay); |
95 | } | 96 | } |
@@ -128,15 +129,11 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
128 | // Object never expires | 129 | // Object never expires |
129 | public override Object InitializeLifetimeService() | 130 | public override Object InitializeLifetimeService() |
130 | { | 131 | { |
131 | //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); | ||
132 | // return null; | ||
133 | ILease lease = (ILease)base.InitializeLifetimeService(); | 132 | ILease lease = (ILease)base.InitializeLifetimeService(); |
134 | 133 | ||
135 | if (lease.CurrentState == LeaseState.Initial) | 134 | if (lease.CurrentState == LeaseState.Initial) |
136 | { | 135 | { |
137 | lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); | 136 | lease.InitialLeaseTime = TimeSpan.Zero; |
138 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); | ||
139 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(2); | ||
140 | } | 137 | } |
141 | return lease; | 138 | return lease; |
142 | } | 139 | } |
@@ -154,13 +151,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
154 | 151 | ||
155 | private LLUUID InventorySelf() | 152 | private LLUUID InventorySelf() |
156 | { | 153 | { |
157 | LLUUID invItemID=new LLUUID(); | 154 | LLUUID invItemID = new LLUUID(); |
158 | 155 | ||
159 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 156 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
160 | { | 157 | { |
161 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) | 158 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) |
162 | { | 159 | { |
163 | invItemID=inv.Key; | 160 | invItemID = inv.Key; |
164 | break; | 161 | break; |
165 | } | 162 | } |
166 | } | 163 | } |
@@ -350,7 +347,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
350 | return angle; | 347 | return angle; |
351 | } | 348 | } |
352 | 349 | ||
353 | |||
354 | // Old implementation of llRot2Euler, now normalized | 350 | // Old implementation of llRot2Euler, now normalized |
355 | 351 | ||
356 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) | 352 | public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) |
@@ -441,8 +437,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
441 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) | 437 | public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) |
442 | { | 438 | { |
443 | m_host.AddScriptLPS(1); | 439 | m_host.AddScriptLPS(1); |
444 | double x,y,z,s; | 440 | double x, y, z, s; |
445 | int f=0; | 441 | int f = 0; |
446 | // Important Note: q1=<x,y,z,s> is equal to q2=<-x,-y,-z,-s> | 442 | // Important Note: q1=<x,y,z,s> is equal to q2=<-x,-y,-z,-s> |
447 | // Computing quaternion x,y,z,s values | 443 | // Computing quaternion x,y,z,s values |
448 | x = ((fwd.x - left.y - up.z + 1) / 4); | 444 | x = ((fwd.x - left.y - up.z + 1) / 4); |
@@ -459,9 +455,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
459 | s = Math.Sqrt(Math.Sqrt(s)); | 455 | s = Math.Sqrt(Math.Sqrt(s)); |
460 | 456 | ||
461 | // Set f for signs detection | 457 | // Set f for signs detection |
462 | if (fwd.y+left.x >= 0){f+=1;} | 458 | if (fwd.y + left.x >= 0) { f += 1; } |
463 | if (fwd.z+up.x >= 0){f+=2;} | 459 | if (fwd.z + up.x >= 0) { f += 2; } |
464 | if (left.z-up.y >= 0){f+=4;} | 460 | if (left.z - up.y >= 0) { f += 4; } |
465 | // Set correct quaternion signs based on f value | 461 | // Set correct quaternion signs based on f value |
466 | if (f == 0) { x = -x; } | 462 | if (f == 0) { x = -x; } |
467 | if (f == 1) { x = -x; y = -y; } | 463 | if (f == 1) { x = -x; y = -y; } |
@@ -549,7 +545,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
549 | 545 | ||
550 | // Fast Algebric Calculations instead of Vectors & Quaternions Product | 546 | // Fast Algebric Calculations instead of Vectors & Quaternions Product |
551 | x = 2 * (r.x * r.z + r.y * r.s); | 547 | x = 2 * (r.x * r.z + r.y * r.s); |
552 | y = 2*(-r.x * r.s + r.y * r.z); | 548 | y = 2 * (-r.x * r.s + r.y * r.z); |
553 | z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s; | 549 | z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s; |
554 | return (new LSL_Types.Vector3(x, y, z)); | 550 | return (new LSL_Types.Vector3(x, y, z)); |
555 | } | 551 | } |
@@ -571,6 +567,10 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
571 | public void llWhisper(int channelID, string text) | 567 | public void llWhisper(int channelID, string text) |
572 | { | 568 | { |
573 | m_host.AddScriptLPS(1); | 569 | m_host.AddScriptLPS(1); |
570 | |||
571 | if (text.Length > 1023) | ||
572 | text = text.Substring(0, 1023); | ||
573 | |||
574 | World.SimChat(Helpers.StringToField(text), | 574 | World.SimChat(Helpers.StringToField(text), |
575 | ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); | 575 | ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); |
576 | 576 | ||
@@ -581,6 +581,10 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
581 | public void llSay(int channelID, string text) | 581 | public void llSay(int channelID, string text) |
582 | { | 582 | { |
583 | m_host.AddScriptLPS(1); | 583 | m_host.AddScriptLPS(1); |
584 | |||
585 | if (text.Length > 1023) | ||
586 | text = text.Substring(0, 1023); | ||
587 | |||
584 | World.SimChat(Helpers.StringToField(text), | 588 | World.SimChat(Helpers.StringToField(text), |
585 | ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); | 589 | ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); |
586 | 590 | ||
@@ -591,8 +595,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
591 | public void llShout(int channelID, string text) | 595 | public void llShout(int channelID, string text) |
592 | { | 596 | { |
593 | m_host.AddScriptLPS(1); | 597 | m_host.AddScriptLPS(1); |
598 | |||
599 | if (text.Length > 1023) | ||
600 | text = text.Substring(0, 1023); | ||
601 | |||
594 | World.SimChat(Helpers.StringToField(text), | 602 | World.SimChat(Helpers.StringToField(text), |
595 | ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); | 603 | ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, true); |
596 | 604 | ||
597 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 605 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
598 | wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text); | 606 | wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text); |
@@ -606,6 +614,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
606 | return; | 614 | return; |
607 | } | 615 | } |
608 | 616 | ||
617 | if (text.Length > 1023) | ||
618 | text = text.Substring(0, 1023); | ||
619 | |||
609 | m_host.AddScriptLPS(1); | 620 | m_host.AddScriptLPS(1); |
610 | 621 | ||
611 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 622 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
@@ -637,7 +648,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
637 | 648 | ||
638 | public void llSensor(string name, string id, int type, double range, double arc) | 649 | public void llSensor(string name, string id, int type, double range, double arc) |
639 | { | 650 | { |
640 | m_host.AddScriptLPS(300); | 651 | m_host.AddScriptLPS(1); |
641 | LLUUID keyID = LLUUID.Zero; | 652 | LLUUID keyID = LLUUID.Zero; |
642 | LLUUID.TryParse(id, out keyID); | 653 | LLUUID.TryParse(id, out keyID); |
643 | 654 | ||
@@ -651,7 +662,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
651 | LLUUID.TryParse(id, out keyID); | 662 | LLUUID.TryParse(id, out keyID); |
652 | 663 | ||
653 | m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); | 664 | m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); |
654 | } | 665 | } |
655 | 666 | ||
656 | public void llSensorRemove() | 667 | public void llSensorRemove() |
657 | { | 668 | { |
@@ -685,7 +696,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
685 | if (SensedObject == null) | 696 | if (SensedObject == null) |
686 | return String.Empty; | 697 | return String.Empty; |
687 | return SensedObject.Name; | 698 | return SensedObject.Name; |
688 | |||
689 | } | 699 | } |
690 | 700 | ||
691 | public string llDetectedName(int number) | 701 | public string llDetectedName(int number) |
@@ -821,7 +831,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
821 | LLUUID SensedUUID = uuidDetectedKey(number); | 831 | LLUUID SensedUUID = uuidDetectedKey(number); |
822 | if (SensedUUID == LLUUID.Zero) | 832 | if (SensedUUID == LLUUID.Zero) |
823 | return String.Empty; | 833 | return String.Empty; |
824 | |||
825 | return SensedUUID.ToString(); | 834 | return SensedUUID.ToString(); |
826 | } | 835 | } |
827 | 836 | ||
@@ -869,7 +878,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
869 | mask |= 0x02; // active moving | 878 | mask |= 0x02; // active moving |
870 | if (SensedObject is IScript) mask |= 0x08; // Scripted. It COULD have one hidden ... | 879 | if (SensedObject is IScript) mask |= 0x08; // Scripted. It COULD have one hidden ... |
871 | return mask; | 880 | return mask; |
872 | |||
873 | } | 881 | } |
874 | 882 | ||
875 | public LSL_Types.Vector3 llDetectedPos(int number) | 883 | public LSL_Types.Vector3 llDetectedPos(int number) |
@@ -878,7 +886,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
878 | EntityBase SensedObject = entityDetectedKey(number); | 886 | EntityBase SensedObject = entityDetectedKey(number); |
879 | if (SensedObject == null) | 887 | if (SensedObject == null) |
880 | return new LSL_Types.Vector3(0, 0, 0); | 888 | return new LSL_Types.Vector3(0, 0, 0); |
881 | |||
882 | return new LSL_Types.Vector3(SensedObject.AbsolutePosition.X,SensedObject.AbsolutePosition.Y,SensedObject.AbsolutePosition.Z); | 889 | return new LSL_Types.Vector3(SensedObject.AbsolutePosition.X,SensedObject.AbsolutePosition.Y,SensedObject.AbsolutePosition.Z); |
883 | } | 890 | } |
884 | 891 | ||
@@ -888,7 +895,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
888 | EntityBase SensedObject = entityDetectedKey(number); | 895 | EntityBase SensedObject = entityDetectedKey(number); |
889 | if (SensedObject == null) | 896 | if (SensedObject == null) |
890 | return new LSL_Types.Vector3(0, 0, 0); | 897 | return new LSL_Types.Vector3(0, 0, 0); |
891 | |||
892 | return new LSL_Types.Vector3(SensedObject.Velocity.X, SensedObject.Velocity.Y, SensedObject.Velocity.Z); | 898 | return new LSL_Types.Vector3(SensedObject.Velocity.X, SensedObject.Velocity.Y, SensedObject.Velocity.Z); |
893 | } | 899 | } |
894 | 900 | ||
@@ -911,7 +917,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
911 | EntityBase SensedObject = entityDetectedKey(number); | 917 | EntityBase SensedObject = entityDetectedKey(number); |
912 | if (SensedObject == null) | 918 | if (SensedObject == null) |
913 | return new LSL_Types.Quaternion(); | 919 | return new LSL_Types.Quaternion(); |
914 | |||
915 | return new LSL_Types.Quaternion(SensedObject.Rotation.x, SensedObject.Rotation.y, SensedObject.Rotation.z, SensedObject.Rotation.w); | 920 | return new LSL_Types.Quaternion(SensedObject.Rotation.x, SensedObject.Rotation.y, SensedObject.Rotation.z, SensedObject.Rotation.w); |
916 | } | 921 | } |
917 | 922 | ||
@@ -986,8 +991,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
986 | } | 991 | } |
987 | else | 992 | else |
988 | m_host.ScriptSetPhysicsStatus(false); | 993 | m_host.ScriptSetPhysicsStatus(false); |
989 | |||
990 | } | 994 | } |
995 | |||
991 | if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM) | 996 | if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM) |
992 | { | 997 | { |
993 | if (value == 1) | 998 | if (value == 1) |
@@ -995,27 +1000,32 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
995 | else | 1000 | else |
996 | m_host.ScriptSetPhantomStatus(false); | 1001 | m_host.ScriptSetPhantomStatus(false); |
997 | } | 1002 | } |
1003 | |||
998 | if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) | 1004 | if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) |
999 | { | 1005 | { |
1000 | m_host.AddFlag(LLObject.ObjectFlags.CastShadows); | 1006 | m_host.AddFlag(LLObject.ObjectFlags.CastShadows); |
1001 | } | 1007 | } |
1008 | |||
1002 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) | 1009 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) |
1003 | { | 1010 | { |
1004 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X; | 1011 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X; |
1005 | |||
1006 | } | 1012 | } |
1013 | |||
1007 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) | 1014 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) |
1008 | { | 1015 | { |
1009 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y; | 1016 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y; |
1010 | } | 1017 | } |
1018 | |||
1011 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) | 1019 | if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) |
1012 | { | 1020 | { |
1013 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z; | 1021 | statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z; |
1014 | } | 1022 | } |
1023 | |||
1015 | if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) | 1024 | if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) |
1016 | { | 1025 | { |
1017 | NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); | 1026 | NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); |
1018 | } | 1027 | } |
1028 | |||
1019 | if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) | 1029 | if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) |
1020 | { | 1030 | { |
1021 | if (value == 1) | 1031 | if (value == 1) |
@@ -1023,18 +1033,20 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1023 | else | 1033 | else |
1024 | m_host.SetDieAtEdge(false); | 1034 | m_host.SetDieAtEdge(false); |
1025 | } | 1035 | } |
1036 | |||
1026 | if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) | 1037 | if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) |
1027 | { | 1038 | { |
1028 | NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); | 1039 | NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); |
1029 | } | 1040 | } |
1041 | |||
1030 | if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX) | 1042 | if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX) |
1031 | { | 1043 | { |
1032 | NotImplemented("llSetStatus - STATUS_SANDBOX"); | 1044 | NotImplemented("llSetStatus - STATUS_SANDBOX"); |
1033 | } | 1045 | } |
1046 | |||
1034 | if (statusrotationaxis != 0) | 1047 | if (statusrotationaxis != 0) |
1035 | { | 1048 | { |
1036 | m_host.SetAxisRotation(statusrotationaxis, value); | 1049 | m_host.SetAxisRotation(statusrotationaxis, value); |
1037 | |||
1038 | } | 1050 | } |
1039 | } | 1051 | } |
1040 | 1052 | ||
@@ -1050,23 +1062,26 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1050 | return 1; | 1062 | return 1; |
1051 | } | 1063 | } |
1052 | return 0; | 1064 | return 0; |
1065 | |||
1053 | case BuiltIn_Commands_BaseClass.STATUS_PHANTOM: | 1066 | case BuiltIn_Commands_BaseClass.STATUS_PHANTOM: |
1054 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) | 1067 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) |
1055 | { | 1068 | { |
1056 | return 1; | 1069 | return 1; |
1057 | } | 1070 | } |
1058 | return 0; | 1071 | return 0; |
1072 | |||
1059 | case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS: | 1073 | case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS: |
1060 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) | 1074 | if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) |
1061 | { | 1075 | { |
1062 | return 1; | 1076 | return 1; |
1063 | } | 1077 | } |
1064 | return 0; | 1078 | return 0; |
1079 | |||
1065 | case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB: | 1080 | case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB: |
1066 | NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); | 1081 | NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); |
1067 | return 0; | 1082 | return 0; |
1068 | case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE: | ||
1069 | 1083 | ||
1084 | case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE: | ||
1070 | if (m_host.GetDieAtEdge()) | 1085 | if (m_host.GetDieAtEdge()) |
1071 | return 1; | 1086 | return 1; |
1072 | else | 1087 | else |
@@ -1075,15 +1090,19 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1075 | case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE: | 1090 | case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE: |
1076 | NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); | 1091 | NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); |
1077 | return 0; | 1092 | return 0; |
1093 | |||
1078 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X: | 1094 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X: |
1079 | NotImplemented("llGetStatus - STATUS_ROTATE_X"); | 1095 | NotImplemented("llGetStatus - STATUS_ROTATE_X"); |
1080 | return 0; | 1096 | return 0; |
1097 | |||
1081 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y: | 1098 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y: |
1082 | NotImplemented("llGetStatus - STATUS_ROTATE_Y"); | 1099 | NotImplemented("llGetStatus - STATUS_ROTATE_Y"); |
1083 | return 0; | 1100 | return 0; |
1101 | |||
1084 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z: | 1102 | case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z: |
1085 | NotImplemented("llGetStatus - STATUS_ROTATE_Z"); | 1103 | NotImplemented("llGetStatus - STATUS_ROTATE_Z"); |
1086 | return 0; | 1104 | return 0; |
1105 | |||
1087 | case BuiltIn_Commands_BaseClass.STATUS_SANDBOX: | 1106 | case BuiltIn_Commands_BaseClass.STATUS_SANDBOX: |
1088 | NotImplemented("llGetStatus - STATUS_SANDBOX"); | 1107 | NotImplemented("llGetStatus - STATUS_SANDBOX"); |
1089 | return 0; | 1108 | return 0; |
@@ -1179,103 +1198,103 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1179 | 1198 | ||
1180 | public void SetGlow(SceneObjectPart part, int face, float glow) | 1199 | public void SetGlow(SceneObjectPart part, int face, float glow) |
1181 | { | 1200 | { |
1182 | LLObject.TextureEntry tex = part.Shape.Textures; | 1201 | LLObject.TextureEntry tex = part.Shape.Textures; |
1183 | if (face > -1) | 1202 | if (face > -1) |
1184 | { | 1203 | { |
1185 | tex.CreateFace((uint)face); | 1204 | tex.CreateFace((uint) face); |
1186 | tex.FaceTextures[face].Glow = glow; | 1205 | tex.FaceTextures[face].Glow = glow; |
1187 | part.UpdateTexture(tex); | 1206 | part.UpdateTexture(tex); |
1188 | return; | 1207 | return; |
1189 | } | 1208 | } |
1190 | else if (face == -1) | 1209 | else if (face == -1) |
1191 | { | 1210 | { |
1192 | for (uint i = 0; i < 32; i++) | 1211 | for (uint i = 0; i < 32; i++) |
1193 | { | 1212 | { |
1194 | if (tex.FaceTextures[i] != null) | 1213 | if (tex.FaceTextures[i] != null) |
1195 | { | 1214 | { |
1196 | tex.FaceTextures[i].Glow = glow; | 1215 | tex.FaceTextures[i].Glow = glow; |
1197 | } | 1216 | } |
1198 | tex.DefaultTexture.Glow = glow; | 1217 | tex.DefaultTexture.Glow = glow; |
1199 | } | 1218 | } |
1200 | part.UpdateTexture(tex); | 1219 | part.UpdateTexture(tex); |
1201 | return; | 1220 | return; |
1202 | } | 1221 | } |
1203 | } | 1222 | } |
1204 | 1223 | ||
1205 | public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump) | 1224 | public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump) |
1206 | { | 1225 | { |
1207 | 1226 | ||
1208 | Shininess sval = new Shininess(); | 1227 | Shininess sval = new Shininess(); |
1209 | 1228 | ||
1210 | switch (shiny) | 1229 | switch (shiny) |
1211 | { | 1230 | { |
1212 | case 0: | 1231 | case 0: |
1213 | sval = Shininess.None; | 1232 | sval = Shininess.None; |
1214 | break; | 1233 | break; |
1215 | case 1: | 1234 | case 1: |
1216 | sval = Shininess.Low; | 1235 | sval = Shininess.Low; |
1217 | break; | 1236 | break; |
1218 | case 2: | 1237 | case 2: |
1219 | sval = Shininess.Medium; | 1238 | sval = Shininess.Medium; |
1220 | break; | 1239 | break; |
1221 | case 3: | 1240 | case 3: |
1222 | sval = Shininess.High; | 1241 | sval = Shininess.High; |
1223 | break; | 1242 | break; |
1224 | default: | 1243 | default: |
1225 | sval = Shininess.None; | 1244 | sval = Shininess.None; |
1226 | break; | 1245 | break; |
1227 | } | 1246 | } |
1228 | 1247 | ||
1229 | LLObject.TextureEntry tex = part.Shape.Textures; | 1248 | LLObject.TextureEntry tex = part.Shape.Textures; |
1230 | if (face > -1) | 1249 | if (face > -1) |
1231 | { | 1250 | { |
1232 | tex.CreateFace((uint)face); | 1251 | tex.CreateFace((uint) face); |
1233 | tex.FaceTextures[face].Shiny = sval; | 1252 | tex.FaceTextures[face].Shiny = sval; |
1234 | tex.FaceTextures[face].Bump = bump; | 1253 | tex.FaceTextures[face].Bump = bump; |
1235 | part.UpdateTexture(tex); | 1254 | part.UpdateTexture(tex); |
1236 | return; | 1255 | return; |
1237 | } | 1256 | } |
1238 | else if (face == -1) | 1257 | else if (face == -1) |
1239 | { | 1258 | { |
1240 | for (uint i = 0; i < 32; i++) | 1259 | for (uint i = 0; i < 32; i++) |
1241 | { | 1260 | { |
1242 | if (tex.FaceTextures[i] != null) | 1261 | if (tex.FaceTextures[i] != null) |
1243 | { | 1262 | { |
1244 | tex.FaceTextures[i].Shiny = sval; | 1263 | tex.FaceTextures[i].Shiny = sval; |
1245 | tex.FaceTextures[i].Bump = bump; ; | 1264 | tex.FaceTextures[i].Bump = bump;; |
1246 | } | 1265 | } |
1247 | tex.DefaultTexture.Shiny = sval; | 1266 | tex.DefaultTexture.Shiny = sval; |
1248 | tex.DefaultTexture.Bump = bump; | 1267 | tex.DefaultTexture.Bump = bump; |
1249 | } | 1268 | } |
1250 | part.UpdateTexture(tex); | 1269 | part.UpdateTexture(tex); |
1251 | return; | 1270 | return; |
1252 | } | 1271 | } |
1253 | } | 1272 | } |
1254 | 1273 | ||
1255 | public void SetFullBright(SceneObjectPart part, int face, bool bright) | 1274 | public void SetFullBright(SceneObjectPart part, int face, bool bright) |
1256 | { | 1275 | { |
1257 | LLObject.TextureEntry tex = part.Shape.Textures; | 1276 | LLObject.TextureEntry tex = part.Shape.Textures; |
1258 | if (face > -1) | 1277 | if (face > -1) |
1259 | { | 1278 | { |
1260 | tex.CreateFace((uint)face); | 1279 | tex.CreateFace((uint) face); |
1261 | tex.FaceTextures[face].Fullbright = bright; | 1280 | tex.FaceTextures[face].Fullbright = bright; |
1262 | part.UpdateTexture(tex); | 1281 | part.UpdateTexture(tex); |
1263 | return; | 1282 | return; |
1264 | } | 1283 | } |
1265 | else if (face == -1) | 1284 | else if (face == -1) |
1266 | { | 1285 | { |
1267 | for (uint i = 0; i < 32; i++) | 1286 | for (uint i = 0; i < 32; i++) |
1268 | { | 1287 | { |
1269 | if (tex.FaceTextures[i] != null) | 1288 | if (tex.FaceTextures[i] != null) |
1270 | { | 1289 | { |
1271 | tex.FaceTextures[i].Fullbright = bright; | 1290 | tex.FaceTextures[i].Fullbright = bright; |
1272 | } | 1291 | } |
1273 | } | 1292 | } |
1274 | tex.DefaultTexture.Fullbright = bright; | 1293 | tex.DefaultTexture.Fullbright = bright; |
1275 | part.UpdateTexture(tex); | 1294 | part.UpdateTexture(tex); |
1276 | return; | 1295 | return; |
1277 | } | 1296 | } |
1278 | } | 1297 | } |
1279 | 1298 | ||
1280 | public double llGetAlpha(int face) | 1299 | public double llGetAlpha(int face) |
1281 | { | 1300 | { |
@@ -1426,8 +1445,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1426 | part.ScheduleFullUpdate(); | 1445 | part.ScheduleFullUpdate(); |
1427 | } | 1446 | } |
1428 | 1447 | ||
1429 | |||
1430 | |||
1431 | public LSL_Types.Vector3 llGetColor(int face) | 1448 | public LSL_Types.Vector3 llGetColor(int face) |
1432 | { | 1449 | { |
1433 | m_host.AddScriptLPS(1); | 1450 | m_host.AddScriptLPS(1); |
@@ -1460,6 +1477,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1460 | { | 1477 | { |
1461 | m_host.AddScriptLPS(1); | 1478 | m_host.AddScriptLPS(1); |
1462 | SetTexture(m_host, texture, face); | 1479 | SetTexture(m_host, texture, face); |
1480 | // ScriptSleep(200); | ||
1463 | } | 1481 | } |
1464 | 1482 | ||
1465 | private void SetTexture(SceneObjectPart part, string texture, int face) | 1483 | private void SetTexture(SceneObjectPart part, string texture, int face) |
@@ -1504,6 +1522,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1504 | m_host.AddScriptLPS(1); | 1522 | m_host.AddScriptLPS(1); |
1505 | 1523 | ||
1506 | ScaleTexture(m_host, u, v, face); | 1524 | ScaleTexture(m_host, u, v, face); |
1525 | // ScriptSleep(200); | ||
1507 | } | 1526 | } |
1508 | 1527 | ||
1509 | private void ScaleTexture(SceneObjectPart part, double u, double v, int face) | 1528 | private void ScaleTexture(SceneObjectPart part, double u, double v, int face) |
@@ -1539,6 +1558,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1539 | { | 1558 | { |
1540 | m_host.AddScriptLPS(1); | 1559 | m_host.AddScriptLPS(1); |
1541 | OffsetTexture(m_host, u, v, face); | 1560 | OffsetTexture(m_host, u, v, face); |
1561 | // ScriptSleep(200); | ||
1542 | } | 1562 | } |
1543 | 1563 | ||
1544 | private void OffsetTexture(SceneObjectPart part, double u, double v, int face) | 1564 | private void OffsetTexture(SceneObjectPart part, double u, double v, int face) |
@@ -1574,6 +1594,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1574 | { | 1594 | { |
1575 | m_host.AddScriptLPS(1); | 1595 | m_host.AddScriptLPS(1); |
1576 | RotateTexture(m_host, rotation, face); | 1596 | RotateTexture(m_host, rotation, face); |
1597 | // ScriptSleep(200); | ||
1577 | } | 1598 | } |
1578 | 1599 | ||
1579 | private void RotateTexture(SceneObjectPart part, double rotation, int face) | 1600 | private void RotateTexture(SceneObjectPart part, double rotation, int face) |
@@ -1628,19 +1649,25 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1628 | 1649 | ||
1629 | SetPos(m_host, pos); | 1650 | SetPos(m_host, pos); |
1630 | 1651 | ||
1631 | // sleep for 0.2 seconds | ||
1632 | ScriptSleep(200); | 1652 | ScriptSleep(200); |
1633 | } | 1653 | } |
1634 | 1654 | ||
1635 | private void SetPos(SceneObjectPart part, LSL_Types.Vector3 pos) | 1655 | private void SetPos(SceneObjectPart part, LSL_Types.Vector3 targetPos) |
1636 | { | 1656 | { |
1657 | // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) | ||
1658 | LSL_Types.Vector3 currentPos = llGetLocalPos(); | ||
1659 | if (llVecDist(currentPos, targetPos) > 10) | ||
1660 | { | ||
1661 | targetPos = currentPos + 10 * llVecNorm(targetPos - currentPos); | ||
1662 | } | ||
1663 | |||
1637 | if (part.ParentID != 0) | 1664 | if (part.ParentID != 0) |
1638 | { | 1665 | { |
1639 | part.UpdateOffSet(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z)); | 1666 | part.UpdateOffSet(new LLVector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z)); |
1640 | } | 1667 | } |
1641 | else | 1668 | else |
1642 | { | 1669 | { |
1643 | part.UpdateGroupPosition(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z)); | 1670 | part.UpdateGroupPosition(new LLVector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z)); |
1644 | } | 1671 | } |
1645 | } | 1672 | } |
1646 | 1673 | ||
@@ -1675,7 +1702,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1675 | 1702 | ||
1676 | SetRot(m_host, rot); | 1703 | SetRot(m_host, rot); |
1677 | 1704 | ||
1678 | // sleep for 0.2 seconds | ||
1679 | ScriptSleep(200); | 1705 | ScriptSleep(200); |
1680 | } | 1706 | } |
1681 | 1707 | ||
@@ -1954,6 +1980,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1954 | { | 1980 | { |
1955 | m_host.AddScriptLPS(1); | 1981 | m_host.AddScriptLPS(1); |
1956 | m_host.PreloadSound(sound); | 1982 | m_host.PreloadSound(sound); |
1983 | // ScriptSleep(1000); | ||
1957 | } | 1984 | } |
1958 | 1985 | ||
1959 | /// <summary> | 1986 | /// <summary> |
@@ -2237,24 +2264,28 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2237 | { | 2264 | { |
2238 | m_host.AddScriptLPS(1); | 2265 | m_host.AddScriptLPS(1); |
2239 | Deprecated("llMakeExplosion"); | 2266 | Deprecated("llMakeExplosion"); |
2267 | // ScriptSleep(100); | ||
2240 | } | 2268 | } |
2241 | 2269 | ||
2242 | public void llMakeFountain() | 2270 | public void llMakeFountain() |
2243 | { | 2271 | { |
2244 | m_host.AddScriptLPS(1); | 2272 | m_host.AddScriptLPS(1); |
2245 | Deprecated("llMakeFountain"); | 2273 | Deprecated("llMakeFountain"); |
2274 | // ScriptSleep(100); | ||
2246 | } | 2275 | } |
2247 | 2276 | ||
2248 | public void llMakeSmoke() | 2277 | public void llMakeSmoke() |
2249 | { | 2278 | { |
2250 | m_host.AddScriptLPS(1); | 2279 | m_host.AddScriptLPS(1); |
2251 | Deprecated("llMakeSmoke"); | 2280 | Deprecated("llMakeSmoke"); |
2281 | // ScriptSleep(100); | ||
2252 | } | 2282 | } |
2253 | 2283 | ||
2254 | public void llMakeFire() | 2284 | public void llMakeFire() |
2255 | { | 2285 | { |
2256 | m_host.AddScriptLPS(1); | 2286 | m_host.AddScriptLPS(1); |
2257 | Deprecated("llMakeFire"); | 2287 | Deprecated("llMakeFire"); |
2288 | // ScriptSleep(100); | ||
2258 | } | 2289 | } |
2259 | 2290 | ||
2260 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param) | 2291 | public void llRezAtRoot(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param) |
@@ -2305,8 +2336,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2305 | //Recoil. | 2336 | //Recoil. |
2306 | llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); | 2337 | llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); |
2307 | found = true; | 2338 | found = true; |
2308 | //script delay | 2339 | // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) |
2309 | ScriptSleep((int)((groupmass * velmag) / 10)); | 2340 | ScriptSleep((int)((groupmass * velmag) / 10)); |
2341 | // ScriptSleep(100); | ||
2310 | break; | 2342 | break; |
2311 | } | 2343 | } |
2312 | } | 2344 | } |
@@ -2340,8 +2372,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2340 | 2372 | ||
2341 | public void llSleep(double sec) | 2373 | public void llSleep(double sec) |
2342 | { | 2374 | { |
2343 | m_host.AddScriptLPS((int)(sec * 100)); | 2375 | m_host.AddScriptLPS(1); |
2344 | System.Threading.Thread.Sleep((int)(sec * 1000)); | 2376 | Thread.Sleep((int)(sec * 1000)); |
2345 | } | 2377 | } |
2346 | 2378 | ||
2347 | public double llGetMass() | 2379 | public double llGetMass() |
@@ -2460,8 +2492,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2460 | msg.fromAgentSession = new Guid(friendTransactionID.ToString());// fromAgentSession.UUID; | 2492 | msg.fromAgentSession = new Guid(friendTransactionID.ToString());// fromAgentSession.UUID; |
2461 | msg.toAgentID = new Guid(user); // toAgentID.UUID; | 2493 | msg.toAgentID = new Guid(user); // toAgentID.UUID; |
2462 | msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here | 2494 | msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here |
2463 | Console.WriteLine("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); | 2495 | // Console.WriteLine("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); |
2464 | Console.WriteLine("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); | 2496 | // Console.WriteLine("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); |
2465 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch();// timestamp; | 2497 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch();// timestamp; |
2466 | //if (client != null) | 2498 | //if (client != null) |
2467 | //{ | 2499 | //{ |
@@ -2480,6 +2512,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2480 | msg.RegionID = World.RegionInfo.RegionID.UUID;//RegionID.UUID; | 2512 | msg.RegionID = World.RegionInfo.RegionID.UUID;//RegionID.UUID; |
2481 | msg.binaryBucket = new byte[0];// binaryBucket; | 2513 | msg.binaryBucket = new byte[0];// binaryBucket; |
2482 | World.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); | 2514 | World.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); |
2515 | // ScriptSleep(2000); | ||
2516 | |||
2483 | // NotImplemented("llInstantMessage"); | 2517 | // NotImplemented("llInstantMessage"); |
2484 | } | 2518 | } |
2485 | 2519 | ||
@@ -2491,6 +2525,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2491 | return; | 2525 | return; |
2492 | 2526 | ||
2493 | emailModule.SendEmail(m_host.UUID, address, subject, message); | 2527 | emailModule.SendEmail(m_host.UUID, address, subject, message); |
2528 | // ScriptSleep(20000); | ||
2494 | } | 2529 | } |
2495 | 2530 | ||
2496 | public void llGetNextEmail(string address, string subject) | 2531 | public void llGetNextEmail(string address, string subject) |
@@ -2914,7 +2949,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2914 | SceneObjectGroup parentPrim = null, childPrim = null; | 2949 | SceneObjectGroup parentPrim = null, childPrim = null; |
2915 | if (targetPart != null) | 2950 | if (targetPart != null) |
2916 | { | 2951 | { |
2917 | if (parent == BuiltIn_Commands_BaseClass.TRUE) { | 2952 | if (parent != 0) { |
2918 | parentPrim = m_host.ParentGroup; | 2953 | parentPrim = m_host.ParentGroup; |
2919 | childPrim = targetPart.ParentGroup; | 2954 | childPrim = targetPart.ParentGroup; |
2920 | } | 2955 | } |
@@ -2932,9 +2967,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2932 | parentPrim.RootPart.AddFlag(LLObject.ObjectFlags.CreateSelected); | 2967 | parentPrim.RootPart.AddFlag(LLObject.ObjectFlags.CreateSelected); |
2933 | parentPrim.GetProperties(client); | 2968 | parentPrim.GetProperties(client); |
2934 | 2969 | ||
2935 | // sleep for 1 second | ||
2936 | ScriptSleep(1000); | 2970 | ScriptSleep(1000); |
2937 | |||
2938 | } | 2971 | } |
2939 | 2972 | ||
2940 | public void llBreakLink(int linknum) | 2973 | public void llBreakLink(int linknum) |
@@ -3096,6 +3129,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3096 | // destination is an object | 3129 | // destination is an object |
3097 | World.MoveTaskInventoryItem(destId, m_host, objId); | 3130 | World.MoveTaskInventoryItem(destId, m_host, objId); |
3098 | } | 3131 | } |
3132 | // ScriptSleep(3000); | ||
3099 | } | 3133 | } |
3100 | 3134 | ||
3101 | public void llRemoveInventory(string name) | 3135 | public void llRemoveInventory(string name) |
@@ -3134,12 +3168,14 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3134 | { | 3168 | { |
3135 | m_host.AddScriptLPS(1); | 3169 | m_host.AddScriptLPS(1); |
3136 | NotImplemented("llRequestAgentData"); | 3170 | NotImplemented("llRequestAgentData"); |
3171 | // ScriptSleep(100); | ||
3137 | return String.Empty; | 3172 | return String.Empty; |
3138 | } | 3173 | } |
3139 | 3174 | ||
3140 | public string llRequestInventoryData(string name) | 3175 | public string llRequestInventoryData(string name) |
3141 | { | 3176 | { |
3142 | m_host.AddScriptLPS(1); | 3177 | m_host.AddScriptLPS(1); |
3178 | |||
3143 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 3179 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) |
3144 | { | 3180 | { |
3145 | if (item.Type == 3 && item.Name == name) | 3181 | if (item.Type == 3 && item.Name == name) |
@@ -3167,9 +3203,11 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3167 | reply); | 3203 | reply); |
3168 | }, false); | 3204 | }, false); |
3169 | 3205 | ||
3206 | // ScriptSleep(1000); | ||
3170 | return tid.ToString(); | 3207 | return tid.ToString(); |
3171 | } | 3208 | } |
3172 | } | 3209 | } |
3210 | // ScriptSleep(1000); | ||
3173 | return String.Empty; | 3211 | return String.Empty; |
3174 | } | 3212 | } |
3175 | 3213 | ||
@@ -3193,6 +3231,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3193 | World.TeleportClientHome(agentId, presence.ControllingClient); | 3231 | World.TeleportClientHome(agentId, presence.ControllingClient); |
3194 | } | 3232 | } |
3195 | } | 3233 | } |
3234 | // ScriptSleep(5000); | ||
3196 | } | 3235 | } |
3197 | 3236 | ||
3198 | public void llModifyLand(int action, int brush) | 3237 | public void llModifyLand(int action, int brush) |
@@ -3256,7 +3295,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3256 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 3295 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( |
3257 | partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj | 3296 | partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj |
3258 | ); | 3297 | ); |
3259 | |||
3260 | } | 3298 | } |
3261 | } | 3299 | } |
3262 | 3300 | ||
@@ -3363,7 +3401,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3363 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( | 3401 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( |
3364 | m_localID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj | 3402 | m_localID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj |
3365 | ); | 3403 | ); |
3366 | |||
3367 | } | 3404 | } |
3368 | } | 3405 | } |
3369 | 3406 | ||
@@ -3437,12 +3474,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3437 | return result; | 3474 | return result; |
3438 | 3475 | ||
3439 | } | 3476 | } |
3477 | |||
3440 | // this function to understand which shape it is (taken from meshmerizer) | 3478 | // this function to understand which shape it is (taken from meshmerizer) |
3441 | // quite useful can be used by meshmerizer to have a centralized point of understanding the shape | 3479 | // quite useful can be used by meshmerizer to have a centralized point of understanding the shape |
3442 | // except that it refers to scripting constants | 3480 | // except that it refers to scripting constants |
3443 | private int getScriptPrimType(PrimitiveBaseShape primShape) | 3481 | private int getScriptPrimType(PrimitiveBaseShape primShape) |
3444 | { | 3482 | { |
3445 | |||
3446 | if (primShape.SculptEntry) | 3483 | if (primShape.SculptEntry) |
3447 | return BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT; | 3484 | return BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT; |
3448 | if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | 3485 | if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) |
@@ -3473,9 +3510,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3473 | return BuiltIn_Commands_BaseClass.PRIM_TYPE_RING; | 3510 | return BuiltIn_Commands_BaseClass.PRIM_TYPE_RING; |
3474 | } | 3511 | } |
3475 | return BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX; | 3512 | return BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX; |
3476 | |||
3477 | |||
3478 | } | 3513 | } |
3514 | |||
3479 | // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces | 3515 | // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces |
3480 | private void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, | 3516 | private void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, |
3481 | out bool hasDimple, out bool hasProfileCut) | 3517 | out bool hasDimple, out bool hasProfileCut) |
@@ -3553,10 +3589,10 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3553 | ret = 1; | 3589 | ret = 1; |
3554 | break; | 3590 | break; |
3555 | } | 3591 | } |
3556 | |||
3557 | return ret; | 3592 | return ret; |
3558 | } | 3593 | } |
3559 | 3594 | ||
3595 | |||
3560 | /* The new / changed functions were tested with the following LSL script: | 3596 | /* The new / changed functions were tested with the following LSL script: |
3561 | 3597 | ||
3562 | default | 3598 | default |
@@ -3714,7 +3750,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3714 | m_host.ParentGroup.RootPart.AllowedDrop = true; | 3750 | m_host.ParentGroup.RootPart.AllowedDrop = true; |
3715 | else | 3751 | else |
3716 | m_host.ParentGroup.RootPart.AllowedDrop = false; | 3752 | m_host.ParentGroup.RootPart.AllowedDrop = false; |
3717 | |||
3718 | } | 3753 | } |
3719 | 3754 | ||
3720 | public LSL_Types.Vector3 llGetSunDirection() | 3755 | public LSL_Types.Vector3 llGetSunDirection() |
@@ -4069,16 +4104,16 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4069 | { | 4104 | { |
4070 | switch (src[i]) | 4105 | switch (src[i]) |
4071 | { | 4106 | { |
4072 | case '<' : | 4107 | case '<': |
4073 | parens++; | 4108 | parens++; |
4074 | length++; | 4109 | length++; |
4075 | break; | 4110 | break; |
4076 | case '>' : | 4111 | case '>': |
4077 | if (parens > 0) | 4112 | if (parens > 0) |
4078 | parens--; | 4113 | parens--; |
4079 | length++; | 4114 | length++; |
4080 | break; | 4115 | break; |
4081 | case ',' : | 4116 | case ',': |
4082 | if (parens == 0) | 4117 | if (parens == 0) |
4083 | { | 4118 | { |
4084 | result.Add(src.Substring(start,length).Trim()); | 4119 | result.Add(src.Substring(start,length).Trim()); |
@@ -4090,7 +4125,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4090 | length++; | 4125 | length++; |
4091 | } | 4126 | } |
4092 | break; | 4127 | break; |
4093 | default : | 4128 | default: |
4094 | length++; | 4129 | length++; |
4095 | break; | 4130 | break; |
4096 | } | 4131 | } |
@@ -4099,7 +4134,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4099 | result.Add(src.Substring(start,length).Trim()); | 4134 | result.Add(src.Substring(start,length).Trim()); |
4100 | 4135 | ||
4101 | return result; | 4136 | return result; |
4102 | |||
4103 | } | 4137 | } |
4104 | 4138 | ||
4105 | /// <summary> | 4139 | /// <summary> |
@@ -4115,7 +4149,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4115 | 4149 | ||
4116 | public LSL_Types.list llListRandomize(LSL_Types.list src, int stride) | 4150 | public LSL_Types.list llListRandomize(LSL_Types.list src, int stride) |
4117 | { | 4151 | { |
4118 | |||
4119 | LSL_Types.list result; | 4152 | LSL_Types.list result; |
4120 | Random rand = new Random(); | 4153 | Random rand = new Random(); |
4121 | 4154 | ||
@@ -4174,7 +4207,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4174 | } | 4207 | } |
4175 | 4208 | ||
4176 | return result; | 4209 | return result; |
4177 | |||
4178 | } | 4210 | } |
4179 | 4211 | ||
4180 | /// <summary> | 4212 | /// <summary> |
@@ -4398,6 +4430,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4398 | { | 4430 | { |
4399 | m_host.AddScriptLPS(1); | 4431 | m_host.AddScriptLPS(1); |
4400 | m_host.AdjustSoundGain(volume); | 4432 | m_host.AdjustSoundGain(volume); |
4433 | // ScriptSleep(100); | ||
4401 | } | 4434 | } |
4402 | 4435 | ||
4403 | public void llSetSoundQueueing(int queue) | 4436 | public void llSetSoundQueueing(int queue) |
@@ -4550,81 +4583,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4550 | return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); | 4583 | return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); |
4551 | } | 4584 | } |
4552 | 4585 | ||
4553 | public string llGetNotecardLine(string name, int line) | ||
4554 | { | ||
4555 | m_host.AddScriptLPS(1); | ||
4556 | |||
4557 | // TODO: this script function should actually return | ||
4558 | // the requested notecard line via the dataserver event | ||
4559 | // once it is implemented - krtaylor | ||
4560 | |||
4561 | String[] notecardLines = GetNotecardLines(name); | ||
4562 | |||
4563 | line--; // array starts at 0 | ||
4564 | if ((!String.IsNullOrEmpty(notecardLines[0])) && | ||
4565 | (line >= 0) && | ||
4566 | (line < notecardLines.Length)) | ||
4567 | { | ||
4568 | return notecardLines[line]; | ||
4569 | } | ||
4570 | else | ||
4571 | { | ||
4572 | return String.Empty; | ||
4573 | } | ||
4574 | } | ||
4575 | |||
4576 | private String[] GetNotecardLines(string name) | ||
4577 | { | ||
4578 | // bool found = false; | ||
4579 | int notecardIndex = 0; | ||
4580 | String[] notecardLines = { "0" }; | ||
4581 | notecardLines[0] = String.Empty; | ||
4582 | |||
4583 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
4584 | { | ||
4585 | if ((inv.Value.Name == name) && (inv.Value.InvType == (int)InventoryType.Notecard)) | ||
4586 | { | ||
4587 | // OK, it has the right name and it is a notecard | ||
4588 | // so get the asset that contains the notecard raw data | ||
4589 | // and convert it into a string | ||
4590 | AssetBase notecardAsset = World.AssetCache.GetAsset(inv.Value.AssetID, false); | ||
4591 | String dataString = System.Text.Encoding.ASCII.GetString(notecardAsset.Data); | ||
4592 | |||
4593 | if (!String.IsNullOrEmpty(dataString)) | ||
4594 | { | ||
4595 | // good, we have the notecard data as a string | ||
4596 | // now parse the text lines using the Linden Text delimiters | ||
4597 | notecardIndex = dataString.IndexOf("}\nText length "); | ||
4598 | if (notecardIndex > 0) | ||
4599 | { | ||
4600 | notecardIndex = notecardIndex + 2; //get past delimiter | ||
4601 | notecardIndex = dataString.IndexOf("\n", notecardIndex); | ||
4602 | if (notecardIndex > 0) | ||
4603 | { | ||
4604 | // Finally got to the first line of the notecard | ||
4605 | // now find the end of the notecard text delimited by }<LF> | ||
4606 | // parse the lines, delimited by <LF> | ||
4607 | notecardIndex = dataString.IndexOf("\n", notecardIndex); | ||
4608 | notecardIndex++; // get past delimiter | ||
4609 | |||
4610 | int notecardLength = dataString.Length - notecardIndex - 3; | ||
4611 | |||
4612 | // create new string to parse that only consists of the actual lines in the asset | ||
4613 | Char[] notecardCharArray = dataString.ToCharArray(notecardIndex, notecardLength); | ||
4614 | String notecardString = new String(notecardCharArray); | ||
4615 | |||
4616 | // split the lines of the notecard into separate strings | ||
4617 | char[] delimChar = { '\n' }; | ||
4618 | notecardLines = notecardString.Split(delimChar); | ||
4619 | return notecardLines; | ||
4620 | } | ||
4621 | } | ||
4622 | } | ||
4623 | } | ||
4624 | } | ||
4625 | return notecardLines; | ||
4626 | } | ||
4627 | |||
4628 | public LSL_Types.Vector3 llGetAgentSize(string id) | 4586 | public LSL_Types.Vector3 llGetAgentSize(string id) |
4629 | { | 4587 | { |
4630 | m_host.AddScriptLPS(1); | 4588 | m_host.AddScriptLPS(1); |
@@ -5071,6 +5029,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5071 | land.ParcelAccessList.Add(entry); | 5029 | land.ParcelAccessList.Add(entry); |
5072 | } | 5030 | } |
5073 | } | 5031 | } |
5032 | // ScriptSleep(100); | ||
5074 | } | 5033 | } |
5075 | 5034 | ||
5076 | public void llSetTouchText(string text) | 5035 | public void llSetTouchText(string text) |
@@ -5158,6 +5117,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5158 | buts[i] = buttons.Data[i].ToString(); | 5117 | buts[i] = buttons.Data[i].ToString(); |
5159 | } | 5118 | } |
5160 | World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); | 5119 | World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); |
5120 | // ScriptSleep(1000); | ||
5161 | } | 5121 | } |
5162 | 5122 | ||
5163 | public void llVolumeDetect(int detect) | 5123 | public void llVolumeDetect(int detect) |
@@ -5232,12 +5192,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5232 | { | 5192 | { |
5233 | m_host.AddScriptLPS(1); | 5193 | m_host.AddScriptLPS(1); |
5234 | Deprecated("llRemoteLoadScript"); | 5194 | Deprecated("llRemoteLoadScript"); |
5195 | // ScriptSleep(3000); | ||
5235 | } | 5196 | } |
5236 | 5197 | ||
5237 | public void llSetRemoteScriptAccessPin(int pin) | 5198 | public void llSetRemoteScriptAccessPin(int pin) |
5238 | { | 5199 | { |
5239 | m_host.AddScriptLPS(1); | 5200 | m_host.AddScriptLPS(1); |
5240 | |||
5241 | m_host.ScriptAccessPin = pin; | 5201 | m_host.ScriptAccessPin = pin; |
5242 | } | 5202 | } |
5243 | 5203 | ||
@@ -5287,11 +5247,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5287 | ScriptSleep(3000); | 5247 | ScriptSleep(3000); |
5288 | } | 5248 | } |
5289 | 5249 | ||
5290 | // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) | ||
5291 | // Not sure where these constants should live: | ||
5292 | // REMOTE_DATA_CHANNEL = 1 | ||
5293 | // REMOTE_DATA_REQUEST = 2 | ||
5294 | // REMOTE_DATA_REPLY = 3 | ||
5295 | public void llOpenRemoteDataChannel() | 5250 | public void llOpenRemoteDataChannel() |
5296 | { | 5251 | { |
5297 | m_host.AddScriptLPS(1); | 5252 | m_host.AddScriptLPS(1); |
@@ -5302,12 +5257,14 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5302 | object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) }; | 5257 | object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) }; |
5303 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); | 5258 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); |
5304 | } | 5259 | } |
5260 | // ScriptSleep(1000); | ||
5305 | } | 5261 | } |
5306 | 5262 | ||
5307 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) | 5263 | public string llSendRemoteData(string channel, string dest, int idata, string sdata) |
5308 | { | 5264 | { |
5309 | m_host.AddScriptLPS(1); | 5265 | m_host.AddScriptLPS(1); |
5310 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 5266 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
5267 | // ScriptSleep(3000); | ||
5311 | return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString(); | 5268 | return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString(); |
5312 | } | 5269 | } |
5313 | 5270 | ||
@@ -5316,6 +5273,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5316 | m_host.AddScriptLPS(1); | 5273 | m_host.AddScriptLPS(1); |
5317 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 5274 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
5318 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); | 5275 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); |
5276 | // ScriptSleep(3000); | ||
5319 | } | 5277 | } |
5320 | 5278 | ||
5321 | public void llCloseRemoteDataChannel(string channel) | 5279 | public void llCloseRemoteDataChannel(string channel) |
@@ -5323,6 +5281,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5323 | m_host.AddScriptLPS(1); | 5281 | m_host.AddScriptLPS(1); |
5324 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 5282 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
5325 | xmlrpcMod.CloseXMLRPCChannel(channel); | 5283 | xmlrpcMod.CloseXMLRPCChannel(channel); |
5284 | // ScriptSleep(1000); | ||
5326 | } | 5285 | } |
5327 | 5286 | ||
5328 | public string llMD5String(string src, int nonce) | 5287 | public string llMD5String(string src, int nonce) |
@@ -5900,7 +5859,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5900 | break; | 5859 | break; |
5901 | case (int)BuiltIn_Commands_BaseClass.PRIM_GLOW: | 5860 | case (int)BuiltIn_Commands_BaseClass.PRIM_GLOW: |
5902 | if (remain < 2) | 5861 | if (remain < 2) |
5903 | return; | 5862 | return; |
5904 | face = Convert.ToInt32(rules.Data[idx++]); | 5863 | face = Convert.ToInt32(rules.Data[idx++]); |
5905 | float glow = (float)Convert.ToDouble(rules.Data[idx++]); | 5864 | float glow = (float)Convert.ToDouble(rules.Data[idx++]); |
5906 | 5865 | ||
@@ -5909,7 +5868,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5909 | break; | 5868 | break; |
5910 | case (int)BuiltIn_Commands_BaseClass.PRIM_BUMP_SHINY: | 5869 | case (int)BuiltIn_Commands_BaseClass.PRIM_BUMP_SHINY: |
5911 | if (remain < 3) | 5870 | if (remain < 3) |
5912 | return; | 5871 | return; |
5913 | face = Convert.ToInt32(rules.Data[idx++]); | 5872 | face = Convert.ToInt32(rules.Data[idx++]); |
5914 | int shiny = Convert.ToInt32(rules.Data[idx++]); | 5873 | int shiny = Convert.ToInt32(rules.Data[idx++]); |
5915 | Bumpiness bump = (Bumpiness)Convert.ToByte(rules.Data[idx++]); | 5874 | Bumpiness bump = (Bumpiness)Convert.ToByte(rules.Data[idx++]); |
@@ -5918,58 +5877,58 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
5918 | 5877 | ||
5919 | break; | 5878 | break; |
5920 | case (int)BuiltIn_Commands_BaseClass.PRIM_FULLBRIGHT: | 5879 | case (int)BuiltIn_Commands_BaseClass.PRIM_FULLBRIGHT: |
5921 | if (remain < 2) | 5880 | if (remain < 2) |
5922 | return; | 5881 | return; |
5923 | face = Convert.ToInt32(rules.Data[idx++]); | 5882 | face = Convert.ToInt32(rules.Data[idx++]); |
5924 | string bv = rules.Data[idx++].ToString(); | 5883 | string bv = rules.Data[idx++].ToString(); |
5925 | bool st; | 5884 | bool st; |
5926 | if (bv.Equals("1")) | 5885 | if (bv.Equals("1")) |
5927 | st = true; | 5886 | st = true; |
5928 | else | 5887 | else |
5929 | st = false; | 5888 | st = false; |
5930 | 5889 | ||
5931 | SetFullBright(part, face, st); | 5890 | SetFullBright(part, face , st); |
5932 | break; | 5891 | break; |
5933 | case (int)BuiltIn_Commands_BaseClass.PRIM_MATERIAL: | 5892 | case (int)BuiltIn_Commands_BaseClass.PRIM_MATERIAL: |
5934 | if (remain < 1) | 5893 | if (remain < 1) |
5935 | return; | 5894 | return; |
5936 | if (part != null) | 5895 | if (part != null) |
5937 | { | 5896 | { |
5938 | /* Unhandled at this time - sends "Unhandled" message | 5897 | /* Unhandled at this time - sends "Unhandled" message |
5939 | will enable when available | 5898 | will enable when available |
5940 | byte material = (byte)Convert.ToByte( rules.Data[idx++]); | 5899 | byte material = (byte)Convert.ToByte( rules.Data[idx++]); |
5941 | part.Material = material; | 5900 | part.Material = material; |
5942 | */ | 5901 | */ |
5943 | return; | 5902 | return; |
5944 | } | 5903 | } |
5945 | break; | 5904 | break; |
5946 | case (int)BuiltIn_Commands_BaseClass.PRIM_PHANTOM: | 5905 | case (int)BuiltIn_Commands_BaseClass.PRIM_PHANTOM: |
5947 | if (remain < 1) | 5906 | if (remain < 1) |
5948 | return; | 5907 | return; |
5949 | 5908 | ||
5950 | string ph = rules.Data[idx++].ToString(); | 5909 | string ph = rules.Data[idx++].ToString(); |
5951 | bool phantom; | 5910 | bool phantom; |
5952 | 5911 | ||
5953 | if (ph.Equals("1")) | 5912 | if (ph.Equals("1")) |
5954 | phantom = true; | 5913 | phantom = true; |
5955 | else | 5914 | else |
5956 | phantom = false; | 5915 | phantom = false; |
5957 | 5916 | ||
5958 | part.ScriptSetPhantomStatus(phantom); | 5917 | part.ScriptSetPhantomStatus(phantom); |
5959 | part.ScheduleFullUpdate(); | 5918 | part.ScheduleFullUpdate(); |
5960 | break; | 5919 | break; |
5961 | case (int)BuiltIn_Commands_BaseClass.PRIM_PHYSICS: | 5920 | case (int)BuiltIn_Commands_BaseClass.PRIM_PHYSICS: |
5962 | if (remain < 1) | 5921 | if (remain < 1) |
5963 | return; | 5922 | return; |
5964 | string phy = rules.Data[idx++].ToString(); | 5923 | string phy = rules.Data[idx++].ToString(); |
5965 | bool physics; | 5924 | bool physics; |
5966 | 5925 | ||
5967 | if (phy.Equals("1")) | 5926 | if (phy.Equals("1")) |
5968 | physics = true; | 5927 | physics = true; |
5969 | else | 5928 | else |
5970 | physics = false; | 5929 | physics = false; |
5971 | 5930 | ||
5972 | m_host.ScriptSetPhysicsStatus(physics); | 5931 | m_host.ScriptSetPhysicsStatus(physics); |
5973 | part.ScheduleFullUpdate(); | 5932 | part.ScheduleFullUpdate(); |
5974 | break; | 5933 | break; |
5975 | } | 5934 | } |
@@ -6016,6 +5975,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6016 | { | 5975 | { |
6017 | m_host.AddScriptLPS(1); | 5976 | m_host.AddScriptLPS(1); |
6018 | Deprecated("llXorBase64Strings"); | 5977 | Deprecated("llXorBase64Strings"); |
5978 | // ScriptSleep(300); | ||
6019 | } | 5979 | } |
6020 | 5980 | ||
6021 | public void llRemoteDataSetRegion() | 5981 | public void llRemoteDataSetRegion() |
@@ -6064,6 +6024,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6064 | return; | 6024 | return; |
6065 | } | 6025 | } |
6066 | World.SetLandMusicURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url); | 6026 | World.SetLandMusicURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url); |
6027 | // ScriptSleep(2000); | ||
6067 | } | 6028 | } |
6068 | 6029 | ||
6069 | public void osSetParcelMediaURL(string url) | 6030 | public void osSetParcelMediaURL(string url) |
@@ -6203,25 +6164,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6203 | return m_host.ParentGroup.PrimCount; | 6164 | return m_host.ParentGroup.PrimCount; |
6204 | } | 6165 | } |
6205 | 6166 | ||
6206 | public int llGetNumberOfNotecardLines(string name) | ||
6207 | { | ||
6208 | m_host.AddScriptLPS(1); | ||
6209 | |||
6210 | // TODO: this script function should actually return | ||
6211 | // the number of lines via the dataserver event | ||
6212 | // once it is implemented - krtaylor | ||
6213 | |||
6214 | String[] notecardLines = GetNotecardLines(name); | ||
6215 | if (!String.IsNullOrEmpty(notecardLines[0])) | ||
6216 | { | ||
6217 | return notecardLines.Length; | ||
6218 | } | ||
6219 | else | ||
6220 | { | ||
6221 | return 0; | ||
6222 | } | ||
6223 | } | ||
6224 | |||
6225 | public LSL_Types.list llGetBoundingBox(string obj) | 6167 | public LSL_Types.list llGetBoundingBox(string obj) |
6226 | { | 6168 | { |
6227 | m_host.AddScriptLPS(1); | 6169 | m_host.AddScriptLPS(1); |
@@ -6292,22 +6234,20 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6292 | break; | 6234 | break; |
6293 | 6235 | ||
6294 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE: | 6236 | case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE: |
6295 | |||
6296 | // implementing box | 6237 | // implementing box |
6297 | PrimitiveBaseShape Shape=m_host.Shape; | 6238 | PrimitiveBaseShape Shape = m_host.Shape; |
6298 | int primType=getScriptPrimType(m_host.Shape); | 6239 | int primType = getScriptPrimType(m_host.Shape); |
6299 | res.Add(new LSL_Types.LSLInteger(primType)); | 6240 | res.Add(new LSL_Types.LSLInteger(primType)); |
6300 | switch(primType) | 6241 | switch (primType) |
6301 | { | 6242 | { |
6302 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX: | 6243 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX: |
6303 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER: | 6244 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER: |
6304 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM: | 6245 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM: |
6305 | |||
6306 | res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); | 6246 | res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); |
6307 | res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); | 6247 | res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); |
6308 | res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); | 6248 | res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); |
6309 | res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0,Shape.PathTwist / 100.0,0)); | 6249 | res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); |
6310 | res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0-1), 1 - (Shape.PathScaleY / 100.0-1), 0)); | 6250 | res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); |
6311 | res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); | 6251 | res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); |
6312 | break; | 6252 | break; |
6313 | 6253 | ||
@@ -6317,24 +6257,21 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6317 | res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); | 6257 | res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); |
6318 | res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); | 6258 | res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); |
6319 | res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); | 6259 | res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); |
6320 | |||
6321 | break; | 6260 | break; |
6322 | 6261 | ||
6323 | |||
6324 | |||
6325 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT: | 6262 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT: |
6326 | res.Add(Shape.SculptTexture.ToString()); | 6263 | res.Add(Shape.SculptTexture.ToString()); |
6327 | res.Add(new LSL_Types.LSLInteger(Shape.SculptType)); | 6264 | res.Add(new LSL_Types.LSLInteger(Shape.SculptType)); |
6328 | |||
6329 | break; | 6265 | break; |
6266 | |||
6330 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_RING: | 6267 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_RING: |
6331 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE: | 6268 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE: |
6332 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS: | 6269 | case BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS: |
6333 | // holeshape | 6270 | // holeshape |
6334 | res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); | 6271 | res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); |
6335 | 6272 | ||
6336 | // cut | 6273 | // cut |
6337 | res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); | 6274 | res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); |
6338 | 6275 | ||
6339 | // hollow | 6276 | // hollow |
6340 | res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); | 6277 | res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); |
@@ -6344,29 +6281,27 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6344 | 6281 | ||
6345 | // vector holesize | 6282 | // vector holesize |
6346 | res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); | 6283 | res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); |
6347 | 6284 | ||
6348 | // vector topshear | 6285 | // vector topshear |
6349 | res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); | 6286 | res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); |
6350 | 6287 | ||
6351 | // vector profilecut | 6288 | // vector profilecut |
6352 | res.Add(new LSL_Types.Vector3(Shape.ProfileBegin/ 50000.0, 1 - Shape.ProfileEnd / 50000.0,0)); | 6289 | res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); |
6353 | 6290 | ||
6354 | 6291 | ||
6355 | // vector tapera | 6292 | // vector tapera |
6356 | res.Add(new LSL_Types.Vector3(Shape.PathTaperX / 100.0,Shape.PathTaperY / 100.0,0)); | 6293 | res.Add(new LSL_Types.Vector3(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); |
6357 | 6294 | ||
6358 | // float revolutions, | 6295 | // float revolutions, |
6359 | res.Add(new LSL_Types.LSLFloat(Shape.PathRevolutions/50.0)); // needs fixing :( | 6296 | res.Add(new LSL_Types.LSLFloat(Shape.PathRevolutions / 50.0)); // needs fixing :( |
6360 | 6297 | ||
6361 | // float radiusoffset, | 6298 | // float radiusoffset, |
6362 | res.Add(new LSL_Types.LSLFloat(Shape.PathRadiusOffset/100.0)); | 6299 | res.Add(new LSL_Types.LSLFloat(Shape.PathRadiusOffset / 100.0)); |
6363 | 6300 | ||
6364 | // float skew | 6301 | // float skew |
6365 | res.Add(new LSL_Types.LSLFloat(Shape.PathSkew/100.0)); | 6302 | res.Add(new LSL_Types.LSLFloat(Shape.PathSkew / 100.0)); |
6366 | break; | 6303 | break; |
6367 | |||
6368 | 6304 | ||
6369 | |||
6370 | } | 6305 | } |
6371 | break; | 6306 | break; |
6372 | 6307 | ||
@@ -6374,7 +6309,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6374 | if (remain < 1) | 6309 | if (remain < 1) |
6375 | return res; | 6310 | return res; |
6376 | 6311 | ||
6377 | int face=Convert.ToInt32(""+rules.Data[idx++]); | 6312 | int face = Convert.ToInt32("" + rules.Data[idx++]); |
6378 | if (face == -1) | 6313 | if (face == -1) |
6379 | face = 0; | 6314 | face = 0; |
6380 | 6315 | ||
@@ -6395,7 +6330,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6395 | if (remain < 1) | 6330 | if (remain < 1) |
6396 | return res; | 6331 | return res; |
6397 | 6332 | ||
6398 | face=Convert.ToInt32(""+rules.Data[idx++]); | 6333 | face=Convert.ToInt32("" + rules.Data[idx++]); |
6399 | 6334 | ||
6400 | tex = m_host.Shape.Textures; | 6335 | tex = m_host.Shape.Textures; |
6401 | LLColor texcolor; | 6336 | LLColor texcolor; |
@@ -6753,6 +6688,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6753 | { | 6688 | { |
6754 | m_host.AddScriptLPS(1); | 6689 | m_host.AddScriptLPS(1); |
6755 | m_host.RotationOffset = new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); | 6690 | m_host.RotationOffset = new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); |
6691 | // ScriptSleep(200); | ||
6756 | } | 6692 | } |
6757 | 6693 | ||
6758 | // <summary> | 6694 | // <summary> |
@@ -6872,7 +6808,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6872 | if (active[j]) | 6808 | if (active[j]) |
6873 | { | 6809 | { |
6874 | // scan all of the markers | 6810 | // scan all of the markers |
6875 | if ((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1) | 6811 | if ((offset[j] = src.IndexOf((string)spcarray[j-seplen], beginning)) == -1) |
6876 | { | 6812 | { |
6877 | // not present at all | 6813 | // not present at all |
6878 | active[j] = false; | 6814 | active[j] = false; |
@@ -6896,7 +6832,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6896 | { | 6832 | { |
6897 | // no markers were found on this pass | 6833 | // no markers were found on this pass |
6898 | // so we're pretty much done | 6834 | // so we're pretty much done |
6899 | tokens.Add(src.Substring(beginning, srclen-beginning)); | 6835 | tokens.Add(src.Substring(beginning, srclen - beginning)); |
6900 | break; | 6836 | break; |
6901 | } | 6837 | } |
6902 | 6838 | ||
@@ -6907,14 +6843,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6907 | 6843 | ||
6908 | if (best < seplen) | 6844 | if (best < seplen) |
6909 | { | 6845 | { |
6910 | beginning = offset[best]+((string)separray[best]).Length; | 6846 | beginning = offset[best] + ((string)separray[best]).Length; |
6911 | } | 6847 | } |
6912 | else | 6848 | else |
6913 | { | 6849 | { |
6914 | beginning = offset[best]+((string)spcarray[best-seplen]).Length; | 6850 | beginning = offset[best] + ((string)spcarray[best - seplen]).Length; |
6915 | tokens.Add(spcarray[best-seplen]); | 6851 | tokens.Add(spcarray[best - seplen]); |
6916 | } | 6852 | } |
6917 | |||
6918 | } | 6853 | } |
6919 | 6854 | ||
6920 | // This an awkward an not very intuitive boundary case. If the | 6855 | // This an awkward an not very intuitive boundary case. If the |
@@ -7053,65 +6988,78 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7053 | public void llOwnerSay(string msg) | 6988 | public void llOwnerSay(string msg) |
7054 | { | 6989 | { |
7055 | m_host.AddScriptLPS(1); | 6990 | m_host.AddScriptLPS(1); |
7056 | World.SimChatBroadcast(Helpers.StringToField(msg), | ||
7057 | ChatTypeEnum.Owner, 0, m_host.AbsolutePosition, | ||
7058 | m_host.Name, m_host.UUID, false); | ||
7059 | 6991 | ||
7060 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 6992 | World.SimChatBroadcast(Helpers.StringToField(msg), ChatTypeEnum.Owner, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); |
7061 | wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); | 6993 | // IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
6994 | // wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); | ||
7062 | } | 6995 | } |
7063 | 6996 | ||
7064 | public string llRequestSimulatorData(string simulator, int data) | 6997 | public string llRequestSimulatorData(string simulator, int data) |
7065 | { | 6998 | { |
7066 | m_host.AddScriptLPS(1); | 6999 | try |
7000 | { | ||
7001 | m_host.AddScriptLPS(1); | ||
7067 | 7002 | ||
7068 | string reply = String.Empty; | 7003 | string reply = String.Empty; |
7069 | 7004 | ||
7070 | RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); | 7005 | RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); |
7071 | 7006 | ||
7072 | switch (data) | 7007 | switch (data) |
7073 | { | 7008 | { |
7074 | case 5: // DATA_SIM_POS | 7009 | case 5: // DATA_SIM_POS |
7075 | if (info == null) | 7010 | if (info == null) |
7076 | return LLUUID.Zero.ToString(); | 7011 | { |
7077 | reply = new LSL_Types.Vector3( | 7012 | // ScriptSleep(1000); |
7078 | info.RegionLocX * Constants.RegionSize, | 7013 | return LLUUID.Zero.ToString(); |
7079 | info.RegionLocY * Constants.RegionSize, | 7014 | } |
7080 | 0).ToString(); | 7015 | reply = new LSL_Types.Vector3( |
7081 | break; | 7016 | info.RegionLocX * Constants.RegionSize, |
7082 | case 6: // DATA_SIM_STATUS | 7017 | info.RegionLocY * Constants.RegionSize, |
7083 | if (info != null) | 7018 | 0).ToString(); |
7084 | reply = "up"; // Duh! | 7019 | break; |
7085 | else | 7020 | case 6: // DATA_SIM_STATUS |
7086 | reply = "unknown"; | 7021 | if (info != null) |
7087 | break; | 7022 | reply = "up"; // Duh! |
7088 | case 7: // DATA_SIM_RATING | 7023 | else |
7089 | if (info == null) | 7024 | reply = "unknown"; |
7090 | return LLUUID.Zero.ToString(); | 7025 | break; |
7091 | int access = info.RegionSettings.Maturity; | 7026 | case 7: // DATA_SIM_RATING |
7092 | if (access == 0) | 7027 | if (info == null) |
7093 | reply = "PG"; | 7028 | { |
7094 | else if (access == 1) | 7029 | // ScriptSleep(1000); |
7095 | reply = "MATURE"; | 7030 | return LLUUID.Zero.ToString(); |
7096 | else | 7031 | } |
7097 | reply = "UNKNOWN"; | 7032 | int access = info.RegionSettings.Maturity; |
7098 | break; | 7033 | if (access == 0) |
7099 | case 128: // SIM_RELEASE | 7034 | reply = "PG"; |
7100 | reply = m_ScriptEngine.World.GetSimulatorVersion(); | 7035 | else if (access == 1) |
7101 | break; | 7036 | reply = "MATURE"; |
7102 | default: | 7037 | else |
7103 | return LLUUID.Zero.ToString(); // Raise no event | 7038 | reply = "UNKNOWN"; |
7104 | } | 7039 | break; |
7105 | LLUUID rq = LLUUID.Random(); | 7040 | case 128: // SIM_RELEASE |
7041 | reply = m_ScriptEngine.World.GetSimulatorVersion(); | ||
7042 | break; | ||
7043 | default: | ||
7044 | // ScriptSleep(1000); | ||
7045 | return LLUUID.Zero.ToString(); // Raise no event | ||
7046 | } | ||
7047 | LLUUID rq = LLUUID.Random(); | ||
7106 | 7048 | ||
7107 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. | 7049 | LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. |
7108 | m_Dataserver.RegisterRequest(m_localID, | 7050 | m_Dataserver.RegisterRequest(m_localID, m_itemID, rq.ToString()); |
7109 | m_itemID, rq.ToString()); | ||
7110 | 7051 | ||
7111 | m_ScriptEngine.m_ASYNCLSLCommandManager. | 7052 | m_ScriptEngine.m_ASYNCLSLCommandManager. |
7112 | m_Dataserver.DataserverReply(rq.ToString(), reply); | 7053 | m_Dataserver.DataserverReply(rq.ToString(), reply); |
7113 | 7054 | ||
7114 | return tid.ToString(); | 7055 | // ScriptSleep(1000); |
7056 | return tid.ToString(); | ||
7057 | } | ||
7058 | catch(Exception e) | ||
7059 | { | ||
7060 | Console.WriteLine(e.ToString()); | ||
7061 | return LLUUID.Zero.ToString(); | ||
7062 | } | ||
7115 | } | 7063 | } |
7116 | 7064 | ||
7117 | public void llForceMouselook(int mouselook) | 7065 | public void llForceMouselook(int mouselook) |
@@ -7145,7 +7093,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7145 | 7093 | ||
7146 | public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) | 7094 | public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) |
7147 | { | 7095 | { |
7148 | |||
7149 | LSL_Types.list pref = null; | 7096 | LSL_Types.list pref = null; |
7150 | 7097 | ||
7151 | m_host.AddScriptLPS(1); | 7098 | m_host.AddScriptLPS(1); |
@@ -7175,9 +7122,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7175 | pref = dest.GetSublist(0,start-1); | 7122 | pref = dest.GetSublist(0,start-1); |
7176 | // Only add a suffix if there is something | 7123 | // Only add a suffix if there is something |
7177 | // beyond the end index (it's inclusive too). | 7124 | // beyond the end index (it's inclusive too). |
7178 | if (end+1 < dest.Length) | 7125 | if (end + 1 < dest.Length) |
7179 | { | 7126 | { |
7180 | return pref + src + dest.GetSublist(end+1,-1); | 7127 | return pref + src + dest.GetSublist(end + 1, -1); |
7181 | } | 7128 | } |
7182 | else | 7129 | else |
7183 | { | 7130 | { |
@@ -7192,9 +7139,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7192 | // is removed. | 7139 | // is removed. |
7193 | else | 7140 | else |
7194 | { | 7141 | { |
7195 | if (end+1 < dest.Length) | 7142 | if (end + 1 < dest.Length) |
7196 | { | 7143 | { |
7197 | return src + dest.GetSublist(end+1,-1); | 7144 | return src + dest.GetSublist(end + 1, -1); |
7198 | } | 7145 | } |
7199 | else | 7146 | else |
7200 | { | 7147 | { |
@@ -7210,7 +7157,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7210 | // might have been negative. | 7157 | // might have been negative. |
7211 | else | 7158 | else |
7212 | { | 7159 | { |
7213 | return dest.GetSublist(end+1,start-1)+src; | 7160 | return dest.GetSublist(end + 1, start - 1) + src; |
7214 | } | 7161 | } |
7215 | } | 7162 | } |
7216 | 7163 | ||
@@ -7220,6 +7167,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7220 | LLUUID avatarId = new LLUUID(avatar_id); | 7167 | LLUUID avatarId = new LLUUID(avatar_id); |
7221 | m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, | 7168 | m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, |
7222 | url); | 7169 | url); |
7170 | // ScriptSleep(10000); | ||
7223 | } | 7171 | } |
7224 | 7172 | ||
7225 | public void llParcelMediaCommandList(LSL_Types.list commandList) | 7173 | public void llParcelMediaCommandList(LSL_Types.list commandList) |
@@ -7306,7 +7254,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7306 | }//end switch | 7254 | }//end switch |
7307 | 7255 | ||
7308 | } | 7256 | } |
7309 | 7257 | // ScriptSleep(2000); | |
7310 | 7258 | ||
7311 | //NotImplemented("llParcelMediaCommandList"); | 7259 | //NotImplemented("llParcelMediaCommandList"); |
7312 | } | 7260 | } |
@@ -7346,8 +7294,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7346 | 7294 | ||
7347 | } | 7295 | } |
7348 | } | 7296 | } |
7297 | // ScriptSleep(2000); | ||
7349 | return list; | 7298 | return list; |
7350 | |||
7351 | } | 7299 | } |
7352 | 7300 | ||
7353 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) | 7301 | public LSL_Types.LSLInteger llModPow(int a, int b, int c) |
@@ -7355,6 +7303,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7355 | m_host.AddScriptLPS(1); | 7303 | m_host.AddScriptLPS(1); |
7356 | Int64 tmp = 0; | 7304 | Int64 tmp = 0; |
7357 | Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); | 7305 | Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); |
7306 | // ScriptSleep(1000); | ||
7358 | return Convert.ToInt32(tmp); | 7307 | return Convert.ToInt32(tmp); |
7359 | } | 7308 | } |
7360 | 7309 | ||
@@ -7420,12 +7369,14 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7420 | { | 7369 | { |
7421 | m_host.AddScriptLPS(1); | 7370 | m_host.AddScriptLPS(1); |
7422 | NotImplemented("llSetPrimURL"); | 7371 | NotImplemented("llSetPrimURL"); |
7372 | // ScriptSleep(2000); | ||
7423 | } | 7373 | } |
7424 | 7374 | ||
7425 | public void llRefreshPrimURL() | 7375 | public void llRefreshPrimURL() |
7426 | { | 7376 | { |
7427 | m_host.AddScriptLPS(1); | 7377 | m_host.AddScriptLPS(1); |
7428 | NotImplemented("llRefreshPrimURL"); | 7378 | NotImplemented("llRefreshPrimURL"); |
7379 | // ScriptSleep(20000); | ||
7429 | } | 7380 | } |
7430 | 7381 | ||
7431 | public string llEscapeURL(string url) | 7382 | public string llEscapeURL(string url) |
@@ -7458,6 +7409,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7458 | { | 7409 | { |
7459 | m_host.AddScriptLPS(1); | 7410 | m_host.AddScriptLPS(1); |
7460 | NotImplemented("llMapDestination"); | 7411 | NotImplemented("llMapDestination"); |
7412 | // ScriptSleep(1000); | ||
7461 | } | 7413 | } |
7462 | 7414 | ||
7463 | public void llAddToLandBanList(string avatar, double hours) | 7415 | public void llAddToLandBanList(string avatar, double hours) |
@@ -7476,6 +7428,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7476 | land.ParcelAccessList.Add(entry); | 7428 | land.ParcelAccessList.Add(entry); |
7477 | } | 7429 | } |
7478 | } | 7430 | } |
7431 | // ScriptSleep(100); | ||
7479 | } | 7432 | } |
7480 | 7433 | ||
7481 | public void llRemoveFromLandPassList(string avatar) | 7434 | public void llRemoveFromLandPassList(string avatar) |
@@ -7497,6 +7450,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7497 | } | 7450 | } |
7498 | } | 7451 | } |
7499 | } | 7452 | } |
7453 | // ScriptSleep(100); | ||
7500 | } | 7454 | } |
7501 | 7455 | ||
7502 | public void llRemoveFromLandBanList(string avatar) | 7456 | public void llRemoveFromLandBanList(string avatar) |
@@ -7518,6 +7472,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7518 | } | 7472 | } |
7519 | } | 7473 | } |
7520 | } | 7474 | } |
7475 | // ScriptSleep(100); | ||
7521 | } | 7476 | } |
7522 | 7477 | ||
7523 | public void llSetCameraParams(LSL_Types.list rules) | 7478 | public void llSetCameraParams(LSL_Types.list rules) |
@@ -7647,7 +7602,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7647 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | 7602 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); |
7648 | if (estate == null) | 7603 | if (estate == null) |
7649 | return 67108864; | 7604 | return 67108864; |
7650 | return estate.GetRegionFlags(); | 7605 | return (int)estate.GetRegionFlags(); |
7651 | } | 7606 | } |
7652 | 7607 | ||
7653 | public string llXorBase64StringsCorrect(string str1, string str2) | 7608 | public string llXorBase64StringsCorrect(string str1, string str2) |
@@ -7725,6 +7680,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7725 | } | 7680 | } |
7726 | } | 7681 | } |
7727 | } | 7682 | } |
7683 | // ScriptSleep(100); | ||
7728 | } | 7684 | } |
7729 | 7685 | ||
7730 | public void llResetLandPassList() | 7686 | public void llResetLandPassList() |
@@ -7741,6 +7697,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7741 | } | 7697 | } |
7742 | } | 7698 | } |
7743 | } | 7699 | } |
7700 | // ScriptSleep(100); | ||
7744 | } | 7701 | } |
7745 | 7702 | ||
7746 | public LSL_Types.LSLInteger llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) | 7703 | public LSL_Types.LSLInteger llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) |
@@ -7819,6 +7776,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7819 | ret.Add(d.Value); | 7776 | ret.Add(d.Value); |
7820 | } | 7777 | } |
7821 | } | 7778 | } |
7779 | // ScriptSleep(2000); | ||
7822 | return ret; | 7780 | return ret; |
7823 | } | 7781 | } |
7824 | 7782 | ||
@@ -7915,6 +7873,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
7915 | return; | 7873 | return; |
7916 | 7874 | ||
7917 | SetTexture(part, texture, face); | 7875 | SetTexture(part, texture, face); |
7876 | // ScriptSleep(200); | ||
7918 | } | 7877 | } |
7919 | 7878 | ||
7920 | public string llStringTrim(string src, int type) | 7879 | public string llStringTrim(string src, int type) |
@@ -8041,5 +8000,102 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
8041 | { | 8000 | { |
8042 | throw new Exception("LSL Runtime Error: " + msg); | 8001 | throw new Exception("LSL Runtime Error: " + msg); |
8043 | } | 8002 | } |
8003 | public int llGetNumberOfNotecardLines(string name) | ||
8004 | { | ||
8005 | m_host.AddScriptLPS(1); | ||
8006 | |||
8007 | // TODO: this script function should actually return | ||
8008 | // the number of lines via the dataserver event | ||
8009 | // once it is implemented - krtaylor | ||
8010 | |||
8011 | String[] notecardLines = GetNotecardLines(name); | ||
8012 | if (!String.IsNullOrEmpty(notecardLines[0])) | ||
8013 | { | ||
8014 | return notecardLines.Length; | ||
8015 | } | ||
8016 | else | ||
8017 | { | ||
8018 | return 0; | ||
8019 | } | ||
8020 | // ScriptSleep(100); | ||
8021 | } | ||
8022 | |||
8023 | public string llGetNotecardLine(string name, int line) | ||
8024 | { | ||
8025 | m_host.AddScriptLPS(1); | ||
8026 | |||
8027 | // TODO: this script function should actually return | ||
8028 | // the requested notecard line via the dataserver event | ||
8029 | // once it is implemented - krtaylor | ||
8030 | |||
8031 | String[] notecardLines = GetNotecardLines(name); | ||
8032 | |||
8033 | line--; // array starts at 0 | ||
8034 | if ((!String.IsNullOrEmpty(notecardLines[0])) && | ||
8035 | (line >= 0) && | ||
8036 | (line < notecardLines.Length)) | ||
8037 | { | ||
8038 | // ScriptSleep(100); | ||
8039 | return notecardLines[line]; | ||
8040 | } | ||
8041 | else | ||
8042 | { | ||
8043 | // ScriptSleep(100); | ||
8044 | return String.Empty; | ||
8045 | } | ||
8046 | } | ||
8047 | |||
8048 | private String[] GetNotecardLines(string name) | ||
8049 | { | ||
8050 | // bool found = false; | ||
8051 | int notecardIndex = 0; | ||
8052 | String[] notecardLines = { "0" }; | ||
8053 | notecardLines[0] = String.Empty; | ||
8054 | |||
8055 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
8056 | { | ||
8057 | if ((inv.Value.Name == name) && (inv.Value.InvType == (int)InventoryType.Notecard)) | ||
8058 | { | ||
8059 | // OK, it has the right name and it is a notecard | ||
8060 | // so get the asset that contains the notecard raw data | ||
8061 | // and convert it into a string | ||
8062 | AssetBase notecardAsset = World.AssetCache.GetAsset(inv.Value.AssetID, false); | ||
8063 | String dataString = System.Text.Encoding.ASCII.GetString(notecardAsset.Data); | ||
8064 | |||
8065 | if (!String.IsNullOrEmpty(dataString)) | ||
8066 | { | ||
8067 | // good, we have the notecard data as a string | ||
8068 | // now parse the text lines using the Linden Text delimiters | ||
8069 | notecardIndex = dataString.IndexOf("}\nText length "); | ||
8070 | if (notecardIndex > 0) | ||
8071 | { | ||
8072 | notecardIndex = notecardIndex + 2; //get past delimiter | ||
8073 | notecardIndex = dataString.IndexOf("\n", notecardIndex); | ||
8074 | if (notecardIndex > 0) | ||
8075 | { | ||
8076 | // Finally got to the first line of the notecard | ||
8077 | // now find the end of the notecard text delimited by }<LF> | ||
8078 | // parse the lines, delimited by <LF> | ||
8079 | notecardIndex = dataString.IndexOf("\n", notecardIndex); | ||
8080 | notecardIndex++; // get past delimiter | ||
8081 | |||
8082 | int notecardLength = dataString.Length - notecardIndex - 3; | ||
8083 | |||
8084 | // create new string to parse that only consists of the actual lines in the asset | ||
8085 | Char[] notecardCharArray = dataString.ToCharArray(notecardIndex, notecardLength); | ||
8086 | String notecardString = new String(notecardCharArray); | ||
8087 | |||
8088 | // split the lines of the notecard into separate strings | ||
8089 | char[] delimChar = { '\n' }; | ||
8090 | notecardLines = notecardString.Split(delimChar); | ||
8091 | return notecardLines; | ||
8092 | } | ||
8093 | } | ||
8094 | } | ||
8095 | } | ||
8096 | } | ||
8097 | return notecardLines; | ||
8098 | } | ||
8099 | |||
8044 | } | 8100 | } |
8045 | } | 8101 | } |