diff options
author | Pixel Tomsen | 2011-09-29 21:57:08 +0200 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-01 00:41:47 +0100 |
commit | c7db3df3442657cda398ff2f90d387bce98c718a (patch) | |
tree | 5d0a6df207ae78cfdb4432c4513628022c0ef246 /OpenSim/Region/ScriptEngine/Shared | |
parent | Add ability to pass in the permissions option (perm) to save oar via RemoteAdmin (diff) | |
download | opensim-SC_OLD-c7db3df3442657cda398ff2f90d387bce98c718a.zip opensim-SC_OLD-c7db3df3442657cda398ff2f90d387bce98c718a.tar.gz opensim-SC_OLD-c7db3df3442657cda398ff2f90d387bce98c718a.tar.bz2 opensim-SC_OLD-c7db3df3442657cda398ff2f90d387bce98c718a.tar.xz |
llGetLinkKey, llGetLinkName Fix for sitting Avatar
when an avatar sits on a prim, we get now his key & name ;-)
http://opensimulator.org/mantis/view.php?id=4476
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 39da563..9a26f4b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3704,6 +3704,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3704 | public LSL_String llGetLinkKey(int linknum) | 3704 | public LSL_String llGetLinkKey(int linknum) |
3705 | { | 3705 | { |
3706 | m_host.AddScriptLPS(1); | 3706 | m_host.AddScriptLPS(1); |
3707 | List<UUID> keytable = new List<UUID>(); | ||
3708 | // parse for sitting avatare-uuids | ||
3709 | World.ForEachScenePresence(delegate(ScenePresence presence) | ||
3710 | { | ||
3711 | if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) | ||
3712 | keytable.Add(presence.UUID); | ||
3713 | }); | ||
3714 | |||
3715 | int totalprims = m_host.ParentGroup.PrimCount + keytable.Count; | ||
3716 | if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) | ||
3717 | { | ||
3718 | return keytable[totalprims - linknum].ToString(); | ||
3719 | } | ||
3720 | |||
3721 | if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && keytable.Count == 1) | ||
3722 | { | ||
3723 | return m_host.UUID.ToString(); | ||
3724 | } | ||
3725 | |||
3707 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); | 3726 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); |
3708 | if (part != null) | 3727 | if (part != null) |
3709 | { | 3728 | { |
@@ -3747,6 +3766,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3747 | public LSL_String llGetLinkName(int linknum) | 3766 | public LSL_String llGetLinkName(int linknum) |
3748 | { | 3767 | { |
3749 | m_host.AddScriptLPS(1); | 3768 | m_host.AddScriptLPS(1); |
3769 | // parse for sitting avatare-names | ||
3770 | List<String> nametable = new List<String>(); | ||
3771 | World.ForEachScenePresence(delegate(ScenePresence presence) | ||
3772 | { | ||
3773 | if (!presence.IsChildAgent && presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) | ||
3774 | nametable.Add(presence.ControllingClient.Name); | ||
3775 | }); | ||
3776 | |||
3777 | int totalprims = m_host.ParentGroup.PrimCount + nametable.Count; | ||
3778 | if (totalprims > m_host.ParentGroup.PrimCount) | ||
3779 | { | ||
3780 | // sitting Avatar-Name with negativ linknum / SinglePrim | ||
3781 | if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1) | ||
3782 | return nametable[0]; | ||
3783 | // Prim-Name / SinglePrim Sitting Avatar | ||
3784 | if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1) | ||
3785 | return m_host.Name; | ||
3786 | // LinkNumber > of Real PrimSet = AvatarName | ||
3787 | if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims) | ||
3788 | return nametable[totalprims - linknum]; | ||
3789 | } | ||
3750 | 3790 | ||
3751 | // simplest case, this prims link number | 3791 | // simplest case, this prims link number |
3752 | if (m_host.LinkNum == linknum) | 3792 | if (m_host.LinkNum == linknum) |
@@ -3760,6 +3800,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3760 | else | 3800 | else |
3761 | return UUID.Zero.ToString(); | 3801 | return UUID.Zero.ToString(); |
3762 | } | 3802 | } |
3803 | |||
3763 | // Link set | 3804 | // Link set |
3764 | SceneObjectPart part = null; | 3805 | SceneObjectPart part = null; |
3765 | if (m_host.LinkNum == 1) // this is the Root prim | 3806 | if (m_host.LinkNum == 1) // this is the Root prim |