aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs63
1 files changed, 58 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c91bdb2..34d888d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3039,18 +3039,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3039 } 3039 }
3040 } 3040 }
3041 3041
3042 /// <summary>
3043 /// The rules governing the returned name are not simple. The only
3044 /// time a blank name is returned is if the target prim has a blank
3045 /// name. If no prim with the given link number can be found then
3046 /// usually NULL_KEY is returned but there are exceptions.
3047 ///
3048 /// In a single unlinked prim, A call with 0 returns the name, all
3049 /// other values for link number return NULL_KEY
3050 ///
3051 /// In link sets it is more complicated.
3052 ///
3053 /// If the script is in the root prim:-
3054 /// A zero link number returns NULL_KEY.
3055 /// Positive link numbers return the name of the prim, or NULL_KEY
3056 /// if a prim does not exist at that position.
3057 /// Negative link numbers return the name of the first child prim.
3058 ///
3059 /// If the script is in a child prim:-
3060 /// Link numbers 0 or 1 return the name of the root prim.
3061 /// Positive link numbers return the name of the prim or NULL_KEY
3062 /// if a prim does not exist at that position.
3063 /// Negative numbers return the name of the root prim.
3064 ///
3065 /// References
3066 /// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetLinkName
3067 /// Mentions NULL_KEY being returned
3068 /// http://wiki.secondlife.com/wiki/LlGetLinkName
3069 /// Mentions using the LINK_* constants, some of which are negative
3070 /// </summary>
3042 public LSL_String llGetLinkName(int linknum) 3071 public LSL_String llGetLinkName(int linknum)
3043 { 3072 {
3044 m_host.AddScriptLPS(1); 3073 m_host.AddScriptLPS(1);
3045 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); 3074
3046 if (part != null) 3075 // simplest case, this prims link number
3076 if (m_host.LinkNum == linknum)
3077 return m_host.Name;
3078
3079 // Single prim
3080 if (m_host.LinkNum == 0)
3047 { 3081 {
3048 return part.Name; 3082 if (linknum == 0)
3083 return m_host.Name;
3084 else
3085 return UUID.Zero.ToString();
3049 } 3086 }
3050 else 3087 // Link set
3088 SceneObjectPart part = null;
3089 if (m_host.LinkNum == 1) // this is the Root prim
3051 { 3090 {
3052 return ""; 3091 if (linknum < 0)
3092 part = m_host.ParentGroup.GetLinkNumPart(2);
3093 else
3094 part = m_host.ParentGroup.GetLinkNumPart(linknum);
3095 }
3096 else // this is a child prim
3097 {
3098 if (linknum < 2)
3099 part = m_host.ParentGroup.GetLinkNumPart(1);
3100 else
3101 part = m_host.ParentGroup.GetLinkNumPart(linknum);
3053 } 3102 }
3103 if (part != null)
3104 return part.Name;
3105 else
3106 return UUID.Zero.ToString();
3054 } 3107 }
3055 3108
3056 public LSL_Integer llGetInventoryNumber(int type) 3109 public LSL_Integer llGetInventoryNumber(int type)