OpenSim.Region.ScriptEngine.Shared.Api.OSSL_Api.osGetNumberOfAttachments C# (CSharp) Method

osGetNumberOfAttachments() public method

public osGetNumberOfAttachments ( OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString avatar, OpenSim.Region.ScriptEngine.Shared.LSL_Types.list attachmentPoints ) : OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
avatar OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString
attachmentPoints OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
return OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
        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;
        }
OSSL_Api