diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 98 |
1 files changed, 53 insertions, 45 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 24d3615..9a0c836 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -784,25 +784,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
784 | public LSL_Float llCos(double f) | 784 | public LSL_Float llCos(double f) |
785 | { | 785 | { |
786 | m_host.AddScriptLPS(1); | 786 | m_host.AddScriptLPS(1); |
787 | return (double)Math.Cos(f); | 787 | return Math.Cos(f); |
788 | } | 788 | } |
789 | 789 | ||
790 | public LSL_Float llTan(double f) | 790 | public LSL_Float llTan(double f) |
791 | { | 791 | { |
792 | m_host.AddScriptLPS(1); | 792 | m_host.AddScriptLPS(1); |
793 | return (double)Math.Tan(f); | 793 | return Math.Tan(f); |
794 | } | 794 | } |
795 | 795 | ||
796 | public LSL_Float llAtan2(double x, double y) | 796 | public LSL_Float llAtan2(LSL_Float x, LSL_Float y) |
797 | { | 797 | { |
798 | m_host.AddScriptLPS(1); | 798 | m_host.AddScriptLPS(1); |
799 | return (double)Math.Atan2(x, y); | 799 | return Math.Atan2(x, y); |
800 | } | 800 | } |
801 | 801 | ||
802 | public LSL_Float llSqrt(double f) | 802 | public LSL_Float llSqrt(double f) |
803 | { | 803 | { |
804 | m_host.AddScriptLPS(1); | 804 | m_host.AddScriptLPS(1); |
805 | return (double)Math.Sqrt(f); | 805 | return Math.Sqrt(f); |
806 | } | 806 | } |
807 | 807 | ||
808 | public LSL_Float llPow(double fbase, double fexponent) | 808 | public LSL_Float llPow(double fbase, double fexponent) |
@@ -811,7 +811,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
811 | return (double)Math.Pow(fbase, fexponent); | 811 | return (double)Math.Pow(fbase, fexponent); |
812 | } | 812 | } |
813 | 813 | ||
814 | public LSL_Integer llAbs(int i) | 814 | public LSL_Integer llAbs(LSL_Integer i) |
815 | { | 815 | { |
816 | // changed to replicate LSL behaviour whereby minimum int value is returned untouched. | 816 | // changed to replicate LSL behaviour whereby minimum int value is returned untouched. |
817 | m_host.AddScriptLPS(1); | 817 | m_host.AddScriptLPS(1); |
@@ -3069,7 +3069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3069 | m_host.ParentGroup.StopMoveToTarget(); | 3069 | m_host.ParentGroup.StopMoveToTarget(); |
3070 | } | 3070 | } |
3071 | 3071 | ||
3072 | public void llApplyImpulse(LSL_Vector force, int local) | 3072 | public void llApplyImpulse(LSL_Vector force, LSL_Integer local) |
3073 | { | 3073 | { |
3074 | m_host.AddScriptLPS(1); | 3074 | m_host.AddScriptLPS(1); |
3075 | //No energy force yet | 3075 | //No energy force yet |
@@ -3526,7 +3526,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3526 | return src.ToLower(); | 3526 | return src.ToLower(); |
3527 | } | 3527 | } |
3528 | 3528 | ||
3529 | public LSL_Integer llGiveMoney(string destination, int amount) | 3529 | public LSL_Integer llGiveMoney(LSL_Key destination, LSL_Integer amount) |
3530 | { | 3530 | { |
3531 | Util.FireAndForget(x => | 3531 | Util.FireAndForget(x => |
3532 | { | 3532 | { |
@@ -3785,7 +3785,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3785 | return 100f * llGetMass(); | 3785 | return 100f * llGetMass(); |
3786 | } | 3786 | } |
3787 | 3787 | ||
3788 | public void llCollisionFilter(string name, string id, int accept) | 3788 | public void llCollisionFilter(LSL_String name, LSL_Key id, LSL_Integer accept) |
3789 | { | 3789 | { |
3790 | m_host.AddScriptLPS(1); | 3790 | m_host.AddScriptLPS(1); |
3791 | m_host.CollisionFilter.Clear(); | 3791 | m_host.CollisionFilter.Clear(); |
@@ -4513,7 +4513,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4513 | } | 4513 | } |
4514 | } | 4514 | } |
4515 | 4515 | ||
4516 | public void llCreateLink(LSL_String target, LSL_Integer parent) | 4516 | public void llCreateLink(LSL_Key target, LSL_Integer parent) |
4517 | { | 4517 | { |
4518 | m_host.AddScriptLPS(1); | 4518 | m_host.AddScriptLPS(1); |
4519 | 4519 | ||
@@ -4847,7 +4847,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4847 | return 1.0f; | 4847 | return 1.0f; |
4848 | } | 4848 | } |
4849 | 4849 | ||
4850 | public void llGiveInventory(string destination, string inventory) | 4850 | public void llGiveInventory(LSL_Key destination, LSL_String inventory) |
4851 | { | 4851 | { |
4852 | m_host.AddScriptLPS(1); | 4852 | m_host.AddScriptLPS(1); |
4853 | 4853 | ||
@@ -5317,7 +5317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5317 | } | 5317 | } |
5318 | } | 5318 | } |
5319 | 5319 | ||
5320 | public void llCollisionSound(string impact_sound, double impact_volume) | 5320 | public void llCollisionSound(LSL_String impact_sound, LSL_Float impact_volume) |
5321 | { | 5321 | { |
5322 | m_host.AddScriptLPS(1); | 5322 | m_host.AddScriptLPS(1); |
5323 | 5323 | ||
@@ -5344,11 +5344,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5344 | m_host.aggregateScriptEvents(); | 5344 | m_host.aggregateScriptEvents(); |
5345 | } | 5345 | } |
5346 | 5346 | ||
5347 | public LSL_String llGetAnimation(string id) | 5347 | public LSL_String llGetAnimation(LSL_Key id) |
5348 | { | 5348 | { |
5349 | // This should only return a value if the avatar is in the same region | 5349 | // This should only return a value if the avatar is in the same region |
5350 | m_host.AddScriptLPS(1); | 5350 | m_host.AddScriptLPS(1); |
5351 | UUID avatar = (UUID)id; | 5351 | UUID avatar; |
5352 | if(!UUID.TryParse(id, out avatar)) | ||
5353 | return ""; | ||
5352 | ScenePresence presence = World.GetScenePresence(avatar); | 5354 | ScenePresence presence = World.GetScenePresence(avatar); |
5353 | if (presence == null) | 5355 | if (presence == null) |
5354 | return ""; | 5356 | return ""; |
@@ -5698,13 +5700,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5698 | return angle; | 5700 | return angle; |
5699 | } | 5701 | } |
5700 | 5702 | ||
5701 | public LSL_Float llAcos(double val) | 5703 | public LSL_Float llAcos(LSL_Float val) |
5702 | { | 5704 | { |
5703 | m_host.AddScriptLPS(1); | 5705 | m_host.AddScriptLPS(1); |
5704 | return (double)Math.Acos(val); | 5706 | return (double)Math.Acos(val); |
5705 | } | 5707 | } |
5706 | 5708 | ||
5707 | public LSL_Float llAsin(double val) | 5709 | public LSL_Float llAsin(LSL_Float val) |
5708 | { | 5710 | { |
5709 | m_host.AddScriptLPS(1); | 5711 | m_host.AddScriptLPS(1); |
5710 | return (double)Math.Asin(val); | 5712 | return (double)Math.Asin(val); |
@@ -5744,7 +5746,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5744 | return UUID.Zero.ToString(); | 5746 | return UUID.Zero.ToString(); |
5745 | } | 5747 | } |
5746 | 5748 | ||
5747 | public void llAllowInventoryDrop(int add) | 5749 | public void llAllowInventoryDrop(LSL_Integer add) |
5748 | { | 5750 | { |
5749 | m_host.AddScriptLPS(1); | 5751 | m_host.AddScriptLPS(1); |
5750 | 5752 | ||
@@ -6639,7 +6641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6639 | /// AGENT_BUSY | 6641 | /// AGENT_BUSY |
6640 | /// Remove as they are done | 6642 | /// Remove as they are done |
6641 | /// </summary> | 6643 | /// </summary> |
6642 | public LSL_Integer llGetAgentInfo(string id) | 6644 | public LSL_Integer llGetAgentInfo(LSL_Key id) |
6643 | { | 6645 | { |
6644 | m_host.AddScriptLPS(1); | 6646 | m_host.AddScriptLPS(1); |
6645 | 6647 | ||
@@ -6746,7 +6748,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6746 | return flags; | 6748 | return flags; |
6747 | } | 6749 | } |
6748 | 6750 | ||
6749 | public LSL_String llGetAgentLanguage(string id) | 6751 | public LSL_String llGetAgentLanguage(LSL_Key id) |
6750 | { | 6752 | { |
6751 | // This should only return a value if the avatar is in the same region, but eh. idc. | 6753 | // This should only return a value if the avatar is in the same region, but eh. idc. |
6752 | m_host.AddScriptLPS(1); | 6754 | m_host.AddScriptLPS(1); |
@@ -6857,7 +6859,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6857 | return result; | 6859 | return result; |
6858 | } | 6860 | } |
6859 | 6861 | ||
6860 | public void llAdjustSoundVolume(double volume) | 6862 | public void llAdjustSoundVolume(LSL_Float volume) |
6861 | { | 6863 | { |
6862 | m_host.AddScriptLPS(1); | 6864 | m_host.AddScriptLPS(1); |
6863 | m_host.AdjustSoundGain(volume); | 6865 | m_host.AdjustSoundGain(volume); |
@@ -6870,7 +6872,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6870 | m_host.SoundRadius = radius; | 6872 | m_host.SoundRadius = radius; |
6871 | } | 6873 | } |
6872 | 6874 | ||
6873 | public LSL_String llKey2Name(string id) | 6875 | public LSL_String llKey2Name(LSL_Key id) |
6874 | { | 6876 | { |
6875 | m_host.AddScriptLPS(1); | 6877 | m_host.AddScriptLPS(1); |
6876 | UUID key = new UUID(); | 6878 | UUID key = new UUID(); |
@@ -7044,22 +7046,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7044 | /// only the height of avatars vary and that says: | 7046 | /// only the height of avatars vary and that says: |
7045 | /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively). | 7047 | /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively). |
7046 | /// </summary> | 7048 | /// </summary> |
7047 | public LSL_Vector llGetAgentSize(string id) | 7049 | public LSL_Vector llGetAgentSize(LSL_Key id) |
7048 | { | 7050 | { |
7049 | m_host.AddScriptLPS(1); | 7051 | m_host.AddScriptLPS(1); |
7050 | ScenePresence avatar = World.GetScenePresence((UUID)id); | 7052 | UUID avID; |
7051 | LSL_Vector agentSize; | 7053 | if(!UUID.TryParse(id, out avID)) |
7054 | return ScriptBaseClass.ZERO_VECTOR; | ||
7055 | |||
7056 | ScenePresence avatar = World.GetScenePresence(avID); | ||
7052 | if (avatar == null || avatar.IsChildAgent) // Fail if not in the same region | 7057 | if (avatar == null || avatar.IsChildAgent) // Fail if not in the same region |
7053 | { | 7058 | return ScriptBaseClass.ZERO_VECTOR; |
7054 | agentSize = ScriptBaseClass.ZERO_VECTOR; | 7059 | |
7055 | } | ||
7056 | else | ||
7057 | { | ||
7058 | // agentSize = new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight); | 7060 | // agentSize = new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight); |
7059 | Vector3 s = avatar.Appearance.AvatarSize; | 7061 | Vector3 s = avatar.Appearance.AvatarSize; |
7060 | agentSize = new LSL_Vector(s.X, s.Y, s.Z); | 7062 | return new LSL_Vector(s.X, s.Y, s.Z); |
7061 | } | ||
7062 | return agentSize; | ||
7063 | } | 7063 | } |
7064 | 7064 | ||
7065 | public LSL_Integer llSameGroup(string id) | 7065 | public LSL_Integer llSameGroup(string id) |
@@ -7235,12 +7235,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7235 | return m_host.ParentGroup.AttachmentPoint; | 7235 | return m_host.ParentGroup.AttachmentPoint; |
7236 | } | 7236 | } |
7237 | 7237 | ||
7238 | public LSL_List llGetAttachedList(string id) | 7238 | public LSL_List llGetAttachedList(LSL_Key id) |
7239 | { | 7239 | { |
7240 | m_host.AddScriptLPS(1); | 7240 | m_host.AddScriptLPS(1); |
7241 | 7241 | ||
7242 | ScenePresence av = World.GetScenePresence((UUID)id); | 7242 | UUID avID; |
7243 | if(!UUID.TryParse(id, out avID)) | ||
7244 | return new LSL_List("NOT_FOUND"); | ||
7243 | 7245 | ||
7246 | ScenePresence av = World.GetScenePresence(avID); | ||
7244 | if (av == null || av.IsDeleted) | 7247 | if (av == null || av.IsDeleted) |
7245 | return new LSL_List("NOT_FOUND"); | 7248 | return new LSL_List("NOT_FOUND"); |
7246 | 7249 | ||
@@ -7825,7 +7828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7825 | } | 7828 | } |
7826 | } | 7829 | } |
7827 | 7830 | ||
7828 | public void llGiveInventoryList(string destination, string category, LSL_List inventory) | 7831 | public void llGiveInventoryList(LSL_Key destination, LSL_String category, LSL_List inventory) |
7829 | { | 7832 | { |
7830 | m_host.AddScriptLPS(1); | 7833 | m_host.AddScriptLPS(1); |
7831 | 7834 | ||
@@ -8003,7 +8006,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8003 | } | 8006 | } |
8004 | 8007 | ||
8005 | 8008 | ||
8006 | public void llAddToLandPassList(LSL_Key avatar, double hours) | 8009 | public void llAddToLandPassList(LSL_Key avatar, LSL_Float hours) |
8007 | { | 8010 | { |
8008 | m_host.AddScriptLPS(1); | 8011 | m_host.AddScriptLPS(1); |
8009 | UUID key; | 8012 | UUID key; |
@@ -11075,16 +11078,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11075 | return (double)Math.Log(val); | 11078 | return (double)Math.Log(val); |
11076 | } | 11079 | } |
11077 | 11080 | ||
11078 | public LSL_List llGetAnimationList(string id) | 11081 | public LSL_List llGetAnimationList(LSL_Key id) |
11079 | { | 11082 | { |
11080 | m_host.AddScriptLPS(1); | 11083 | m_host.AddScriptLPS(1); |
11081 | 11084 | ||
11082 | LSL_List l = new LSL_List(); | 11085 | UUID avID; |
11083 | ScenePresence av = World.GetScenePresence((UUID)id); | 11086 | if(!UUID.TryParse(id, out avID)) |
11087 | return new LSL_List(); | ||
11088 | |||
11089 | ScenePresence av = World.GetScenePresence(avID); | ||
11084 | if (av == null || av.IsChildAgent) // only if in the region | 11090 | if (av == null || av.IsChildAgent) // only if in the region |
11085 | return l; | 11091 | return new LSL_List(); |
11092 | |||
11086 | UUID[] anims; | 11093 | UUID[] anims; |
11087 | anims = av.Animator.GetAnimationArray(); | 11094 | anims = av.Animator.GetAnimationArray(); |
11095 | LSL_List l = new LSL_List(); | ||
11088 | foreach (UUID foo in anims) | 11096 | foreach (UUID foo in anims) |
11089 | l.Add(new LSL_Key(foo.ToString())); | 11097 | l.Add(new LSL_Key(foo.ToString())); |
11090 | return l; | 11098 | return l; |
@@ -13608,7 +13616,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13608 | ScriptSleep(m_sleepMsOnMapDestination); | 13616 | ScriptSleep(m_sleepMsOnMapDestination); |
13609 | } | 13617 | } |
13610 | 13618 | ||
13611 | public void llAddToLandBanList(LSL_Key avatar, double hours) | 13619 | public void llAddToLandBanList(LSL_Key avatar, LSL_Float hours) |
13612 | { | 13620 | { |
13613 | m_host.AddScriptLPS(1); | 13621 | m_host.AddScriptLPS(1); |
13614 | UUID key; | 13622 | UUID key; |
@@ -15048,7 +15056,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
15048 | return name.Replace(" ", ".").ToLower(); | 15056 | return name.Replace(" ", ".").ToLower(); |
15049 | } | 15057 | } |
15050 | 15058 | ||
15051 | public LSL_String llGetUsername(string id) | 15059 | public LSL_String llGetUsername(LSL_Key id) |
15052 | { | 15060 | { |
15053 | return Name2Username(llKey2Name(id)); | 15061 | return Name2Username(llKey2Name(id)); |
15054 | } | 15062 | } |
@@ -16591,7 +16599,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
16591 | m_SoundModule.SetSoundQueueing(m_host.UUID, queue == ScriptBaseClass.TRUE.value); | 16599 | m_SoundModule.SetSoundQueueing(m_host.UUID, queue == ScriptBaseClass.TRUE.value); |
16592 | } | 16600 | } |
16593 | 16601 | ||
16594 | public void llCollisionSprite(string impact_sprite) | 16602 | public void llCollisionSprite(LSL_String impact_sprite) |
16595 | { | 16603 | { |
16596 | m_host.AddScriptLPS(1); | 16604 | m_host.AddScriptLPS(1); |
16597 | // Viewer 2.0 broke this and it's likely LL has no intention | 16605 | // Viewer 2.0 broke this and it's likely LL has no intention |
@@ -16652,7 +16660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
16652 | new DetectParams[0])); | 16660 | new DetectParams[0])); |
16653 | } | 16661 | } |
16654 | 16662 | ||
16655 | public LSL_Key llTransferLindenDollars(string destination, int amount) | 16663 | public LSL_Key llTransferLindenDollars(LSL_Key destination, LSL_Integer amount) |
16656 | { | 16664 | { |
16657 | UUID txn = UUID.Random(); | 16665 | UUID txn = UUID.Random(); |
16658 | 16666 | ||