implementing a function to get the number of attachments worn
parent
8d431c6359
commit
a858c5daee
|
@ -3313,6 +3313,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
((LSL_Api)m_LSL_Api).DetachFromAvatar();
|
((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
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if thing is a UUID.
|
/// Checks if thing is a UUID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -192,6 +192,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
/// <remarks>Nothing happens if the object is not attached.</remarks>
|
/// <remarks>Nothing happens if the object is not attached.</remarks>
|
||||||
void osForceDetachFromAvatar();
|
void osForceDetachFromAvatar();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a strided list of the specified attachment points and the number of attachments on those points.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="avatar">avatar UUID</param>
|
||||||
|
/// <param name="attachmentPoints">list of ATTACH_* constants</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
//texture draw functions
|
//texture draw functions
|
||||||
string osMovePen(string drawList, int x, int y);
|
string osMovePen(string drawList, int x, int y);
|
||||||
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
|
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
|
||||||
|
|
|
@ -311,6 +311,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_OSSL_Functions.osForceDetachFromAvatar();
|
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
|
// Texture Draw functions
|
||||||
|
|
||||||
public string osMovePen(string drawList, int x, int y)
|
public string osMovePen(string drawList, int x, int y)
|
||||||
|
|
Loading…
Reference in New Issue