diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index e245684a43..57f1e65b06 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3313,6 +3313,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
((LSL_Api)m_LSL_Api).DetachFromAvatar();
}
+ public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints)
+ {
+ CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments");
+
+ m_host.AddScriptLPS(1);
+
+ UUID targetUUID;
+ ScenePresence target;
+ LSL_List resp = new LSL_List();
+
+ if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target))
+ {
+ foreach (object point in attachmentPoints.Data)
+ {
+ LSL_Integer ipoint = new LSL_Integer(
+ (point is LSL_Integer || point is int || point is uint) ?
+ (int)point :
+ 0
+ );
+ resp.Add(ipoint);
+ if (ipoint == 0)
+ {
+ // indicates zero attachments
+ resp.Add(new LSL_Integer(0));
+ }
+ else
+ {
+ // gets the number of attachments on the attachment point
+ resp.Add(new LSL_Integer(target.GetAttachments((uint)ipoint).Count));
+ }
+ }
+ }
+
+ return resp;
+ }
+
+ #endregion
+
///
/// Checks if thing is a UUID.
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 06729abe36..6db6443d56 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -192,6 +192,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
/// Nothing happens if the object is not attached.
void osForceDetachFromAvatar();
+ ///
+ /// Returns a strided list of the specified attachment points and the number of attachments on those points.
+ ///
+ /// avatar UUID
+ /// list of ATTACH_* constants
+ ///
+ LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints);
+
+ #endregion
+
//texture draw functions
string osMovePen(string drawList, int x, int y);
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index ba1ade2285..230c378586 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -311,6 +311,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osForceDetachFromAvatar();
}
+ public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints)
+ {
+ return m_OSSL_Functions.osGetNumberOfAttachments(avatar, attachmentPoints);
+ }
+
+ #endregion
+
// Texture Draw functions
public string osMovePen(string drawList, int x, int y)