diff options
author | SignpostMarv | 2012-09-01 02:39:49 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-09-04 00:03:43 +0100 |
commit | a858c5daee64223355de04b77746142be0f5795f (patch) | |
tree | 54011371ad2851243fa5cb4ecffc37ca07e528a0 /OpenSim/Region/ScriptEngine/Shared | |
parent | formatting (diff) | |
download | opensim-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')
3 files changed, 55 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> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 06729ab..6db6443 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 | |||
192 | /// <remarks>Nothing happens if the object is not attached.</remarks> | 192 | /// <remarks>Nothing happens if the object is not attached.</remarks> |
193 | void osForceDetachFromAvatar(); | 193 | void osForceDetachFromAvatar(); |
194 | 194 | ||
195 | /// <summary> | ||
196 | /// Returns a strided list of the specified attachment points and the number of attachments on those points. | ||
197 | /// </summary> | ||
198 | /// <param name="avatar">avatar UUID</param> | ||
199 | /// <param name="attachmentPoints">list of ATTACH_* constants</param> | ||
200 | /// <returns></returns> | ||
201 | LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints); | ||
202 | |||
203 | #endregion | ||
204 | |||
195 | //texture draw functions | 205 | //texture draw functions |
196 | string osMovePen(string drawList, int x, int y); | 206 | string osMovePen(string drawList, int x, int y); |
197 | string osDrawLine(string drawList, int startX, int startY, int endX, int endY); | 207 | 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 ba1ade2..230c378 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 | |||
311 | m_OSSL_Functions.osForceDetachFromAvatar(); | 311 | m_OSSL_Functions.osForceDetachFromAvatar(); |
312 | } | 312 | } |
313 | 313 | ||
314 | public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints) | ||
315 | { | ||
316 | return m_OSSL_Functions.osGetNumberOfAttachments(avatar, attachmentPoints); | ||
317 | } | ||
318 | |||
319 | #endregion | ||
320 | |||
314 | // Texture Draw functions | 321 | // Texture Draw functions |
315 | 322 | ||
316 | public string osMovePen(string drawList, int x, int y) | 323 | public string osMovePen(string drawList, int x, int y) |