aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorSignpostMarv2012-09-01 02:39:49 +0100
committerJustin Clark-Casey (justincc)2012-09-04 00:03:43 +0100
commita858c5daee64223355de04b77746142be0f5795f (patch)
tree54011371ad2851243fa5cb4ecffc37ca07e528a0 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentformatting (diff)
downloadopensim-SC-a858c5daee64223355de04b77746142be0f5795f.zip
opensim-SC-a858c5daee64223355de04b77746142be0f5795f.tar.gz
opensim-SC-a858c5daee64223355de04b77746142be0f5795f.tar.bz2
opensim-SC-a858c5daee64223355de04b77746142be0f5795f.tar.xz
implementing a function to get the number of attachments worn
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index e245684..57f1e65 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
3313 ((LSL_Api)m_LSL_Api).DetachFromAvatar(); 3313 ((LSL_Api)m_LSL_Api).DetachFromAvatar();
3314 } 3314 }
3315 3315
3316 public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints)
3317 {
3318 CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments");
3319
3320 m_host.AddScriptLPS(1);
3321
3322 UUID targetUUID;
3323 ScenePresence target;
3324 LSL_List resp = new LSL_List();
3325
3326 if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target))
3327 {
3328 foreach (object point in attachmentPoints.Data)
3329 {
3330 LSL_Integer ipoint = new LSL_Integer(
3331 (point is LSL_Integer || point is int || point is uint) ?
3332 (int)point :
3333 0
3334 );
3335 resp.Add(ipoint);
3336 if (ipoint == 0)
3337 {
3338 // indicates zero attachments
3339 resp.Add(new LSL_Integer(0));
3340 }
3341 else
3342 {
3343 // gets the number of attachments on the attachment point
3344 resp.Add(new LSL_Integer(target.GetAttachments((uint)ipoint).Count));
3345 }
3346 }
3347 }
3348
3349 return resp;
3350 }
3351
3352 #endregion
3353
3316 /// <summary> 3354 /// <summary>
3317 /// Checks if thing is a UUID. 3355 /// Checks if thing is a UUID.
3318 /// </summary> 3356 /// </summary>